Angle Slider
A round knob to pick a direction on a full circle, or a value along an arc like a thermostat or volume dial, by drag or keys.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
mode | AngleSliderMode | angle | angle for a direction on a full circle, arc for a value along an open arc. |
value | number | 0 | The current value, kept between min and max and snapped to step. In angle mode max comes round to min. |
min | number | 0 | The value at the top of the dial (angle mode) or at the start of the arc (arc mode). |
max | number | 360 | The value a full turn reaches (angle mode), or at the end of the arc (arc mode). |
step | number | 1 | Increment between values. |
name | string | — | Form field name: the form receives the value. |
disabled | boolean | false | Turns the slider off; as for a disabled form control, the value is not submitted. |
label | string | — | The accessible name of the slider. Inside a c2-form-field, the field's label names it. |
Slots
| Name | Description |
|---|---|
(default) | Replaces the value shown in the middle of the dial (an icon, a value with its own markup). Decorative: the handle still reads the value. |
Events
| Name | Type | Description |
|---|---|---|
input | Event | Fired while the user changes the value, at every step of a drag or a key press. Read value. |
change | Event | Fired when the user commits a value: the pointer is released, or a key changed it. 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 |
|---|---|
dial | The round control: the ring, the needle, the handle and the value. |
track | The ring the handle runs along. |
fill | In arc mode, the part of the ring from the start of the arc to the handle. |
needle | In angle mode, the line from the centre to the handle. |
thumb | The handle, which is the focusable slider. |
value | The value shown in the middle. |
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-angle-slider--size | pixel | 160px | Width and height of the dial. |
--c2-angle-slider__arc--sweep | number | 270 | How far the arc of arc mode reaches, in degrees (up to 360), centred on the top. |
--c2-angle-slider__track--width | pixel | 8px | Thickness of the ring. |
--c2-angle-slider__track--color | color | #e4e4e7 | |
--c2-angle-slider__track__error--color | color | #dc2626 | The ring while an enclosing c2-form-field shows an error. |
--c2-angle-slider__fill--color | color | rgb(2, 101, 220) | The filled part of the arc in arc mode. |
--c2-angle-slider__needle--width | pixel | 2px | Thickness of the line from the centre to the handle in angle mode. |
--c2-angle-slider__needle--color | color | rgb(2, 101, 220) | |
--c2-angle-slider__thumb--size | pixel | 20px | |
--c2-angle-slider__thumb--color | color | #ffffff | |
--c2-angle-slider__thumb--border | border | 2px solid rgb(2, 101, 220) | |
--c2-angle-slider__thumb--box-shadow | box-shadow | 0 1px 3px rgba(0, 0, 0, 0.15) | |
--c2-angle-slider__thumb__active--box-shadow | box-shadow | 0 0 0 8px rgba(2, 101, 220, 0.18) | Halo while dragging. |
--c2-angle-slider__thumb__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-angle-slider__thumb__focus--outline-offset | pixel | 2px | |
--c2-angle-slider__value--display | display | block | none hides the value in the middle. |
--c2-angle-slider__value--color | color | #18181b | |
--c2-angle-slider__value--font-size | font-size | 24px | |
--c2-angle-slider__value--font-weight | font-weight | 600 | |
--c2-angle-slider__disabled--opacity | opacity | 0.38 | |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under angle-slider, 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 |
|---|---|---|
angle | Angle | — |
value | Value | — |
degrees | {0} degrees | {0} angle |