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.

PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->label($id, $text)LabelCreate a form label component.
->text($text)selfSet the label text.
->for($inputId)selfSet the for attribute — ID of the associated input.
->required()selfShow a red asterisk to indicate a required field.
->hint($text)selfAdd subdued helper text beside the label.
->icon($icon)selfPrepend a Font Awesome icon. Same format as $m->icon().

PHP Component Fluent Methods (on any component)

Method / PropertyParametersDescription
->label($text)selfRender a label above this component.
->labelIcon($icon)selfAdd an icon to the inline label. Has no effect without ->label().
->labelRequired()selfMark the inline label as required. Has no effect without ->label().
->labelHint($text)selfAdd hint text to the inline label. Has no effect without ->label().

PHP CSS Classes

Method / PropertyParametersDescription
.m-labelBase form label — block, bold, small text.
.m-label-requiredRed asterisk span inside a required label.
.m-label-hintMuted helper/hint text span inside a label.