Actions
Layout
Dial
A wheel you turn to change a number, with no end stops unless you set min or max. Use it for open-ended values and fine adjustments.
Install
import { Dial } from 'vael-ui'Playground
0
md
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { Dial } from 'vael-ui'
const value = ref(0)
</script>
<template>
<Dial aria-label="Value" v-model="value" />
</template>Motion New
Dial: its appearance, states and the fill's timing.
<Dial
:motion="{ states: { disabled: { root: { scale: 1.04 } } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | roottrackfillfaceticks | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
states | disabledfocusactive | Sets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
Follows the Slider pattern from the WAI-ARIA Authoring Practices Guide.
| Key | Action |
|---|---|
| ArrowRightArrowUp | Increases the value by one step. |
| ArrowLeftArrowDown | Decreases the value by one step. |
| PageUpPageDown | Changes the value by ten steps. |
| HomeEnd | Sets the value to min or max, when they are set. |
- Renders
role="slider"witharia-valuenow, plusaria-valueminandaria-valuemaxwhenminandmaxare set. - Without
minandmax,aria-valuetextreads the value, so screen readers don’t assume 0 to 100.valueTextreplaces it. - It needs a name: wrap it in a Field, or pass
aria-labeloraria-labelledby. They land on the focusable dial. - Disabled, it sets
aria-disabledand leaves the Tab order. Invalid, it setsaria-invalid.