XY Pad

Two-dimensional control surface for mapping and automating X/Y parameters with pointer, wheel, and keyboard input.

XY pad for simultaneous control of two values (for example filter cutoff/resonance, pan/mix, or macro controls). The registry component wraps XYPad primitives from @audio-ui/react and provides ready-to-use visuals (grid, crosshair, cursor, value display).

XY PadUse arrow keys to adjust X and Y values.X: 50.0, Y: 50.0
50, 50
X: 50 - Y: 50

Overview

  • Interaction model: Pointer drag, wheel nudging, and keyboard nudging over both axes.
  • Axes: Independent ranges and steps for X (minX, maxX, stepX) and Y (minY, maxY, stepY).
  • Feedback: Grid lines, crosshair, animated cursor, and optional value display overlay.
  • Accessibility: Focusable interactive surface with ARIA labeling (aria-label / aria-labelledby).

Installation

Usage

import { XYPad } from "@/components/audio/xypad";

Uncontrolled - initial value only:

<XYPad
  defaultValue={{ x: 0, y: 0 }}
  maxX={100}
  maxY={1}
  minX={-100}
  minY={-1}
  stepX={1}
  stepY={0.01}
/>

Controlled - drive value from state:

const [position, setPosition] = useState({ x: 50, y: 50 });
 
<XYPad
  maxX={100}
  maxY={100}
  minX={0}
  minY={0}
  onValueChange={setPosition}
  onValueCommit={(value) => console.log("Committed:", value)}
  value={position}
/>

Interaction

Pointer

BehaviorDetails
Click / drag on padPointer position maps directly to X/Y in bounds.
ClampingValues always clamp to configured axis ranges.
Commit eventonValueCommit fires when drag interaction ends.

Keyboard

Focused XY pad:

KeyAction
ArrowLeft / ArrowRightDecrease / increase X by stepX
ArrowUp / ArrowDownIncrease / decrease Y by stepY
PageUp / PageDownIncrease / decrease Y by stepY × 10
HomeJump to top-left logical corner (x = minX, y = maxY)
EndJump to bottom-right logical corner (x = maxX, y = minY)

Wheel

When focused, wheel deltas nudge both axes according to pad dimensions and axis ranges, then quantize with stepX and stepY.

API reference

XYPad accepts style props (size, formatValue, valueDisplay, className) plus primitive props from XYPadPrimitive.RootProps.

Value and state

PropTypeDefaultDescription
value{ x: number; y: number }-Controlled value.
defaultValue{ x: number; y: number }{ x: 0, y: 0 }Uncontrolled default value.
minXnumber0Minimum X value.
maxXnumber100Maximum X value.
minYnumber0Minimum Y value.
maxYnumber100Maximum Y value.
stepXnumber1Step increment for X axis.
stepYnumber1Step increment for Y axis.
disabledbooleanfalseWhether the pad is disabled.
onValueChange(value: { x: number; y: number }) => void-Callback when value changes during interaction.
onValueCommit(value: { x: number; y: number }) => void-Callback when value is committed (on release).
aria-labelstring"XY Pad"Accessible name for the interactive surface.
aria-labelledbystring-ID of a labeling element.

Layout and display

PropTypeDefaultDescription
size"sm" | "default" | "lg" | "xl""default"Size variant (affects height).
formatValue(value: { x: number; y: number }) => React.ReactNode-Custom formatter for value display.
valueDisplay"visible" | "hidden""visible"Controls value display visibility. Use "hidden" to hide overlay.
classNamestring-Additional CSS classes.

Additional valid HTML attributes passed to XYPad.Root are forwarded.

Examples

Live value readout

XY PadUse arrow keys to adjust X and Y values.X: 50.0, Y: 50.0
50, 50
X: 50 - Y: 50

Size variants

sm

XY PadUse arrow keys to adjust X and Y values.X: 40.0, Y: 65.0
40, 65

default

XY PadUse arrow keys to adjust X and Y values.X: 40.0, Y: 65.0
40, 65

lg

XY PadUse arrow keys to adjust X and Y values.X: 40.0, Y: 65.0
40, 65

xl

XY PadUse arrow keys to adjust X and Y values.X: 40.0, Y: 65.0
40, 65

Disabled state

XY PadUse arrow keys to adjust X and Y values.X: 50.0, Y: 50.0
50, 50

Custom formatted display

XY PadUse arrow keys to adjust X and Y values.X: 50.0, Y: 50.0
X: 50, Y: 50

Hidden value display

XY PadUse arrow keys to adjust X and Y values.X: 50.0, Y: 50.0

Bipolar ranges (pan and mix style)

XY PadUse arrow keys to adjust X and Y values.X: 0.0, Y: 0.0
Pan 0 | Mix 0.00
Pan: 0 - Mix: 0.00

Live value vs committed value callbacks

XY PadUse arrow keys to adjust X and Y values.X: 50.0, Y: 50.0
50, 50
Live: X 50 - Y 50
Committed: X 50 - Y 50

Channel strip

Filter pad

Channel 1
Filter
XY PadUse arrow keys to adjust X and Y values.X: 30.0, Y: 70.0
Cut 30% · Res 70%
Output

Reverb pad

Reverb
XY PadUse arrow keys to adjust X and Y values.X: 60.0, Y: 20.0
Color 60 | Space 20
Wet
Knob arc
60%

Last updated 4/15/2026