Checkbox
Checkboxes allow the user to select one or more items from a set.
Installation
Usage
To use the Checkbox component, import it from ruru-ui
and include it in your component.
This example shows a basic checkbox.
Examples
indeterminate
This example demonstrates a checkbox in an indeterminate state.
disabled
This example shows a checkbox in a disabled state, making it unclickable.
checked
This example shows a checkbox that is checked by default.
with label
This example shows a checkbox with an associated label.
Props
The Checkbox component accepts the following props:
Name | Type | Default | Description |
---|---|---|---|
indeterminate | boolean | false | Set the checkbox to indeterminate state. |
disabled | boolean | false | Set the checkbox to disabled state. |
onChange | (event: React.ChangeEvent<HTMLInputElement>) => void | - | Callback when the checkbox is clicked. |
checked | boolean | false | Set the checkbox to checked state. |
label | string | - | Label for the checkbox. |
className | string | - | Custom class for the checkbox. |
This extended documentation provides clear and detailed information on how to use the Checkbox component, with multiple examples showcasing different states and configurations.