Wheel Picker
iOS-style scroll wheels to pick a time, a height, a weight or any value from a short list, by swipe, scroll, click or keys.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
columns | WheelColumn[] | [] | The wheels. As an attribute, a JSON array of { options, label?, suffix? }. |
options | (string | WheelOption)[] | [] | Shorthand for a single wheel's options: a JSON array, or a ;-separated list. |
value | string[] | [] | One value per wheel. As an attribute, a ;-separated list. Not reflected: the attribute stays as the author wrote it. |
name | string | — | Form field name: the form receives the values joined by ;. |
disabled | boolean | false | Turns the wheels off; as for a disabled form control, the value is not submitted. |
label | string | — | The accessible name of the picker. Inside a c2-form-field, the field's label names it. |
Events
| Name | Type | Description |
|---|---|---|
input | Event | Fired when the user turns a wheel to another row, before change. Read value. |
change | CustomEvent<{ value: string[] }> | Fired after the user turns a wheel to another row. Not fired for programmatic changes. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
wheels | The row of wheels, with the band across it. |
wheel | One wheel. |
row | One row of a wheel. |
suffix | The fixed text after a wheel. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-wheel-picker--visible-rows | number | 5 | How many rows show; an odd number keeps the band in the middle. |
--c2-wheel-picker--font-size | font-size | 20px | |
--c2-wheel-picker--color | color | #18181b | |
--c2-wheel-picker--gap | pixel | 8px | Space between the wheels. |
--c2-wheel-picker__row--height | pixel | 36px | |
--c2-wheel-picker__row--color | color | #a1a1aa | Rows outside the band. |
--c2-wheel-picker__row__selected--font-weight | font-weight | 500 | The row in the band. |
--c2-wheel-picker__row__disabled--opacity | opacity | 0.3 | |
--c2-wheel-picker__band--background | color | #f4f4f5 | |
--c2-wheel-picker__band--border-radius | border-radius | 8px | |
--c2-wheel-picker__wheel--min-width | pixel | 56px | |
--c2-wheel-picker__suffix--color | color | #18181b | |
--c2-wheel-picker__suffix--font-size | font-size | 16px | |
--c2-wheel-picker__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-wheel-picker__error--border | border | 1px solid #dc2626 | Around the band while an enclosing c2-form-field shows an error. |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under wheel-picker, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
label | Choose a value | — |
wheel | Wheel {0} of {1} | {0} index {1} count |