Leave Yamada UI a star

Star
Yamada UIYamada UIv1.6.4

Slider

Slider is a component used for allowing users to select a value from a range.

Source@yamada-ui/slider

The Slider follows the WAI-ARIA - Slider Pattern for accessibility.

If you are not using Fieldset, set aria-label or aria-labelledby to Slider.

<Slider aria-label="Sound volume" />
Copied!
<VStack gap="sm">
<Text as="h3" id="label">
Sound volume
</Text>
<Slider aria-labelledby="label" />
</VStack>
Copied!

For example, if the day of the week is represented by a number and the value of aria-valuenow is not user-friendly, set aria-valuetext to a human-readable string such as "Monday".

const weekday = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
]
return <Slider getAriaValueText={(value) => weekday[value]} max={6} min={0} />
Copied!

Keyboard Navigation

KeyDescriptionState
ArrowRightIncreases the value based on the step value.-
ArrowLeftDecreases the value based on the step value.-
ArrowUpIncreases the value based on the step value.-
ArrowDownDecreases the value based on the step value.-
HomeSets the value to min.-
EndSets the value to max.-
PageUpIncreases the value based on the min and max values.-
PageDownDecreases the value based on the min and max values.-

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
SliderThumbrole="slider"Indicates that this is a slider.
aria-labelSets "Slider thumb".
aria-orientationSets "horizontal" or "vertical" based on the orientation value. Default is "horizontal".
aria-valueminSets the min value. Default is 0.
aria-valuemaxSets the max value. Default is 100.
aria-valuenowSets the current value.
aria-valuetextSets the current value.
aria-readonlySet to "true" if isReadOnly is set.
aria-disabledSet to "true" if isDisabled is set.
aria-invalidSet to "true" if isInvalid is set.
aria-requiredSet to "true" if isRequired is set.
SliderMarkaria-hiddenExcludes the element from the accessibility tree.
input Internaltype="hidden"Excludes the element from the accessibility tree.
aria-readonlySet to "true" if isReadOnly is set.
aria-disabledSet to "true" if isDisabled is set.
aria-invalidSet to "true" if isInvalid is set.
aria-requiredSet to "true" if isRequired is set.

Edit this page on GitHub

PreviousDropzoneNextRangeSlider