Slider — a single-thumb range input built on the WAI-ARIA APG slider pattern.
No Fluxon equivalent; the form surface (field/name/value, label stack,
errors) mirrors LanternUI's other form controls.
<.slider field={@form[:volume]} label="Volume" />
<.slider name="quality" value={80} min={0} max={100} step={5} label="Quality" value_text="{value}%" />The value lives in a hidden input (the real form control), so phx-change
and form submits see it exactly like a native input. The LanternSlider hook
owns the interaction: pointer drag on the track, and Arrow/Home/End/
PageUp/PageDown value stepping on the role="slider" thumb. Keyboard steps
and drag release commit the value (the hook writes the hidden input and
dispatches bubbling input/change); intermediate drag moves only update
the visuals and aria-valuenow.
value_text is a template for aria-valuetext — {value} is replaced with
the current value (server-side on render, client-side as the hook moves the
thumb). Give the slider a label; without one the accessible name falls
back to the input name.
Summary
Functions
Attributes
id(:any) - Element id. Derived fromfieldwhen omitted; with a barenameit falls back toname(the id feeds the hook, so it must stay stable — never auto-generated).Defaults to
nil.name(:string) - Form input name; derived from field when omitted. Defaults tonil.value(:any) - Current value; clamped to min..max, defaults to min. Defaults tonil.field(Phoenix.HTML.FormField) - Form field; derives id, name, value, and errors. Defaults tonil.min(:any) - Minimum value. Defaults to0.max(:any) - Maximum value. Defaults to100.step(:any) - Step increment; PageUp/PageDown jump 10 steps. Defaults to1.value_text(:string) - Template foraria-valuetext;{value}interpolates, e.g. "{value}%". Defaults tonil.label(:string) - Primary label above the control. Defaults tonil.sublabel(:string) - Secondary label line under the primary label. Defaults tonil.description(:string) - Helper text under the label stack. Defaults tonil.errors(:list) - Validation messages; derived from field when used. Defaults to[].size(:string) - Field density / type scale. Defaults to"md". Must be one of"xs","sm","md","lg", or"xl".disabled(:boolean) - Render disabled and non-interactive. Defaults tofalse.class(:any) - Extra classes merged onto the root element. Defaults tonil.Global attributes are accepted. Arbitrary HTML/
phx-*attributes passed through (ride on the hidden input). Supports all globals plus:["form", "phx-change", "phx-target"].