pnpm add @audio-ui/react
import { XYPad } from "@audio-ui/react/xypad";| Export | Kind | What it is |
|---|---|---|
XYPad.Control | function | The pad surface: a press jumps the value to the pointer and a drag follows it; the mouse wheel / trackpad moves it too. |
XYPad.Label | function | Accessible label, associated with both axis inputs. |
XYPad.Root | function | Groups all parts of the pad and owns its two-dimensional value. |
XYPad.Thumb | function | Marks the value on the pad (left/top as percentages, centered with translate). |
XYPad.Value | function | The formatted value (format/locale on Root), "x, y" by default. |
Anatomy
Import the primitive and assemble its parts.
import { XYPad } from "@audio-ui/react";
<XYPad.Root>
<XYPad.Label />
<XYPad.Control>
<XYPad.Thumb />
</XYPad.Control>
<XYPad.Value />
</XYPad.Root>API reference
Root
Groups all parts of the pad and owns its two-dimensional value. Exposes the value position as CSS variables for crosshairs and guides: --xy-pad-x (from the left) and --xy-pad-y (from the top), as percentages. Renders a <div> element.
Props · 14
XYPad.Value and the inputs' aria-valuetext.name.x and name.y.Data attributes · 2
data-disableddata-draggingControl
The pad surface: a press jumps the value to the pointer and a drag follows it; the mouse wheel / trackpad moves it too. Sets touch-action: none so touch drags don't scroll the page. Renders a <div> element.
Data attributes · 2
data-disableddata-draggingThumb
Marks the value on the pad (left/top as percentages, centered with translate). Holds two native <input type="range">s, one per axis: the X input takes focus, both carry the accessible name, and the arrow keys move both axes. Renders a <div> element.
Props · 2
aria-label followed by "X" / "Y".aria-valuetext. Defaults to the formatted value.Data attributes · 2
data-disableddata-draggingValue
The formatted value (format/locale on Root), "x, y" by default. Renders a <output> element.
Props · 1
Data attributes · 2
data-disableddata-draggingLabel
Accessible label, associated with both axis inputs. Renders a <div> element.
Data attributes · 2
data-disableddata-draggingStyled
The registry's styled XY Pad, its usage and interaction: XY Pad.