<t-choice>

A word the reader clicks to cycle through a list of options. With two options, it's a toggle. For a long list, use a <t-select>, which opens a menu the reader can search.

Saving per month adds up to a year.

Attributes

AttributeDefaultDescription
namerequiredThe variable that holds the selected option's value.
optionsrequiredA comma-separated list. Each option is label or label:value.
valuetext contentThe starting option, matched against values first and then labels. Defaults to the first option.
coloraccent colorOne CSS color, or two for light and dark mode.
labelthe nameThe accessible name.

Labels and values

The label is what the reader sees. The value is what expressions get. Values that look like numbers become numbers, so per week:52 gives the variable the number 52, and true and false become booleans. Without a :value, the label is the value, and expressions compare against the text:

The trail is 10 km long, which is .

Toggles

A two-option choice with 0 and 1 as values works as a switch. Options named true and false become real booleans, so options="true, false" works too:

Shipping is with standard delivery, arriving in .

Interaction

InputEffect
ClickThe next option, wrapping around at the end.
Shift + clickThe previous option.
Enter, Space or →The next option.
←The previous option.

Labels can't contain commas or colons, since those separate the options.