Checkbox Group
Render a Checkbox Group with multiple options.
Render a Checkbox Group with multiple options.
import { Checkbox } from '@ark-ui/react/checkbox'
import { CheckIcon } from 'lucide-react'
const items = [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
]
export const Example = () => {
return (
<Checkbox.Group defaultValue={['react']} onValueChange={console.log}>
{items.map((item) => (
<Checkbox.Root key={item.value} value={item.value}>
<Checkbox.Label>{item.label}</Checkbox.Label>
<Checkbox.Control>
<Checkbox.Indicator>
<CheckIcon />
</Checkbox.Indicator>
</Checkbox.Control>
<Checkbox.HiddenInput />
</Checkbox.Root>
))}
</Checkbox.Group>
)
}