"use client";
import { ToolRail } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
actions (required) | readonly ToolRailAction[] | — | Action slot (buttons or links). |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
defaultValue | string | null | — | Selected tool id when uncontrolled. |
onAction | (id: string) => void | — | Called with the id of the activated command or option. |
onActionDoubleClick | (id: string) => void | — | — |
orientation | "horizontal" | "vertical" | "vertical" | Arrow keys and aria-orientation (default "vertical"); match the rail's layout. |
tone | "neutral" | "inverse" | — | Colour role (neutral, primary, danger, success, warning, info). |
value | string | null | — | Selected tool id (controlled); null for none. |
actionsrequiredreadonly ToolRailAction[]
Action slot (buttons or links).
onValueChange(value: string) => void
Called with the new value (only when it changes).
defaultValuestring | null
Selected tool id when uncontrolled.
onAction(id: string) => void
Called with the id of the activated command or option.
onActionDoubleClick(id: string) => void
orientationdefault "vertical""horizontal" | "vertical"
Arrow keys and aria-orientation (default "vertical"); match the rail's layout.
tone"neutral" | "inverse"
Colour role (neutral, primary, danger, success, warning, info).
valuestring | null
Selected tool id (controlled); null for none.
Other props are passed to the root element (HTMLAttributes<HTMLElement>), including className, style, id and aria-* attributes.
const actions = [
{ id: "select", icon: <PointerIcon />, label: "Select" },
{ id: "pen", icon: <PenToolIcon />, label: "Pen" },
];
const [tool, setTool] = useState<string | null>("select");
<ToolRail aria-label="Tools" actions={actions} onValueChange={setTool} />