Checkbox API

API documentation for Checkbox component

Checkbox#

Props#

Defines valid properties in Checkbox component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: CheckboxInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: CheckboxInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<CheckboxPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: CheckboxInstance) => ReactNode)
null
The children to render.
valueunknown
null
Value of the checkbox.
namestring
null
The name of the checkbox.
size"small" | "large" | "normal"
null
Defines the size of the checkbox.
variant"outlined" | "filled"
null
Specifies the input variant of the component.
disabledboolean
false
When present, it specifies that the element should be disabled.
readOnlyboolean
false
When present, it specifies that an input field is read-only.
requiredboolean
false
When present, it specifies that the element is required.
invalidboolean
false
When present, it specifies that the component should have invalid state style.
inputIdstring
null
Identifier of the underlying input element.
inputStyleCSSProperties
null
Inline style of the input field.
inputClassNamestring
null
Style class of the input field.
ariaLabelstring
null
Establishes a string value that labels the component.
ariaLabelledbystring
null
Establishes relationships between the component and label(s) where its value should be one or more element IDs.
onFocus(event: FocusEvent<HTMLInputElement>) => void
null
Callback function that is called when the checkbox is focused.
onBlur(event: FocusEvent<HTMLInputElement>) => void
null
Callback function that is called when the checkbox loses focus.
onCheckedChange(event: CheckboxChangeEvent) => void
null
Callback fired when the checkbox's checked state changes.
checkedboolean
null
When present, it specifies the input's checked state.
defaultCheckedboolean
null
The default value for the input when not controlled by `checked` and `onCheckedChange` .
indeterminateboolean
false
When present, it specifies input state as indeterminate.
trueValuestring | number | boolean
true
Value in checked state.
falseValuestring | number | boolean
false
Value in unchecked state.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Checkbox component.

nametypedefaultdescription
checkedboolean
null
The checked state of the useCheckbox.
indeterminateboolean
null
The indeterminate state of the useCheckbox.

Exposes#

Defines the methods and properties exposed by Checkbox component.

nametypedefaultdescription
groupCheckboxGroupInstance
null
The group instance of the checkbox.
stateuseCheckboxState
null
The state of the useCheckbox.
onChange(event: useCheckboxChangeEvent) => void
null
Callback fired when the useCheckbox's checked state changes.

Events#

Event fired when the checkbox's checked state changes.

nametypedescription
valueunknownValue of the checkbox.
originalEventChangeEventThe original event that triggered the change.
checkedbooleanThe checked state of the checkbox.

Interfaces#

Defines passthrough(pt) options of Checkbox component.

nametypedefaultdescription
rootCheckboxPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
inputCheckboxPassThroughType<InputHTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the input's DOM element.
boxCheckboxPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the box's DOM element.
iconCheckboxPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the icon's DOM element.

Types#

Instance of Checkbox component.

values
ComponentInstance<CheckboxProps, CheckboxState, CheckboxExposes>

CheckboxGroup#

Props#

Defines valid properties in CheckboxGroup component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: CheckboxGroupInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: CheckboxGroupInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<CheckboxGroupPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: CheckboxGroupInstance) => ReactNode)
null
The children to render.
valueunknown[]
null
Value of the checkbox group.
defaultValueunknown[]
null
The default value of the checkbox group.
namestring
null
The name of the checkboxes.
disabledboolean
false
When present, it specifies that the checkbox group should be disabled.
invalidboolean
false
When present, it specifies that the checkbox group is invalid.
onValueChange(event: CheckboxGroupValueChangeEvent) => void
null
Callback function that is called when the checkbox group value changes.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in CheckboxGroup component.

nametypedefaultdescription
valueunknown[]
null
Value of the checkbox group.

Exposes#

Defines the methods and properties exposed by CheckboxGroup component.

nametypedefaultdescription
stateCheckboxGroupState
null
The state of the checkbox group.
updateChange(event: CheckboxGroupUpdateChangeEvent) => void
null
Updates the value of the checkbox group.

Events#

Event fired when the checkbox group's value changes.

nametypedescription
valueunknown[]The value of the checkbox group.

Used to update the checkbox group value.

nametypedescription
valueunknownValue of the checkbox.
originalEventChangeEventThe original event that triggered the change.
checkedbooleanThe checked state of the checkbox.

Interfaces#

Defines passthrough(pt) options of Checkbox component.

nametypedefaultdescription
rootCheckboxGroupPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of CheckboxGroup component.

values
ComponentInstance<CheckboxGroupProps, CheckboxGroupState, CheckboxGroupExposes>

useCheckbox#

Props#

Defines valid properties in useCheckbox.

nametypedefaultdescription
checkedboolean
null
When present, it specifies the input's checked state.
defaultCheckedboolean
null
The default value for the input when not controlled by `checked` and `onCheckedChange` .
indeterminateboolean
false
When present, it specifies input state as indeterminate.
trueValuestring | number | boolean
true
Value in checked state.
falseValuestring | number | boolean
false
Value in unchecked state.
onCheckedChange(event: useCheckboxChangeEvent) => void
null
Callback fired when the checkbox's checked state changes.

State#

Defines valid state in useCheckbox.

nametypedefaultdescription
checkedboolean
null
The checked state of the useCheckbox.
indeterminateboolean
null
The indeterminate state of the useCheckbox.

Exposes#

Defines the methods and properties exposed by useCheckbox.

nametypedefaultdescription
stateuseCheckboxState
null
The state of the useCheckbox.
onChange(event: useCheckboxChangeEvent) => void
null
Callback fired when the useCheckbox's checked state changes.

Events#

Event fired when the checkbox's checked state changes.

nametypedescription
originalEventEThe original event that triggered the change.
checkedbooleanThe checked state of the checkbox.

Types#

Instance of useCheckbox headless.

values
HeadlessInstance<useCheckboxProps, useCheckboxState, useCheckboxExposes>