Navigation

v2.1.0
Forms

Dial

A value set by turning a thumb around a circle: a level set like a knob, an angle or a direction.

On this page

A dial sets a value by turning a thumb around a circle: a level set like a knob, an angle, a direction. It is the input sibling of the gauge: a round track in the fill's own ink, stepped back, fills with ink from where it starts to the value, and the slider's pearl thumb stands on it at the value's angle. The figure sits in the middle in tabular figures. There is no native element for it, so the dial is an element with role="slider", and the dial behavior turns it.

Dial

<div class="dial" role="slider" tabindex="0" aria-label="Volume" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 40">  <span class="dial-value">40%</span>  <span class="dial-thumb"></span></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="dial" role="slider" tabIndex={0} aria-label="Volume" aria-valuenow={40} aria-valuemin={0} aria-valuemax={100} style={{ '--dial-value': '40' } as React.CSSProperties}>      <span className="dial-value">40%</span>      <span className="dial-thumb"></span>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><div class="dial" role="slider" tabindex="0" aria-label="Volume" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 40" {@attach attach}>  <span class="dial-value">40%</span>  <span class="dial-thumb"></span></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="dial" role="slider" tabindex="0" aria-label="Volume" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 40">    <span class="dial-value">40%</span>    <span class="dial-thumb"></span>  </div></template>
Drag the thumb round, press anywhere on the track, or focus the dial and use the arrow keys, Page Up, Page Down, Home and End.

By default the dial is a knob: 270 degrees, open at the foot, from its least value at the lower left to its greatest at the lower right. A press on the track moves the value there; a press on the thumb takes hold of it where it is, so it turns without a jump. A drag that goes past an end stays at that end, through the gap at the foot, until the pointer comes back.

#An angle

dial-full is the whole circle, starting at the top: an angle or a direction, from aria-valuemin 0 to aria-valuemax 360. Past its greatest value it comes round to the least again, from the keys and from a drag through the top, and 360 is written as 0, the same place. End stops a step before it.

An angle

<div class="dial dial-full" role="slider" tabindex="0" aria-label="Gradient angle" aria-valuenow="135" aria-valuemin="0" aria-valuemax="360" aria-valuetext="135°" style="--dial-value: 135; --dial-max: 360">  <span class="dial-value">135°</span>  <span class="dial-thumb"></span></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="dial dial-full" role="slider" tabIndex={0} aria-label="Gradient angle" aria-valuenow={135} aria-valuemin={0} aria-valuemax={360} aria-valuetext="135°" style={{ '--dial-value': '135', '--dial-max': '360' } as React.CSSProperties}>      <span className="dial-value">135°</span>      <span className="dial-thumb"></span>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><div class="dial dial-full" role="slider" tabindex="0" aria-label="Gradient angle" aria-valuenow="135" aria-valuemin="0" aria-valuemax="360" aria-valuetext="135°" style="--dial-value: 135; --dial-max: 360" {@attach attach}>  <span class="dial-value">135°</span>  <span class="dial-thumb"></span></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="dial dial-full" role="slider" tabindex="0" aria-label="Gradient angle" aria-valuenow="135" aria-valuemin="0" aria-valuemax="360" aria-valuetext="135°" style="--dial-value: 135; --dial-max: 360">    <span class="dial-value">135°</span>    <span class="dial-thumb"></span>  </div></template>
Turn it past the top, or press the up arrow at 359.

The label and aria-valuetext keep the words they were written with around the number, so "135°" becomes "136°" with no script of the page's. For words of another kind, pass the behavior a text function, as the behavior shows.

#Ticks and marks

A dial-ticks element draws --dial-ticks equal steps across the sweep as fine lines just outside the thumb's path: a knob shows one more tick than steps, one at each end, and the full circle as many as steps. A dial-mark is a short word or figure in the rim, placed by the stylesheet at the value its --dial-at stands for. Both take a rim inside the dial's box, so the track grows smaller around them; give a dial with marks the large size.

Ticks and marks

<div class="dial dial-lg" role="slider" tabindex="0" aria-label="Volume" aria-valuenow="6" aria-valuemin="0" aria-valuemax="10" style="--dial-value: 6; --dial-max: 10">  <span class="dial-ticks" style="--dial-ticks: 10"></span>  <span class="dial-mark" style="--dial-at: 0">0</span>  <span class="dial-mark" style="--dial-at: 5">5</span>  <span class="dial-mark" style="--dial-at: 10">10</span>  <span class="dial-value">6</span>  <span class="dial-thumb"></span></div><div class="dial dial-lg dial-full" role="slider" tabindex="0" aria-label="Wind direction" aria-valuenow="225" aria-valuemin="0" aria-valuemax="360" aria-valuetext="225°" style="--dial-value: 225; --dial-max: 360">  <span class="dial-ticks" style="--dial-ticks: 12"></span>  <span class="dial-mark" style="--dial-at: 0">N</span>  <span class="dial-mark" style="--dial-at: 90">E</span>  <span class="dial-mark" style="--dial-at: 180">S</span>  <span class="dial-mark" style="--dial-at: 270">W</span>  <span class="dial-value">225°</span>  <span class="dial-thumb"></span></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root}>      <div className="dial dial-lg" role="slider" tabIndex={0} aria-label="Volume" aria-valuenow={6} aria-valuemin={0} aria-valuemax={10} style={{ '--dial-value': '6', '--dial-max': '10' } as React.CSSProperties}>        <span className="dial-ticks" style={{ '--dial-ticks': '10' } as React.CSSProperties}></span>        <span className="dial-mark" style={{ '--dial-at': '0' } as React.CSSProperties}>0</span>        <span className="dial-mark" style={{ '--dial-at': '5' } as React.CSSProperties}>5</span>        <span className="dial-mark" style={{ '--dial-at': '10' } as React.CSSProperties}>10</span>        <span className="dial-value">6</span>        <span className="dial-thumb"></span>      </div>      <div className="dial dial-lg dial-full" role="slider" tabIndex={0} aria-label="Wind direction" aria-valuenow={225} aria-valuemin={0} aria-valuemax={360} aria-valuetext="225°" style={{ '--dial-value': '225', '--dial-max': '360' } as React.CSSProperties}>        <span className="dial-ticks" style={{ '--dial-ticks': '12' } as React.CSSProperties}></span>        <span className="dial-mark" style={{ '--dial-at': '0' } as React.CSSProperties}>N</span>        <span className="dial-mark" style={{ '--dial-at': '90' } as React.CSSProperties}>E</span>        <span className="dial-mark" style={{ '--dial-at': '180' } as React.CSSProperties}>S</span>        <span className="dial-mark" style={{ '--dial-at': '270' } as React.CSSProperties}>W</span>        <span className="dial-value">225°</span>        <span className="dial-thumb"></span>      </div>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><div {@attach attach}>  <div class="dial dial-lg" role="slider" tabindex="0" aria-label="Volume" aria-valuenow="6" aria-valuemin="0" aria-valuemax="10" style="--dial-value: 6; --dial-max: 10">    <span class="dial-ticks" style="--dial-ticks: 10"></span>    <span class="dial-mark" style="--dial-at: 0">0</span>    <span class="dial-mark" style="--dial-at: 5">5</span>    <span class="dial-mark" style="--dial-at: 10">10</span>    <span class="dial-value">6</span>    <span class="dial-thumb"></span>  </div>  <div class="dial dial-lg dial-full" role="slider" tabindex="0" aria-label="Wind direction" aria-valuenow="225" aria-valuemin="0" aria-valuemax="360" aria-valuetext="225°" style="--dial-value: 225; --dial-max: 360">    <span class="dial-ticks" style="--dial-ticks: 12"></span>    <span class="dial-mark" style="--dial-at: 0">N</span>    <span class="dial-mark" style="--dial-at: 90">E</span>    <span class="dial-mark" style="--dial-at: 180">S</span>    <span class="dial-mark" style="--dial-at: 270">W</span>    <span class="dial-value">225°</span>    <span class="dial-thumb"></span>  </div></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root">    <div class="dial dial-lg" role="slider" tabindex="0" aria-label="Volume" aria-valuenow="6" aria-valuemin="0" aria-valuemax="10" style="--dial-value: 6; --dial-max: 10">      <span class="dial-ticks" style="--dial-ticks: 10"></span>      <span class="dial-mark" style="--dial-at: 0">0</span>      <span class="dial-mark" style="--dial-at: 5">5</span>      <span class="dial-mark" style="--dial-at: 10">10</span>      <span class="dial-value">6</span>      <span class="dial-thumb"></span>    </div>    <div class="dial dial-lg dial-full" role="slider" tabindex="0" aria-label="Wind direction" aria-valuenow="225" aria-valuemin="0" aria-valuemax="360" aria-valuetext="225°" style="--dial-value: 225; --dial-max: 360">      <span class="dial-ticks" style="--dial-ticks: 12"></span>      <span class="dial-mark" style="--dial-at: 0">N</span>      <span class="dial-mark" style="--dial-at: 90">E</span>      <span class="dial-mark" style="--dial-at: 180">S</span>      <span class="dial-mark" style="--dial-at: 270">W</span>      <span class="dial-value">225°</span>      <span class="dial-thumb"></span>    </div>  </div></template>

Ticks and marks are drawings: inside a role="slider" they are not announced, so the value and its words must say everything a mark says.

#Sizes

A dial is 120px across. dial-sm is 88px, for a row of controls, and dial-lg is 160px, for the one value a panel is about or a dial with marks. The track is a twentieth of the width and the figure scales with the track; the thumb keeps the slider's 18px at every pointer.

Sizes

<div class="dial dial-sm" role="slider" tabindex="0" aria-label="Treble" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 30">  <span class="dial-value">30</span>  <span class="dial-thumb"></span></div><div class="dial" role="slider" tabindex="0" aria-label="Mid" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 55">  <span class="dial-value">55</span>  <span class="dial-thumb"></span></div><div class="dial dial-lg" role="slider" tabindex="0" aria-label="Bass" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 70">  <span class="dial-value">70</span>  <span class="dial-thumb"></span></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root}>      <div className="dial dial-sm" role="slider" tabIndex={0} aria-label="Treble" aria-valuenow={30} aria-valuemin={0} aria-valuemax={100} style={{ '--dial-value': '30' } as React.CSSProperties}>        <span className="dial-value">30</span>        <span className="dial-thumb"></span>      </div>      <div className="dial" role="slider" tabIndex={0} aria-label="Mid" aria-valuenow={55} aria-valuemin={0} aria-valuemax={100} style={{ '--dial-value': '55' } as React.CSSProperties}>        <span className="dial-value">55</span>        <span className="dial-thumb"></span>      </div>      <div className="dial dial-lg" role="slider" tabIndex={0} aria-label="Bass" aria-valuenow={70} aria-valuemin={0} aria-valuemax={100} style={{ '--dial-value': '70' } as React.CSSProperties}>        <span className="dial-value">70</span>        <span className="dial-thumb"></span>      </div>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><div {@attach attach}>  <div class="dial dial-sm" role="slider" tabindex="0" aria-label="Treble" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 30">    <span class="dial-value">30</span>    <span class="dial-thumb"></span>  </div>  <div class="dial" role="slider" tabindex="0" aria-label="Mid" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 55">    <span class="dial-value">55</span>    <span class="dial-thumb"></span>  </div>  <div class="dial dial-lg" role="slider" tabindex="0" aria-label="Bass" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 70">    <span class="dial-value">70</span>    <span class="dial-thumb"></span>  </div></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root">    <div class="dial dial-sm" role="slider" tabindex="0" aria-label="Treble" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 30">      <span class="dial-value">30</span>      <span class="dial-thumb"></span>    </div>    <div class="dial" role="slider" tabindex="0" aria-label="Mid" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 55">      <span class="dial-value">55</span>      <span class="dial-thumb"></span>    </div>    <div class="dial dial-lg" role="slider" tabindex="0" aria-label="Bass" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="--dial-value: 70">      <span class="dial-value">70</span>      <span class="dial-thumb"></span>    </div>  </div></template>

#In a form

A role="slider" is not a form control, so the dial carries a hidden input. The behavior writes the value into the first <input type="hidden"> inside the dial with every change, and a form submits it under the input's name. The dial's input and change events bubble to the form like a native control's. A form's reset does not reach a hidden input, so the dial stays where it was; set its value again from the page if a reset should move it.

In a form

<form class="flex flex-col items-center gap-sm">  <span class="text-sm fg-text-strong" id="heating-label">Heating</span>  <div class="dial" role="slider" tabindex="0" aria-labelledby="heating-label" aria-valuenow="21" aria-valuemin="16" aria-valuemax="30" style="--dial-value: 21; --dial-min: 16; --dial-max: 30">    <span class="dial-value">21°</span>    <span class="dial-thumb"></span>    <input type="hidden" name="temperature" value="21">  </div>  <span class="text-xs fg-text-muted">16° to 30°</span></form><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLFormElement>(null)  useEffect(() => attach(root.current!), [])  return (    <form ref={root} className="flex flex-col items-center gap-sm">      <span className="text-sm fg-text-strong" id="heating-label">Heating</span>      <div className="dial" role="slider" tabIndex={0} aria-labelledby="heating-label" aria-valuenow={21} aria-valuemin={16} aria-valuemax={30} style={{ '--dial-value': '21', '--dial-min': '16', '--dial-max': '30' } as React.CSSProperties}>        <span className="dial-value">21°</span>        <span className="dial-thumb"></span>        <input type="hidden" name="temperature" value="21" />      </div>      <span className="text-xs fg-text-muted">16° to 30°</span>    </form>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><form class="flex flex-col items-center gap-sm" {@attach attach}>  <span class="text-sm fg-text-strong" id="heating-label">Heating</span>  <div class="dial" role="slider" tabindex="0" aria-labelledby="heating-label" aria-valuenow="21" aria-valuemin="16" aria-valuemax="30" style="--dial-value: 21; --dial-min: 16; --dial-max: 30">    <span class="dial-value">21°</span>    <span class="dial-thumb"></span>    <input type="hidden" name="temperature" value="21">  </div>  <span class="text-xs fg-text-muted">16° to 30°</span></form>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <form ref="root" class="flex flex-col items-center gap-sm">    <span class="text-sm fg-text-strong" id="heating-label">Heating</span>    <div class="dial" role="slider" tabindex="0" aria-labelledby="heating-label" aria-valuenow="21" aria-valuemin="16" aria-valuemax="30" style="--dial-value: 21; --dial-min: 16; --dial-max: 30">      <span class="dial-value">21°</span>      <span class="dial-thumb"></span>      <input type="hidden" name="temperature" value="21">    </div>    <span class="text-xs fg-text-muted">16° to 30°</span>  </form></template>

A visible label is an element of its own, pointed at with aria-labelledby: a <label> names only form controls. Show the range in words beside the dial when it is not plain from the figure.

#Disabled

aria-disabled="true" fades the dial and leaves it out of every key, pointer and wheel. Take it out of the tab order with tabindex="-1", and put disabled on its hidden input too, so a form does not submit the value.

Disabled

<div class="dial" role="slider" tabindex="-1" aria-label="Volume" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" aria-disabled="true" style="--dial-value: 40">  <span class="dial-value">40%</span>  <span class="dial-thumb"></span>  <input type="hidden" name="volume" value="40" disabled></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="dial" role="slider" tabIndex={-1} aria-label="Volume" aria-valuenow={40} aria-valuemin={0} aria-valuemax={100} aria-disabled="true" style={{ '--dial-value': '40' } as React.CSSProperties}>      <span className="dial-value">40%</span>      <span className="dial-thumb"></span>      <input type="hidden" name="volume" value="40" disabled />    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'</script><div class="dial" role="slider" tabindex="-1" aria-label="Volume" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" aria-disabled="true" style="--dial-value: 40" {@attach attach}>  <span class="dial-value">40%</span>  <span class="dial-thumb"></span>  <input type="hidden" name="volume" value="40" disabled></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="dial" role="slider" tabindex="-1" aria-label="Volume" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" aria-disabled="true" style="--dial-value: 40">    <span class="dial-value">40%</span>    <span class="dial-thumb"></span>    <input type="hidden" name="volume" value="40" disabled>  </div></template>

#Which way it turns

Clockwise is more, in every writing direction. A dial turns like a clock or a knob on a device, and those are not mirrored from right to left, so the dial is not either, and its arrow keys do not turn around: → and ↑ always turn it up. At the top of the dial, where the eye starts, clockwise is the way to the right; that is the arrow that turns it there.

#The behavior

dial takes the root, the element with the dial class, and returns the function that detaches it. The function has a value, the number: set it to turn the dial from outside, which dispatches nothing.

app.js
import { dial } from '@master/ui/behaviors/dial.js'const root = document.querySelector('.dial')const turn = dial(root, { step: 15, text: (value) => `${value}°` })root.addEventListener('change', () => save(turn.value))
  • Each change writes the value to aria-valuenow and --dial-value on the root, to the text of dial-value, to aria-valuetext when there is one or text is given, and to the hidden input. As it attaches, it writes the first value the same way, and copies aria-valuemin and aria-valuemax to --dial-min and --dial-max for a browser that cannot read the attributes.
  • The value stays on a step from aria-valuemin, between it and aria-valuemax, 0 and 100 when they are left out; round a full circle it comes round instead.
  • Dragging. On pointerdown it captures the pointer and reads its angle around the middle of the dial, which it turns into a value with the same --dial-start and --dial-sweep the stylesheet draws with. A dial whose sweep is 360 degrees comes round, with or without dial-full. A press near the middle, on the figure, does not move the value.
  • The keys. The arrows turn by a step, Page Up and Page Down by a larger one, and Home and End go to the ends.
  • The wheel, when it is asked for, turns the dial a step for each notch, but only while Alt (Option) is held: scrolling a page past a dial never turns it.
  • Events. The root dispatches input each time the value changes, and change when a drag ends or a key or the wheel turned it. Both bubble.
  • Disabled. A dial with aria-disabled="true" takes no key, pointer or wheel.
OptionWhat it sets
stepHow far an arrow key turns the value, and what a drag rounds it to. 1 by default
pageHow far Page Up and Page Down turn it. A tenth of the range by default, on a step
textA function from the value to its words, written in dial-value and in aria-valuetext
wheeltrue lets a wheel turn the dial while Alt is held. false by default

attach() passes no options. A dial that needs them is attached by itself, after attach() has run: a second call on one root replaces the first, as this preview's script does. MasterUI is the bundle a preview loads; in a project, import dial as above.

Steps, words and the wheel

<div class="dial dial-full" id="hue" role="slider" tabindex="0" aria-label="Hue" aria-valuenow="210" aria-valuemin="0" aria-valuemax="360" style="--dial-value: 210; --dial-max: 360">  <span class="dial-ticks" style="--dial-ticks: 24"></span>  <span class="dial-value">210°</span>  <span class="dial-thumb"></span></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.dial(document.getElementById('hue'), {  step: 15,  wheel: true,  text: function (value) { return value + '°' }})})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach, dial } from '@master/ui/behaviors'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => {    const detach = [      attach(root.current!),      dial(document.getElementById('hue')!, {        step: 15,        wheel: true,        text: function (value) { return value + '°' }      }),    ]    return () => detach.forEach(stop => stop())  }, [])  return (    <div ref={root} className="dial dial-full" id="hue" role="slider" tabIndex={0} aria-label="Hue" aria-valuenow={210} aria-valuemin={0} aria-valuemax={360} style={{ '--dial-value': '210', '--dial-max': '360' } as React.CSSProperties}>      <span className="dial-ticks" style={{ '--dial-ticks': '24' } as React.CSSProperties}></span>      <span className="dial-value">210°</span>      <span className="dial-thumb"></span>    </div>  )}
<script>  import { attach, dial } from '@master/ui/behaviors'  function mounted(root) {    const detach = [      attach(root),      dial(document.getElementById('hue'), {        step: 15,        wheel: true,        text: function (value) { return value + '°' }      }),    ]    return () => detach.forEach(stop => stop())  }</script><div class="dial dial-full" id="hue" role="slider" tabindex="0" aria-label="Hue" aria-valuenow="210" aria-valuemin="0" aria-valuemax="360" style="--dial-value: 210; --dial-max: 360" {@attach mounted}>  <span class="dial-ticks" style="--dial-ticks: 24"></span>  <span class="dial-value">210°</span>  <span class="dial-thumb"></span></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach, dial } from '@master/ui/behaviors'const root = ref(null)let detach = []onMounted(() => {  detach = [    attach(root.value),    dial(document.getElementById('hue'), {      step: 15,      wheel: true,      text: function (value) { return value + '°' }    }),  ]})onUnmounted(() => detach.forEach(stop => stop()))</script><template>  <div ref="root" class="dial dial-full" id="hue" role="slider" tabindex="0" aria-label="Hue" aria-valuenow="210" aria-valuemin="0" aria-valuemax="360" style="--dial-value: 210; --dial-max: 360">    <span class="dial-ticks" style="--dial-ticks: 24"></span>    <span class="dial-value">210°</span>    <span class="dial-thumb"></span>  </div></template>
Each key and each notch is 15 degrees. Hold Alt (Option) and scroll over the dial to turn it.

Without the behavior a dial shows its first value, from its attributes where the browser supports typed attr() and from --dial-value elsewhere, and does not turn.

#Keyboard

KeysAction
ArrowUp, ArrowRightTurn the value up by a step, clockwise in every writing direction; around a full circle, past the greatest value it comes round to the least
ArrowDown, ArrowLeftTurn the value down by a step, anticlockwise; around a full circle, below the least it comes round to the greatest
PageUp, PageDownTurn the value up or down by a larger step, a tenth of the range unless the page sets another
Home, EndMove to aria-valuemin or aria-valuemax; around a full circle, End is the last step before the value comes round

#Accessibility

  • The root is a focusable role="slider" with an accessible name, from aria-label or aria-labelledby, and the value in aria-valuenow between aria-valuemin and aria-valuemax. A slider has no orientation that means anything round a circle, so leave aria-orientation out.
  • When the number needs a unit or words to be understood, write aria-valuetext: "135°", "21 degrees", "Loud". The behavior keeps it in step with the value.
  • Everything inside the slider, the figure, the ticks and the marks, is presentation to assistive technology. The keys do everything a drag does, and a single press on the track sets a value, so turning by dragging is never the only way.
  • Focus rings the thumb, as on a slider. On touch screens the whole dial takes the finger and turns instead of scrolling the page, so the thumb keeps its size.
  • With reduced motion the held thumb does not grow. In forced colors the fill takes the system highlight, the track and the ticks the system's grey, and the thumb the button text color.

#React, Svelte and Vue

The dial component attaches the behavior and passes the value in and out. It renders the ticks and the marks from data, and the hidden input when it is given a name. Copy it into the project with npx master-ui add dial; React, Svelte and Vue says how the components are built and used.

ui/dial.tsx
'use client'import { useRef, useState, type ComponentProps, type CSSProperties } from 'react'import { dial } from '@master/ui/behaviors/dial.js'import { useBehavior } from './use-behavior'/** A word or figure in the rim, at a value. Without a label it shows the value. */export interface DialMark {  value: number  label?: string}export interface DialProps extends Omit<ComponentProps<'div'>, 'defaultValue' | 'children' | 'onChange' | 'role' | 'ref'> {  /** The number. */  value?: number  defaultValue?: number  /** Called as the dial turns. */  onValueChange?: (value: number) => void  /** Called once a drag ends, or a key or the wheel turned it. */  onValueCommit?: (value: number) => void  /** The least and the greatest value: 0 and 100, or 0 and 360 round a full circle. */  min?: number  max?: number  /** How far an arrow key turns the value, and what a drag rounds it to. */  step?: number  /** How far PageUp and PageDown turn it; a tenth of the range by default. */  page?: number  /** The whole circle, for an angle that comes round again. */  full?: boolean  /** The name of the dial: what it sets. */  label: string  /** The words for a value, shown in the middle and given to assistive technology. */  text?: (value: number) => string  /** The name a form submits the value under. Without it there is no field. */  name?: string  /** How many equal steps to mark with ticks. */  ticks?: number  /** Words or figures in the rim, at their values. */  marks?: DialMark[]  /** Let a wheel turn the dial while Alt (Option) is held. */  wheel?: boolean  disabled?: boolean}/** A value set by turning a thumb around a circle. */export function Dial({ value, defaultValue, onValueChange, onValueCommit, min = 0, max, step = 1, page, full, label, text, name, ticks, marks, wheel = false, disabled, className, style, ...root }: DialProps) {  const greatest = max ?? (full ? 360 : 100)  const [first] = useState(value ?? defaultValue ?? min)  /** The value the dial holds: what `text` is written for, since a `text` given later is not for the first value. */  const held = useRef(first)  const ref = useBehavior(dial, { step, page, text, wheel }, {    value,    defaultValue,    onValueChange: (next: number) => { held.current = next; onValueChange?.(next) },    // The dial says change once a drag ends or a key or the wheel turned it, after the value has come out.    on: { change: (event) => { if (event.target === event.currentTarget) onValueCommit?.(Number((event.currentTarget as Element).getAttribute('aria-valuenow'))) } },  })  return (    <div className={['dial', full && 'dial-full', className].filter(Boolean).join(' ')} role="slider" tabIndex={disabled ? -1 : 0} aria-label={label} aria-valuenow={first} aria-valuemin={min} aria-valuemax={greatest} aria-valuetext={text?.(value ?? held.current)} aria-disabled={disabled || undefined} style={{ '--dial-value': first, '--dial-min': min, '--dial-max': greatest, ...style } as CSSProperties} ref={ref} {...root}>      {ticks !== undefined && <span className="dial-ticks" style={{ '--dial-ticks': ticks } as CSSProperties} />}      {marks?.map(mark => <span className="dial-mark" key={mark.value} style={{ '--dial-at': mark.value } as CSSProperties}>{mark.label ?? String(mark.value)}</span>)}      <span className="dial-value">{text ? text(value ?? held.current) : String(value ?? held.current)}</span>      <span className="dial-thumb" />      {/* React writes a field's value with every render, so it writes the value the dial holds. */}      {name !== undefined && <input type="hidden" name={name} value={value ?? held.current} disabled={disabled} />}    </div>  )}
ui/Dial.svelte
<script lang="ts" module>  import type { HTMLAttributes } from 'svelte/elements'  /** A word or figure in the rim, at a value. Without a label it shows the value. */  export interface DialMark {    value: number    label?: string  }  export interface DialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'> {    /** The number. Bind it, or leave it out: it starts at `min`. */    value?: number    /** Called as the dial turns. */    onValueChange?: (value: number) => void    /** Called once a drag ends, or a key or the wheel turned it. */    onValueCommit?: (value: number) => void    /** The least and the greatest value: 0 and 100, or 0 and 360 round a full circle. */    min?: number    max?: number    /** How far an arrow key turns the value, and what a drag rounds it to. */    step?: number    /** How far PageUp and PageDown turn it; a tenth of the range by default. */    page?: number    /** The whole circle, for an angle that comes round again. */    full?: boolean    /** The name of the dial: what it sets. */    label: string    /** The words for a value, shown in the middle and given to assistive technology. */    text?: (value: number) => string    /** The name a form submits the value under. Without it there is no field. */    name?: string    /** How many equal steps to mark with ticks. */    ticks?: number    /** Words or figures in the rim, at their values. */    marks?: DialMark[]    /** Let a wheel turn the dial while Alt (Option) is held. */    wheel?: boolean    disabled?: boolean  }</script><script lang="ts">  import { untrack } from 'svelte'  import { dial } from '@master/ui/behaviors/dial.js'  import { behavior } from './behavior.svelte.js'  let { value = $bindable(), onValueChange, onValueCommit, min = 0, max, step = 1, page, full, label, text, name, ticks, marks, wheel = false, disabled, class: className, ...root }: DialProps = $props()  const greatest = $derived(max ?? (full ? 360 : 100))  const first = untrack(() => value ?? min)  // Svelte writes a style again whenever its owner changes it, so it writes the value the behavior holds.  let held = $state(first)  // The behavior writes the words over the ones Svelte rendered, so words given another way are written by it:  // it attaches again, from the value it holds, each time `text` is another function.  let written = 0  const words = $derived.by(() => {    // Reading `text` is what makes this run again when it is another function.    void text    return ++written  })  const told = (root: HTMLElement, options?: { step?: number, page?: number, text?: (value: number) => string, wheel?: boolean, words?: number }) => dial(root, { step: options?.step, page: options?.page, text: options?.text, wheel: options?.wheel })  const attach = behavior(told, () => ({ step, page, text, wheel, words }), {    value: () => value,    change: (next) => { value = held = next; onValueChange?.(next) },    settled: (next) => { held = next },    // The dial says change once a drag ends or a key or the wheel turned it, after the value has come out.    on: { change: (event) => { if (event.target === event.currentTarget) onValueCommit?.(held) } },  })</script><!--  @component  A value set by turning a thumb around a circle.--><div class={['dial', full && 'dial-full', className]} role="slider" tabindex={disabled ? -1 : 0} aria-label={label} aria-valuenow={first} aria-valuemin={min} aria-valuemax={greatest} aria-valuetext={text?.(held)} aria-disabled={disabled || undefined} style:--dial-value={held} style:--dial-min={min} style:--dial-max={greatest} {@attach attach} {...root}>  {#if ticks !== undefined}<span class="dial-ticks" style:--dial-ticks={ticks}></span>{/if}  {#each marks ?? [] as mark (mark.value)}    <span class="dial-mark" style:--dial-at={mark.value}>{mark.label ?? String(mark.value)}</span>  {/each}  <span class="dial-value">{text ? text(held) : String(held)}</span>  <span class="dial-thumb"></span>  {#if name !== undefined}<input type="hidden" {name} value={first} {disabled} />{/if}</div>
ui/Dial.vue
<script lang="ts">/** A word or figure in the rim, at a value. Without a label it shows the value. */export interface DialMark {  value: number  label?: string}</script><script setup lang="ts">import { computed, useTemplateRef } from 'vue'import { dial } from '@master/ui/behaviors/dial.js'import { useBehavior } from './use-behavior'defineOptions({ inheritAttrs: false })const { min = 0, max, step = 1, page, full, text, wheel = false } = defineProps<{  /** The least and the greatest value: 0 and 100, or 0 and 360 round a full circle. */  min?: number  max?: number  /** How far an arrow key turns the value, and what a drag rounds it to. */  step?: number  /** How far PageUp and PageDown turn it; a tenth of the range by default. */  page?: number  /** The whole circle, for an angle that comes round again. */  full?: boolean  /** The name of the dial: what it sets. */  label: string  /** The words for a value, shown in the middle and given to assistive technology. */  text?: (value: number) => string  /** The name a form submits the value under. Without it there is no field. */  name?: string  /** How many equal steps to mark with ticks. */  ticks?: number  /** Words or figures in the rim, at their values. */  marks?: DialMark[]  /** Let a wheel turn the dial while Alt (Option) is held. */  wheel?: boolean  disabled?: boolean}>()/** The number: `v-model`. It changes as the dial turns. */const model = defineModel<number>()const emit = defineEmits<{  /** The number, once a drag ends, or a key or the wheel turned it. */  valueCommit: [value: number]}>()/* A value set by turning a thumb around a circle. */const greatest = computed(() => max ?? (full ? 360 : 100))const first = model.value ?? minconst root = useTemplateRef<HTMLDivElement>('root')const current = useBehavior(root, dial, () => ({ step, page, text, wheel }), model, {  // The dial says change once a drag ends or a key or the wheel turned it, after the model has heard it.  change: (event) => { if (event.target === root.value) emit('valueCommit', held()) },})// Vue writes a style again each time it renders, so it writes the value the behavior holds, not the first one.const held = () => current() ?? first</script><template>  <div class="dial" :class="{ 'dial-full': full }" role="slider" ref="root" :tabindex="disabled ? -1 : 0" :aria-label="label" :aria-valuenow="first" :aria-valuemin="min" :aria-valuemax="greatest" :aria-valuetext="text?.(held())" :aria-disabled="disabled || undefined" :style="{ '--dial-value': held(), '--dial-min': min, '--dial-max': greatest }" v-bind="$attrs">    <span v-if="ticks !== undefined" class="dial-ticks" :style="{ '--dial-ticks': ticks }" />    <span v-for="mark in marks" :key="mark.value" class="dial-mark" :style="{ '--dial-at': mark.value }">{{ mark.label ?? String(mark.value) }}</span>    <span class="dial-value">{{ text ? text(held()) : String(held()) }}</span>    <span class="dial-thumb" />    <!-- Vue writes a field's value with every render, so it too is the value the behavior holds. -->    <input v-if="name !== undefined" type="hidden" :name="name" :value="held()" :disabled="disabled">  </div></template>

#Classes

ClassDescription
dialThe dial, 120px across, on a focusable role="slider" with an accessible name, aria-valuenow, aria-valuemin and aria-valuemax: a round track filled with ink from its start to the value. By default a knob of 270 degrees, open at the foot
dial-fullThe whole circle, starting at the top: an angle, which comes round again past its greatest valueApply with dial
dial-smAn 88px dial; the default is 120pxApply with dial
dial-lgA 160px dial; the default is 120pxApply with dial
dial-thumbThe pearl thumb on the track at the value's angle, an empty element. Focus rings it, and a press on it turns the dial without a jump
dial-valueThe value as text, in tabular figures at the middle of the dial; the behavior writes it with every change
dial-ticksAn empty element that draws --dial-ticks equal steps as fine lines just outside the thumb's path
dial-markA short word or figure in the rim, at the value its --dial-at stands for

#Custom properties

PropertyDefaultDescription
--dial-valueThe value. It comes from aria-valuenow where typed attr() is supported; the behavior writes it too
--dial-min0The least value. It comes from aria-valuemin where typed attr() is supported
--dial-max100The greatest value. It comes from aria-valuemax where typed attr() is supported
--dial-start225degWhere the least value stands, clockwise from the top; 0deg on dial-full. The behavior reads it to turn a pointer into a value
--dial-sweep270degHow far the track runs from the start, clockwise; 360deg on dial-full, which makes the value come round. The behavior reads it too
--dial-size7.5remThe dial's diameter
--dial-trackcalc(var(--dial-size) / 20)Thickness of the track
--dial-thumb1.125remThumb diameter; the whole dial takes the pointer
--dial-colorvar(--color-surface-inverse)The ink of the fill; the track is the same color stepped back
--dial-ticks10How many equal steps the ticks mark across the sweepSet on dial-ticks
--dial-at0The value a mark stands atSet on dial-mark

#Source

@master/ui/components/dial.css
/* * Dial: a value set by turning a thumb around a circle, the input sibling of the gauge. * An element with role="slider" draws a round track in its fill's own ink, stepped back, fills it with ink from * where it starts to the value, and carries the slider's pearl thumb at the value's angle. The figure stands in * the middle in tabular figures. By default the dial is a knob: 270 degrees, open at the foot, from its least * value at the lower left to its greatest at the lower right. dial-full is the whole circle, from the top, for * an angle that comes round again. The script reads where it starts and how far it sweeps from this stylesheet. * Clockwise is more in every writing direction: a dial turns like a clock or a knob, so it is not mirrored. * Where the browser supports typed attr(), the dial reads aria-valuenow, aria-valuemin and aria-valuemax * itself; elsewhere it reads --dial-value, which the behavior writes with every change. The fill follows the * hand at once, with no easing: an input that lags behind the pointer feels broken. * A dial is 120px across (88 small, 160 large); its track is a twentieth of that, and its thumb is the slider's * 18px at every pointer: the whole dial takes the finger. Ticks and marks take a rim outside the thumb's path, so the dial keeps its size. */@property --dial-value {  syntax: '<number>';  inherits: true;  initial-value: 0;}@property --dial-start {  syntax: '<angle>';  inherits: true;  initial-value: 225deg;}@property --dial-sweep {  syntax: '<angle>';  inherits: true;  initial-value: 270deg;}@layer components.ui {  .dial {    --dial-size: 7.5rem;    --dial-track: calc(var(--dial-size) / 20);    --dial-thumb: 1.125rem;    --dial-color: var(--color-surface-inverse);    --dial-min: 0;    --dial-max: 100;    --dial-start: 225deg;    --dial-sweep: 270deg;    /* Room between the thumb's path and the edge, for ticks and marks; none without them. */    --dial-rim: 0rem;    /* How far along the track the value is, from nothing to all of it, and the angle that puts it at. */    --dial-share: clamp(0, calc((var(--dial-value) - var(--dial-min)) / (var(--dial-max) - var(--dial-min))), 1);    --dial-angle: calc(var(--dial-start) + var(--dial-share) * var(--dial-sweep));    /* The middle of the track, where the thumb's centre runs. */    --dial-radius: calc((var(--dial-size) - var(--dial-thumb)) / 2 - var(--dial-rim));    position: relative;    /* The thumb and the figure stand over the track within the dial, never over the page around it. */    isolation: isolate;    display: inline-grid;    flex: none;    place-items: center;    box-sizing: border-box;    width: var(--dial-size);    height: var(--dial-size);    margin: 0;    /* A circle takes the pointer, so the corners of its box do not. */    border-radius: 999px;    corner-shape: round;    color: var(--color-text-strong);    font: var(--font-weight-control) calc(var(--dial-radius) * .44)/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    letter-spacing: -.02em;    text-align: center;    vertical-align: middle;    cursor: pointer;    /* A finger that turns the dial does not scroll the page, and a drag selects no text. */    touch-action: none;    -webkit-user-select: none;    user-select: none;    -webkit-tap-highlight-color: transparent;    @supports (x: attr(x type(*))) {      &[aria-valuenow] {        --dial-value: attr(aria-valuenow type(<number>), 0);      }      &[aria-valuemin] {        --dial-min: attr(aria-valuemin type(<number>), 0);      }      &[aria-valuemax] {        --dial-max: attr(aria-valuemax type(<number>), 100);      }    }    &:focus-visible {      outline: none;    }    /* Both drawings cover the dial, cut down to the track's ring. */    &::before, &::after {      --dial-inner: calc(var(--dial-radius) - var(--dial-track) / 2);      --dial-outer: calc(var(--dial-radius) + var(--dial-track) / 2);      content: '';      position: absolute;      inset: 0;      border-radius: 999px;      corner-shape: round;      mask: radial-gradient(circle, transparent calc(var(--dial-inner) - .5px), black var(--dial-inner), black var(--dial-outer), transparent calc(var(--dial-outer) + .5px));      pointer-events: none;    }    /*     * The track: the whole sweep, with a dot at each end to round it. It is drawn in the fill's own color and     * stepped back as one layer, so the dots and the arc never add up. Around the full circle the dots meet.     */    &::before {      --dial-end: calc(var(--dial-start) + var(--dial-sweep));      background:        radial-gradient(circle at calc(50% + var(--dial-radius) * sin(var(--dial-start))) calc(50% - var(--dial-radius) * cos(var(--dial-start))), var(--dial-color) calc(var(--dial-track) / 2 - .5px), transparent calc(var(--dial-track) / 2)),        radial-gradient(circle at calc(50% + var(--dial-radius) * sin(var(--dial-end))) calc(50% - var(--dial-radius) * cos(var(--dial-end))), var(--dial-color) calc(var(--dial-track) / 2 - .5px), transparent calc(var(--dial-track) / 2)),        conic-gradient(from var(--dial-start), var(--dial-color) var(--dial-sweep), transparent 0);      opacity: .12;    }    /* The fill: the same track as far as the value. Its dots have no radius at nothing, so an empty dial is an empty track. */    &::after {      --dial-cap: calc(var(--dial-track) / 2 * min(1, var(--dial-share) * 200));      background:        radial-gradient(circle at calc(50% + var(--dial-radius) * sin(var(--dial-start))) calc(50% - var(--dial-radius) * cos(var(--dial-start))), var(--dial-color) calc(var(--dial-cap) - .5px), transparent var(--dial-cap)),        radial-gradient(circle at calc(50% + var(--dial-radius) * sin(var(--dial-angle))) calc(50% - var(--dial-radius) * cos(var(--dial-angle))), var(--dial-color) calc(var(--dial-cap) - .5px), transparent var(--dial-cap)),        conic-gradient(from var(--dial-start), var(--dial-color) calc(var(--dial-share) * var(--dial-sweep)), transparent 0);    }    /* Ticks take a narrow rim outside the thumb's path; marks a wider one, outside the ticks. */    &:has(.dial-ticks) {      --dial-rim: .5rem;    }    &:has(.dial-mark) {      --dial-rim: 1.375rem;    }    &.dial-full {      --dial-start: 0deg;      --dial-sweep: 360deg;    }    &.dial-sm {      --dial-size: 5.5rem;    }    &.dial-lg {      --dial-size: 10rem;    }    &[aria-disabled="true"] {      opacity: .5;      cursor: not-allowed;    }    @media (forced-colors: active) {      --dial-color: Highlight;      forced-color-adjust: none;      color: CanvasText;      &::before {        --dial-color: GrayText;        opacity: 1;      }      /* The dial is out of forced colors, so its figure and its marks are given the system's disabled ink too. */      &[aria-disabled="true"] {        --dial-color: GrayText;        color: GrayText;      }    }  }  /* The thumb: the slider's pearl disc, standing on the track at the value's angle. */  .dial-thumb {    position: absolute;    z-index: 1;    top: calc(50% - var(--dial-radius) * cos(var(--dial-angle)));    left: calc(50% + var(--dial-radius) * sin(var(--dial-angle)));    box-sizing: border-box;    width: var(--dial-thumb);    height: var(--dial-thumb);    translate: -50% -50%;    border-radius: 999px;    corner-shape: round;    @apply --surface-thumb;    box-shadow: 0 0 0 .5px var(--color-line-strong), 0 1px 2px -.5px var(--color-shade-1), 0 2px 4px -1px var(--color-shade-2), 0 4px 8px -4px var(--color-shade-3);    transition: scale var(--duration-quick) var(--easing-glide);    /* Held, the thumb grows a little under the finger. */    .dial:active:not([aria-disabled="true"]) & {      scale: 1.08;    }    /* Focus rings the thumb, as it does on a slider: the thumb is what the keys move. */    .dial:focus-visible & {      @apply --focus-ring;    }    @media (prefers-reduced-motion: reduce) {      transition: none;      .dial:active:not([aria-disabled="true"]) & {        scale: none;      }    }    @media (forced-colors: active) {      background: ButtonText;      box-shadow: 0 0 0 1px Canvas;      .dial:focus-visible & {        outline-color: Highlight;      }      /* Disabled, the thumb takes the system's disabled ink with the fill, as a slider's thumb does. */      .dial[aria-disabled="true"] & {        background: GrayText;      }    }  }  /* The value as text, in the dial's own figures, in the middle. */  .dial-value {    position: relative;    z-index: 1;    max-width: calc(var(--dial-radius) * 1.4);    overflow: hidden;    text-overflow: ellipsis;    white-space: nowrap;  }  /*   * Ticks: --dial-ticks equal steps across the sweep, as fine lines in the rim just outside the thumb's path.   * A knob shows one more tick than steps, at both ends; the full circle shows as many as steps.   */  .dial-ticks {    --dial-ticks: 10;    --dial-tick-inner: calc(var(--dial-size) / 2 - var(--dial-rim) + .125rem);    --dial-tick-outer: calc(var(--dial-tick-inner) + .3125rem);    position: absolute;    inset: 0;    border-radius: 999px;    corner-shape: round;    color: var(--color-line-mark);    /* Each tick is feathered at its sides: a hard stop in a conic gradient draws a jagged line. */    background: repeating-conic-gradient(from calc(var(--dial-start) - .75deg), transparent 0, currentColor .3deg 1.2deg, transparent 1.5deg calc(var(--dial-sweep) / var(--dial-ticks)));    mask:      radial-gradient(circle, transparent calc(var(--dial-tick-inner) - .5px), black var(--dial-tick-inner), black var(--dial-tick-outer), transparent calc(var(--dial-tick-outer) + .5px)),      conic-gradient(from calc(var(--dial-start) - 1deg), black calc(var(--dial-sweep) + 2deg), transparent 0);    mask-composite: intersect;    pointer-events: none;    @media (forced-colors: active) {      color: GrayText;    }  }  /* A mark: a short word or figure in the rim, at the value --dial-at stands for. */  .dial-mark {    --dial-at: 0;    --dial-mark-angle: calc(var(--dial-start) + clamp(0, calc((var(--dial-at) - var(--dial-min)) / (var(--dial-max) - var(--dial-min))), 1) * var(--dial-sweep));    --dial-mark-radius: calc(var(--dial-size) / 2 - .4375rem);    position: absolute;    top: calc(50% - var(--dial-mark-radius) * cos(var(--dial-mark-angle)));    left: calc(50% + var(--dial-mark-radius) * sin(var(--dial-mark-angle)));    translate: -50% -50%;    color: var(--color-text-muted);    font: 400 .6875rem/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    letter-spacing: 0;    white-space: nowrap;    pointer-events: none;    @media (forced-colors: active) {      color: CanvasText;      .dial[aria-disabled="true"] & {        color: GrayText;      }    }  }}