Skip to main content
Labels provide accessible text descriptions for form fields.

Basic Usage

Labels can contain text directly or wrap other components.

With Form Fields

Labels are typically paired with inputs and other form controls:

Optional Indicator

Set optional=True to show a muted “optional” hint after the label text. Form.from_model() sets this automatically for non-required fields; for manually built forms, set it yourself on any label.

API Reference

Label Parameters

str | None
default:"None"
Label text content. Can be passed as a positional argument.
str | None
default:"None"
ID of the associated form field element.
bool
default:"False"
When True, displays a muted “optional” indicator after the label text.
str | None
default:"None"
Additional Tailwind CSS classes appended to the component’s built-in styles.

Protocol Reference

Label
For the complete protocol schema, see Label.