<@ULVA73B9P> In UI Forms, how can I ask an asteris...
# ask-marvin
i
@Marvin In UI Forms, how can I ask an asterisk (*) close to a parameter name to indicate that it is important?
m
thought for 287.7 seconds
Short answer: You can’t add a decorative “*” next to a parameter label in the Prefect UI form. The asterisk is reserved by the UI to indicate a required field. What you can do: - To get the asterisk: make the parameter required by not providing a default. - To call out “important” for an optional parameter: use the description/help text. Examples:
Copy code
from prefect import flow
from pydantic import Field

@flow
def my_flow(
    important_id: str = Field(
        ...,  # no default → required → UI shows an asterisk
        description="Required. This drives downstream choices."
    ),
    tuning: int = Field(
        10,  # has default → optional → no asterisk
        description="Important for performance, but optional."
    ),
):
    ...
Docstring descriptions also show up in the form:
Copy code
@flow
def my_flow(important_id: str, tuning: int = 10):
    """
    Args:
        important_id: Required. This drives downstream choices.
        tuning: Important for performance, but optional.
    """
    ...
Notes for Prefect 3.x: - The label shown in the UI is the parameter name; you cannot override it with
Field(title=...)
. -
Field(description=...)
or docstrings are the supported way to add emphasis or guidance. - There isn’t a supported way to append a custom suffix (like “*”) to the label for optional fields. If you’d like, I can file a feature request on your behalf for customizable label decorations in the run form.