Checkbox
A control that allows the user to toggle between checked and not checked states. Supports full keyboard navigation.
Import
import { Checkbox } from "@sparrowengg/twigs-react";Usage
const CheckboxExample = () => {
return (
<Checkbox id="accept-terms" size="md">
Accept terms and conditions
</Checkbox>
);
};Examples
Indeterminate State
The checkbox supports an indeterminate state, useful for representing partial selections (e.g., "select all" scenarios). When set to 'indeterminate', the checkbox displays a horizontal line icon instead of a checkmark.
Props
Checkbox
| Prop | Type | Default |
|---|---|---|
checked? | boolean | 'indeterminate' | - |
onChange? | (checked: boolean | 'indeterminate') => void | - |
children? | ReactNode | - |
disabled? | boolean | false |
required? | boolean | false |
id? | string | - |
name? | string | - |
value? | string | on |
size? | 'sm' | 'md' | 'sm' |
containerRef? | React.Ref<HTMLDivElement> | - |
css? | object | - |
Data Attributes
These props are used for the conditional rendering of the components
| Prop | Type | Default |
|---|---|---|
[data-state]? | 'checked' | 'unchecked' | 'indeterminate' | - |
[data-disabled]? | boolean | - |
Cascader
A hierarchical dropdown component that enables users to navigate through nested option structures and select values from multi-level menus. Perfect for complex data selection scenarios.
FormHelperText
A component for providing additional context, hints, or error messages to form input fields. Built on top of the Text component with specialized styling for form contexts.