logoRuru UI

Checkbox

Checkboxes allow the user to select one or more items from a set.

Installation

npx ruru-ui-cli@latest add checkbox

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:

NameTypeDefaultDescription
indeterminatebooleanfalseSet the checkbox to indeterminate state.
disabledbooleanfalseSet the checkbox to disabled state.
onChange(event: React.ChangeEvent<HTMLInputElement>) => void-Callback when the checkbox is clicked.
checkedbooleanfalseSet the checkbox to checked state.
labelstring-Label for the checkbox.
classNamestring-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.

On this page