Toolbar
A Figma-inspired toolbar component for tool selection and controls.
Usage
1import { Toolbar } from "aviris-components";23export default function ToolbarDemo() {4 return (5 <Toolbar />6 );7}Custom Tools
1import { Toolbar } from "aviris-components";2import { Pencil, Eraser, ColorPicker } from "lucide-react";34const customTools = [5 { icon: <Pencil size={16} />, label: "Draw", tooltip: "Draw Tool (B)" },6 { icon: <Eraser size={16} />, label: "Erase", tooltip: "Eraser Tool (E)" },7 { icon: <ColorPicker size={16} />, label: "Color", tooltip: "Color Picker (I)" },8];910export default function CustomToolbarDemo() {11 return (12 <Toolbar tools={customTools} />13 );14}With Tooltips
Hover over the tools to see tooltips with keyboard shortcuts.
1import { Toolbar } from "aviris-components";23export default function TooltipToolbarDemo() {4 return (5 <Toolbar6 tools={[7 { icon: <Mouse size={16} />, label: "Select", tooltip: "Select Tool (V)" },8 { icon: <Hand size={16} />, label: "Hand", tooltip: "Pan Around (H)" },9 ]}10 />11 );12}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | "horizontal" | "vertical" | "horizontal" | The orientation of the toolbar. |
| size | "default" | "sm" | "lg" | "default" | The size of the toolbar. |
| tools | ToolItem[] | defaultTools | Array of tools to display in the toolbar. |
| className | string | - | Additional CSS classes to apply. |
ToolItem Interface
| Property | Type | Description |
|---|---|---|
| icon | React.ReactNode | Required. The icon to display for the tool. |
| label | string | Required. The name of the tool. |
| tooltip | string | Optional tooltip text to show on hover. |
| onClick | () => void | Optional click handler for the tool. |