PhiaUi.Components.Label (phia_ui v0.1.17)

Copy Markdown View Source

Accessible label component for form inputs.

Renders a <label> element with optional required indicator and full Tailwind styling. Associates with inputs via the for attribute.

Example

<.label for="email">Email address</.label>
<.label for="password" required={true}>Password</.label>

Summary

Functions

Renders an accessible <label> element.

Functions

label(assigns)

Renders an accessible <label> element.

Examples

<.label for="email">Email</.label>
<.label for="password" required={true}>Password</.label>

Attributes

  • for (:string) - The input element ID to associate this label with. Defaults to nil.
  • required (:boolean) - When true, renders a red asterisk to indicate the field is required. Defaults to false.
  • class (:string) - Additional CSS classes. Defaults to nil.
  • Global attributes are accepted. HTML attributes forwarded to the label element.

Slots

  • inner_block (required) - Label text or content.