Label
The name of a form control, with an optional required marker.
<x-atlas::label>
A label names one control, in bold, on its own line above it. It carries the whole label line: the name, a required marker, and anything else you put in the slot. Labels almost always live inside a field, which owns the spacing between the label and the control below it.
<x-atlas::field>
<x-atlas::label for="company">Company name</x-atlas::label>
<x-atlas::input id="company" name="company" type="text" />
</x-atlas::field>
Required marker
is-required appends a red asterisk, hidden from assistive technology so it is
not read as punctuation. It is a visual cue only — the control still needs its own
required attribute, and the browser will not enforce anything without it. Mark
the minority: if most fields on a form are required, badge the optional ones instead.
<x-atlas::field>
<x-atlas::label for="vat-number" is-required>VAT number</x-atlas::label>
<x-atlas::input id="vat-number" name="vat_number" type="text" placeholder="NL001234567B01" required />
</x-atlas::field>
<x-atlas::field>
<x-atlas::label for="chamber-number">Chamber of Commerce number</x-atlas::label>
<x-atlas::input id="chamber-number" name="chamber_number" type="text" />
</x-atlas::field>
Badge on the label line
Anything in the slot renders after the label text, which is where a badge goes when a field needs a qualifier a word longer than an asterisk — optional, beta, restricted to a role.
<x-atlas::field>
<x-atlas::label for="referral-code">
Referral code
<x-atlas::badge variant="outlined" color="secondary">Optional</x-atlas::badge>
</x-atlas::label>
<x-atlas::input id="referral-code" name="referral_code" type="text" />
</x-atlas::field>
<x-atlas::field>
<x-atlas::label for="api-token">
API token
<x-atlas::badge color="danger">Admins only</x-atlas::badge>
</x-atlas::label>
<x-atlas::input id="api-token" name="api_token" type="password" />
</x-atlas::field>
badge prop, but nothing in the template renders
it. Because it is declared, Blade strips it out of the attribute bag, so
badge="Optional" vanishes without an error. Put the badge in the slot, as above.
Pairing with the control
Atlas renders an <atlas-label> custom element rather than a native
<label>, and nothing upgrades it in the browser. A for
attribute therefore passes straight through to the markup without doing anything: clicking
the label will not focus the control, and a screen reader will not announce the name.
Until that changes, give the label an id and point the control at it with
aria-labelledby. Keeping for alongside it costs nothing and states
the intent for whoever reads the template next.
<x-atlas::field>
<x-atlas::label id="mobile-label" for="mobile">Mobile number</x-atlas::label>
<x-atlas::input id="mobile" name="mobile" type="tel" aria-labelledby="mobile-label" placeholder="+31 6 12 34 56 78" />
</x-atlas::field>
Related components
Field
The wrapper that binds a label, a control and an error message into one form row.
Input
A single-line text control, styled for every input type the browser offers.
Textarea
A multi-line text control that shares the input styling, with a resize handle you can lock down.
Error
The message that explains why a control was rejected, with a warning icon in front of it.
Legend
The heading that names a fieldset.
Select
A native select styled with Atlas input tokens, with a disabled placeholder option built in.
Checkbox
A checkbox with a styled indicator, an optional description and a card-like grouped layout.
Radio
A native radio button with a styled indicator, plus a group wrapper for the set it belongs to.
Toggle
A switch that turns something on or off immediately, implementing the full ARIA switch pattern in Alpine over a hidden checkbox.
Reference
<x-atlas::label>
-
- Name
is-required- Type
- bool
- Default
- default: false
- Description
- Appends a red asterisk after the slot, hidden from assistive technology. Purely visual — it does not mark the control required.
-
- Name
badge- Type
- string
- Default
- default: null
- Description
- Accepted but never rendered. Declaring it as a prop removes it from the attribute bag, so a value passed here disappears silently; put a <a href="/components/badge">badge</a> in the slot instead.
Slots
-
- Name
default- Type
- slot
- Description
- The label text, and anything else that should sit on the label line.