useCheckbox
useCheckbox
is a custom hook used to provide checkbox functionality, as well
as state and focus management to custom checkbox components when using it.
Import#
import { useCheckbox } from '@fluidtruck/core'
Return value#
The useCheckbox
hook returns following props
Name | Type | Description |
---|---|---|
state | CheckboxState | An object that contains all props defining the current state of a checkbox. |
getCheckboxProps | PropGetter | A function to get the props of the checkbox. |
getInputProps | PropGetter | A function to get the props of the input field. |
getLabelProps | PropGetter | A function to get the props of the checkbox label. |
htmlProps | {} | An object with all htmlProps. |
Usage#
Parameters#
The useCheckbox
hook accepts an object with the following properties: