Angle Slider
A component for selecting a value within a circular range.
Examples
Basic
Here's a basic example of the Angle Slider component.
Example not foundExample not foundExample not foundExample not foundControlled
Use the value and onValueChange props to control the value of the Angle Slider.
Example not foundExample not foundExample not foundExample not foundSteps
Use the step prop to set the discrete steps of the Angle Slider.
Example not foundExample not foundExample not foundExample not foundAPI Reference
Props
Root
| Prop | Default | Type |
|---|---|---|
aria-label | stringThe accessible label for the slider thumb. | |
aria-labelledby | stringThe id of the element that labels the slider thumb. | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
defaultValue | 0 | numberThe initial value of the slider. Use when you don't need to control the value of the slider. |
disabled | booleanWhether the slider is disabled. | |
id | stringThe unique identifier of the machine. | |
ids | Partial<{
root: string
thumb: string
hiddenInput: string
control: string
valueText: string
label: string
}>The ids of the elements in the machine. Useful for composition. | |
invalid | booleanWhether the slider is invalid. | |
name | stringThe name of the slider. Useful for form submission. | |
onValueChange | (details: ValueChangeDetails) => voidThe callback function for when the value changes. | |
onValueChangeEnd | (details: ValueChangeDetails) => voidThe callback function for when the value changes ends. | |
readOnly | booleanWhether the slider is read-only. | |
step | 1 | numberThe step value for the slider. |
value | numberThe value of the slider. |
| CSS Variable | Description |
|---|---|
--value | The current value |
--angle | The angle in degrees |
| Data Attribute | Value |
|---|---|
[data-scope] | angle-slider |
[data-part] | root |
[data-disabled] | Present when disabled |
[data-invalid] | Present when invalid |
[data-readonly] | Present when read-only |
Control
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
| Data Attribute | Value |
|---|---|
[data-scope] | angle-slider |
[data-part] | control |
[data-disabled] | Present when disabled |
[data-invalid] | Present when invalid |
[data-readonly] | Present when read-only |
HiddenInput
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
Label
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
| Data Attribute | Value |
|---|---|
[data-scope] | angle-slider |
[data-part] | label |
[data-disabled] | Present when disabled |
[data-invalid] | Present when invalid |
[data-readonly] | Present when read-only |
MarkerGroup
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
Marker
| Prop | Default | Type |
|---|---|---|
value | numberThe value of the marker | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
| CSS Variable | Description |
|---|---|
--marker-value | The marker value value for the Marker |
| Data Attribute | Value |
|---|---|
[data-scope] | angle-slider |
[data-part] | marker |
[data-value] | The value of the item |
[data-state] | |
[data-disabled] | Present when disabled |
RootProvider
| Prop | Default | Type |
|---|---|---|
value | UseAngleSliderReturn | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
Thumb
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
| Data Attribute | Value |
|---|---|
[data-scope] | angle-slider |
[data-part] | thumb |
[data-disabled] | Present when disabled |
[data-invalid] | Present when invalid |
[data-readonly] | Present when read-only |
ValueText
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
Context
These are the properties available when using AngleSlider.Context, useAngleSliderContext hook or useAngleSlider
hook.
API
| Property | Type |
|---|---|
value | numberThe current value of the angle slider |
valueAsDegree | stringThe current value as a degree string |
setValue | (value: number) => voidSets the value of the angle slider |
dragging | booleanWhether the slider is being dragged. |