Picking one of several, some of several, a number on a track, or on and off: select, native select, radio, slider, switch, toggle and toggle group.
Select
One of a list, in a list of its own. A press, Enter or Space opens it; the arrow keys move, Home and End go to the ends, a letter jumps, Enter picks, Escape closes.
One lineoptions is a list of words; items gives values names of their own. placeholder shows while the value is empty.
options
itemsvalues with names
size sm
placeholder
disabled
invaliduntil one is picked
fruit "Pear" · city "lis" · small "Plum" · placeholder ""
Rows written outUnder a Select: groups with labels, a separator, a row that is disabled. of is the Select's value; last=true on the last row is what End goes to.
nothing picked
Open it and type b: the keyboard goes to Banana. Grapes cannot be picked, and the arrow keys step over it.
From its partsSelectTrigger is the button, SelectValue the words in it, SelectContent the list under it. Select is these three in one.
fruit "banana"
MoteList and MoteRowWhat Select's list is made of, for a list of your own: a MoteList under what opens it, a MoteRow for each row. keep=true leaves the list open after a press.
name, ascending
Last press
nothing yet
Native Select
The browser's own select, dressed as the rest. On a phone it opens the system's picker.
Native SelectNativeSelectOption for each choice; NativeSelectOptGroup is a line that cannot be picked, followed by its options. change is called with the value.
defaultwith change=
size smwith groups
invalidwhile no status is set
disabled
status "todo" · zone "est" · change last gave ""
Radio
One of several. The arrow keys move among a group's items and pick, as the browser does for radio buttons.
One lineRadio with options: each word is a row.
plan "pro"
Radio GroupRadioGroupItem is the circle alone; its words are a Label beside it.
density "comfortable"
Horizontal, invalid, disabledorientation lays the group out; an item takes invalid; the group takes disabled.
shipping "standard"
Slider
A value, or a range, on a track. A press or a drag moves the nearer thumb; the arrow keys, Home, End, PageUp and PageDown move the one the keyboard is on.
Value, min, max, stepvalue is a number. change is called when a change by keyboard is done.
0 to 10033
step=1040
min=0 max=1 step=0.1, with change=0.5 · settled 0 times
disabled40
33%
The first slider fills the bars; the third sets how strong they are drawn.
Two thumbsvalues is two numbers: a range. The thumbs do not cross. Here the range filters a list by price.
values, step=525 to 75
from $62.5to $187.5
Notebook $12
Pen $4
Lamp $38
Chair $85
Desk $240
Monitor $180
Cable $9
Headphones $65
3 of 8 in range
Verticalorientation=vertical: it fills the height it is given. A range works the same way.
Bass
Mid
High
Band
°C
60Bass
45Mid
70High
20–80Band
21°min 10, max 30
bass 60 · mid 45 · high 70 · band 20 to 80 · 21°
Switch and Toggle
On or off. A Switch is a setting that takes effect at once; a Toggle is a button that stays down.
Switchon is written back. size: sm or default. A Label with for= presses it too.
airplane off · wifi on · bluetooth on · small on
Airplane mode disables the two under it.
Togglevariant: default or outline. size: sm, default, lg. It holds an icon, words, or both.
default
outline
sm, default, lg
disabled
The quick brown fox
bold off · italic on · underline off · star off
Toggle Group
Toggles that go together. type=single holds the one that is on, or nothing; type=multiple holds a list. variant and size are said on the group and on each item.
Severaltype=multiple: of is a list, and each press adds to it or takes from it.
Sphinx of black quartz, judge my vow
marks: bold
Onetype=single: of is the value that is on. Pressing it again leaves none on.
A paragraph long enough to wrap onto a second line, so that the way it is aligned can be seen.
align: center
Spacing, sizes, vertical, disabledspacing 0 (as it comes) joins the items into one; more sets them apart. orientation=vertical stacks them. The group, or one item, takes disabled.