Toggle Group
Example
import { ToggleGroup } from '@i4o/catalystui'
import {
FontBoldIcon,
FontItalicIcon,
UnderlineIcon,
TextAlignLeftIcon,
TextAlignCenterIcon,
TextAlignRightIcon,
} from '@radix-ui/react-icons'
export default function ToggleGroupExample() {
return (
<div className='flex space-x-4'>
<ToggleGroup
items={[
{
value: 'bold',
label: 'Font Bold',
icon: <FontBoldIcon />,
},
{
value: 'italic',
label: 'Font Italic',
icon: <FontItalicIcon />,
},
{
value: 'underline',
label: 'Underline',
icon: <UnderlineIcon />,
},
]}
type='multiple'
/>
<ToggleGroup
items={[
{
value: 'left',
label: 'Left Align',
icon: <TextAlignLeftIcon />,
},
{
value: 'center',
label: 'Center Align',
icon: <TextAlignCenterIcon />,
},
{
value: 'right',
label: 'Right Align',
icon: <TextAlignRightIcon />,
},
]}
type='single'
/>
</div>
)
}
Props
Name | Type | Default | Description |
---|---|---|---|
items | Array<{ value: string, label: string, icon: ReactNode }> | [] | Array of items to render |
type | 'single' | 'multiple' | 'single' | Type of toggle group. Single allows only one button to be toggled in a group. Multiple allows multiple toggles in the group. |
// TODO: Update docs