Component docs
Loading
"use client";
import { DirectionalPad } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
onDirection (required) | (direction: GameDirection) => void | — | — |
directions | readonly GameDirection[] | all four | The arrows to render (default all four). Only left / right lay out as one row (a paddle game), only up / down as one column; any other set keeps the cross with empty cells. |
disabled | boolean | — | Disables interaction. |
labels | Partial<Record<GameDirection, string>> | — | — |
onDirectionrequired(direction: GameDirection) => void
directionsdefault all fourreadonly GameDirection[]
The arrows to render (default all four). Only left / right lay out as one row (a paddle game), only up / down as one column; any other set keeps the cross with empty cells.
disabledboolean
Disables interaction.
labelsPartial<Record<GameDirection, string>>
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const move = (direction: string) => console.log(direction);
<DirectionalPad aria-label="Movement controls" onDirection={move} />
<DirectionalPad aria-label="Paddle controls" directions={["left", "right"]} onDirection={move} />