Label
A semantic <label> element for associating text with a form input.
Use ->for($inputId) to wire it to the correct field — this enlarges the
clickable/focusable area and is essential for accessibility.
Use ->required() to show a red asterisk for mandatory fields, and
->hint() to add optional sub-text.
Basic Form Label
A label linked to an input via for.
Required Field
->required() appends a red asterisk.
With Hint Text
->hint() adds subdued helper text beside the label.
With Icon
->icon() prepends a Font Awesome icon to the label text. Accepts the same icon strings as $m->icon().
Component ->label() & ->labelIcon()
Any Manhattan component supports ->label() to render a label above itself, and ->labelIcon() to include an icon in that label.
Select…
PHP PHP Methods (Fluent)
| Method / Property | Parameters | Description |
|---|---|---|
$m->label($id, $text) | Label | Create a form label component. |
->text($text) | self | Set the label text. |
->for($inputId) | self | Set the for attribute — ID of the associated input. |
->required() | self | Show a red asterisk to indicate a required field. |
->hint($text) | self | Add subdued helper text beside the label. |
->icon($icon) | self | Prepend a Font Awesome icon. Same format as $m->icon(). |
PHP Component Fluent Methods (on any component)
| Method / Property | Parameters | Description |
|---|---|---|
->label($text) | self | Render a label above this component. |
->labelIcon($icon) | self | Add an icon to the inline label. Has no effect without ->label(). |
->labelRequired() | self | Mark the inline label as required. Has no effect without ->label(). |
->labelHint($text) | self | Add hint text to the inline label. Has no effect without ->label(). |
PHP CSS Classes
| Method / Property | Parameters | Description |
|---|---|---|
.m-label | | Base form label — block, bold, small text. |
.m-label-required | | Red asterisk span inside a required label. |
.m-label-hint | | Muted helper/hint text span inside a label. |