No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Checkbox

A checkbox allows the user to toggle between 2 or 3 (indeterminate) choices.

usage
import { Checkbox, CheckboxGroup } from "@sharegate/orbit-ui";
sources
Github

Usage

Default

A default checkbox.

Editable example

No label

A checkbox can be rendered without a label.

Editable example

Checked

A checkbox can be checked.

Editable example

Indeterminate

A checkbox can be indeterminate.

Editable example

Disabled

A checkbox can be disabled.

Editable example

Icon

A checkbox can have icons after his label.

Editable example

Counter

A checkbox can have a counter after his label.

Editable example

Size

A checkbox can vary in size.

Editable example

Reverse

A checkbox checkmark can be to the left or to the right of his label.

Editable example

Validation

A checkbox can display a validation state to communicate to the user whether the current value is valid or invalid.

Implement your own validation logic in your app and pass either "valid" or "invalid" to the input via the validationState prop.

The example below illustrates how one would validate if the user has checked the checkbox.

Editable example

Controlled

A checkbox can handle checked state in controlled mode.

Editable example

Checkbox group

Related checkboxes can be group together.

Editable example

Orientation

A checkbox group can render his elements vertically.

Editable example

Reverse

A checkbox group elements can be reversed.

Editable example

Validation

A checkbox group can display a validation state to communicate to the user whether the current value is valid or invalid.

Implement your own validation logic in your app and pass either "valid" or "invalid" to the input via the validationState prop.

The example below illustrates how one would validate if the user has checked all the checkbox.

Editable example

Custom components

Any component implementing the CheckableContext can behave like a checkbox group. This is usually done by using the useCheckableProps hook.

Editable example

Controlled

A checkbox group can handle value state in controlled mode.

Editable example

API

Checkbox

usage
import { Checkbox } from "@sharegate/orbit-ui";
slots
"label", "icon", "counter"
NameDescriptionDefault
autoFocus
Whether or not the input should autoFocus on render.
numberfalsetrue
-
checked
A controlled checked state value.
falsetrue
-
defaultChecked
The initial value of checked when uncontrolled.
falsetrue
-
defaultIndeterminate
The initial value of indeterminate.
falsetrue
-
indeterminate
A controlled indeterminate state value.
falsetrue
-
onChange
Called when the checkbox checked state change.
ChangeEventHandler<Element>
eventReact's original synthetic event.
-
onValueChange
Called when the checkbox checked state change.
(event: ChangeEvent<HTMLInputElement>, isChecked: boolean) => void
eventReact's original synthetic event.
isCheckedWhether or not the input is checked.
-
required
Whether or not a user input is required before form submission.
falsetrue
-
reverse
Invert the order the checkmark box and the label.
falsetrue
-
size
A checkbox can vary in size.
"sm" | "md" | ResponsiveValue<"sm" | "md">
-
validationState
Whether or not the input should display as "valid" or "invalid".
"valid""invalid"
-
value
The value to associate with when in a group.
string
-

CheckboxGroup

usage
import { CheckboxGroup } from "@sharegate/orbit-ui";
NameDescriptionDefault
align
The alignment of the elements.
"center" | "end" | "start" | ResponsiveValue<FlexAlignment>
-
autoFocus
Whether or not the first input of the group should autoFocus on render.
numberfalsetrue
-
disabled
Whether or not the inputs of the group are disabled.
falsetrue
-
fluid
Whether the elements take up the width & height of their container.
false | true | ResponsiveValue<boolean>
-
inline
Whether or not the element generate line breaks before or after himself.
falsetrue
-
onChange
Called when an input of the group change.
(event: SyntheticEvent<Element, Event>, value: string[]) => void
eventReact's original event.
valueThe new value.
-
orientation
The orientation of the elements.
"horizontal" | "vertical" | ResponsiveValue<FlexOrientation>
-
required
Whether a user input is required before form submission.
falsetrue
-
reverse
Whether or not to reverse the order of the elements.
falsetrue
-
size
The checkbox of a group can vary in size.
"sm" | "md" | ResponsiveValue<"sm" | "md">
-
validationState
Whether the group should display as "valid" or "invalid".
"valid""invalid"
-
value
The value of the group.
string[]
-
wrap
Whether elements are forced onto one line or can wrap onto multiple rows.
false | true | ResponsiveValue<boolean>
-