Range slider: a rounded track with a round thumb, one value or a range of two.
<.range name="volume" value={50} color="primary" />
<.range field={@form[:level]} label="Level" min={0} max={10} size="lg" show_value />
<.range name="discount" label="Desconto" value={12} max={30} show_value value_format="%{value}%" />
<.range start_name="from" end_name="to" value={{40, 280}} min={0} max={500} />
<.range name="weight" orientation="vertical" value={40} />The slider is the design's lu-sl (.tr track, .fl fill, .th thumbs). The
LedgerUI.Range hook (priv/static/ledger_ui/hooks/range.js) drags the thumbs, takes the
arrow keys, Home, End and Page Up/Down (it adds role="slider" and the ARIA values to the
thumbs), keeps the value text, the fill and the marks in step, and writes the value to hidden
inputs named like the field, firing a bubbling input event so phx-change runs.
Deviations from the README: color has no default (no c-* class, the neutral look) and
filled defaults to true (filled={false} is the design's "sem filled"); the value is not a
native <input type="range"> but hidden inputs.
Summary
Functions
Renders a range slider.
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any)field(Phoenix.HTML.FormField) - Defaults tonil.min(:any) - Defaults to0.max(:any) - Defaults to100.step(:any) - Defaults to1.color(:string) - Defaults tonil.Must be one ofnil,"neutral","primary","secondary","info","success","warning", or"error".size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".fill(:string) - Defaults tonil.variant(:string) - Defaults to"canvas". Must be one of"canvas", or"classic".start_field(Phoenix.HTML.FormField) - Defaults tonil.end_field(Phoenix.HTML.FormField) - Defaults tonil.start_name(:string) - Defaults tonil.end_name(:string) - Defaults tonil.orientation(:string) - Defaults to"horizontal". Must be one of"horizontal", or"vertical".height(:string) - Defaults to"8rem".filled(:boolean) - Defaults totrue.show_value(:boolean) - Defaults tofalse.value_format(:string) - Defaults to"%{value}".marks(:list) - Defaults to[].steppers(:boolean) - Defaults tofalse.decrease_label(:string) - Defaults to"Decrease".increase_label(:string) - Defaults to"Increase".label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.wrapper_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Same as range/1 (same attributes and slots), under the name the design vitrine uses.
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any)field(Phoenix.HTML.FormField) - Defaults tonil.min(:any) - Defaults to0.max(:any) - Defaults to100.step(:any) - Defaults to1.color(:string) - Defaults tonil.Must be one ofnil,"neutral","primary","secondary","info","success","warning", or"error".size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".fill(:string) - Defaults tonil.variant(:string) - Defaults to"canvas". Must be one of"canvas", or"classic".start_field(Phoenix.HTML.FormField) - Defaults tonil.end_field(Phoenix.HTML.FormField) - Defaults tonil.start_name(:string) - Defaults tonil.end_name(:string) - Defaults tonil.orientation(:string) - Defaults to"horizontal". Must be one of"horizontal", or"vertical".height(:string) - Defaults to"8rem".filled(:boolean) - Defaults totrue.show_value(:boolean) - Defaults tofalse.value_format(:string) - Defaults to"%{value}".marks(:list) - Defaults to[].steppers(:boolean) - Defaults tofalse.decrease_label(:string) - Defaults to"Decrease".increase_label(:string) - Defaults to"Increase".label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.wrapper_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.