CheckboxGroup
Multi-select options with a fluid highlight and adjacent selected surfaces.
Installation
Import from the Reflow workspace package.
Playground
Open demoimport { CheckboxGroup } from '@rtzll/reflow'
import { type Handle } from 'remix/component'
export function Example(handle: Handle) {
const options = [{"label":"Apples","value":"apples"},{"label":"Bananas","value":"bananas"},{"label":"Cherries","value":"cherries"},{"label":"Dates","value":"dates"}]
return () => (
<>
<CheckboxGroup label="Fruit" hideLabel defaultValue={['apples']} options={options} />
</>
)
}With descriptions
import { CheckboxGroup } from '@rtzll/reflow'
import { type Handle } from 'remix/component'
export function Example(handle: Handle) {
const options = ['Apple', 'Banana', 'Cherry', 'Mango'].map((label) => ({ value: label.toLowerCase(), label }))
return () => (
<>
<CheckboxGroup label="Notifications" options={[
{ value: 'email', label: 'Email', description: 'Updates in your inbox' },
{ value: 'push', label: 'Push', description: 'Notifications on your device' },
]} />
</>
)
}Controlled selection
import { CheckboxGroup } from '@rtzll/reflow'
import { type Handle } from 'remix/component'
export function Example(handle: Handle) {
const options = ['Apple', 'Banana', 'Cherry', 'Mango'].map((label) => ({ value: label.toLowerCase(), label }))
let selected: string[] = []
const setSelected = (values: string[]) => { selected = values; handle.update() }
return () => (
<>
<CheckboxGroup label="Features" options={options}
value={selected} onValueChange={setSelected} />
</>
)
}API Reference
Public props for the Reflow implementation. Native controls also accept their standard HTML attributes and Remix event mixes.
CheckboxGroup
| Prop | Type | Default | Description |
|---|---|---|---|
value | readonly string[] | — | Current value when controlled by the parent. |
defaultValue | readonly string[] | — | Initial value for an uncontrolled component. |
onValueChange | ((value: string[]) => void) | — | Called when the selected value changes. |
options* | readonly GroupOption[] | — | Choices available to the user. |
label* | string | — | Accessible name or visible label for the control. |
hideLabel | boolean | — | Keeps the label available to assistive technology while hiding it visually. |
name | string | — | Name used when the control participates in a form. |
disabled | boolean | — | Prevents interaction and conveys the disabled state. |
orientation | "horizontal" | "vertical" | vertical | Layout direction. |
GroupOption
| Prop | Type | Default | Description |
|---|---|---|---|
value* | string | — | Value submitted for this option. |
label* | RemixNode | — | Visible option label. |
description | RemixNode | — | Additional explanatory text. |
disabled | boolean | — | Prevents interaction and conveys the disabled state. |