1. Home 2. Components 3. Toggle Buttons # Toggle Buttons A set of buttons where only one can be selected at a time, with smooth animated transitions between selections. ## Props ### ToggleButtons | Prop | Type | Default | Description | | --- | --- | --- | --- | | value | string | - | Controlled value | | onValueChange | (value: string) => void | - | Callback when value changes | | size | 'sm' | 'base' | 'lg' | 'base' | Size of the buttons | | variant | 'primary' | 'secondary' | 'ghost' | 'secondary' | Visual style variant | | padding | boolean | true | Whether to add padding between container and buttons | | className | string | - | Custom CSS classes | | children | ReactNode | - | ToggleButton components | ### ToggleButton | Prop | Type | Default | Description | | --- | --- | --- | --- | | value | string | - | Value for this button | | icon | boolean | false | If true, renders as square icon button with proper sizing | | asChild | boolean | false | Render as child element (using Slot) | | className | string | - | Custom CSS classes | | children | ReactNode | - | Button content | ## Icon Only Perfect for toolbar-style interfaces with square buttons: Primary Secondary Ghost Selected: select ```jsx import { MousePointer, Hand, Scissors } from "lucide-react"; const [selectedTool, setSelectedTool] = useState("select"); return (

Primary

Secondary

Ghost

); ``` ## Usage Select Pick Cut Selected: select ```jsx const [selectedTool, setSelectedTool] = useState("select"); return ( Select Pick Cut ); ``` ## Padding Options Control the spacing between the container and buttons: With Padding (default) Select Pick Cut Without Padding Select Pick Cut Selected: select ```jsx const [selectedTool, setSelectedTool] = useState("select"); return ( <> {/* With padding (default) */} Select Pick Cut {/* Without padding - buttons inherit full container size */} Select Pick Cut ); ``` ## Sizes Small Select Pick Cut Base Select Pick Cut Large Select Pick Cut Selected: select ```jsx const [selectedTool, setSelectedTool] = useState("select"); return ( <> Select Pick Cut Select Pick Cut Select Pick Cut ); ``` ## Custom Styling Select Pick Cut Selected: select ```jsx const [selectedTool, setSelectedTool] = useState("select"); return ( Select Pick Cut ); ``` ## AsChild Use asChild to render the toggle button as a different element while maintaining all functionality: [Home](#home)[About](#about)[Contact](#contact)Selected: home ```jsx const [selectedPage, setSelectedPage] = useState("home"); return ( Home About Contact ); ```