Glass
JS behaviour
Glass switch
A switch on a native checkbox; the knob clears to glass while held and every other attribute (wire:model, disabled) lands on the input itself.
Real scenarios
The component as it is used in a product — not a specimen grid.
Quiet hours
Digest on
Born checked, or locked
Held-down knobs clear to glass — press and hold one.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| label | string | null | The text beside the switch (inside the label, so clicking the text works too). |
| wire:model / native | — | — | Every native checkbox attribute is accepted: checked, disabled, name and wire:model. |
Snippet
<x-nx::glass-switch label="خبرنامهٔ هفتگی" wire:model.live="state.newsletter" />