Checkbox
A native form checkbox with a drawn checkmark and an indeterminate state.
Installation
Import from the Reflow workspace package.
Playground
Open demoimport { Checkbox } from '@rtzll/reflow'
import { type Handle } from 'remix/component'
export function Example(handle: Handle) {
return () => (
<>
<Checkbox label="Accept terms and conditions" />
</>
)
}With a description
import { Field, Checkbox } from '@rtzll/reflow'
import { type Handle } from 'remix/component'
export function Example(handle: Handle) {
return () => (
<>
<Field description="One email a month, never more.">
{(control) => <Checkbox {...control} label="Product updates" defaultChecked />}
</Field>
</>
)
}Invalid and disabled
import { Field, Checkbox } from '@rtzll/reflow'
import { type Handle } from 'remix/component'
export function Example(handle: Handle) {
return () => (
<>
<Field error="Required to join the event">
{(control) => <Checkbox {...control} label="I agree to the code of conduct" />}
</Field>
<Checkbox label="Managed by your admin" disabled defaultChecked />
<Checkbox label="Mixed selection" indeterminate />
</>
)
}API Reference
Public props for the Reflow implementation. Native controls also accept their standard HTML attributes and Remix event mixes.
Checkbox
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | — | The `disabled` HTML attribute. |
name | string | — | The `name` HTML attribute. |
value | string | number | — | The `value` HTML attribute. |
checked | boolean | — | The `checked` HTML attribute. |
defaultChecked | boolean | — | The `defaultChecked` HTML attribute. |
defaultValue | string | number | — | The `defaultValue` HTML attribute. |
indeterminate | boolean | — | The `indeterminate` HTML attribute. |
placeholder | string | — | The `placeholder` HTML attribute. |
required | boolean | — | The `required` HTML attribute. |
size | "default" | "compact" | — | Control density or icon-button dimensions. |
label | RemixNode | — | Accessible name or visible label for the control. |
onCheckedChange | ((checked: boolean, event: Event) => void) | — | Called when the checked state changes. |