Checkbox

Checkbox component to render input type checkbox along with some other properties.

Usage

The Checkbox component can be imported using

import { Checkbox } from '@tail-kit/tail-kit'

Default Checkbox

Disabled Checkbox

Checkbox with Error

Indeterminate Checkbox

With Checkbox Group

Checkbox Props

NameDescriptionDefault Value
checked
HTML checked attribute for input element to set input status true or false
boolean | "indeterminate" | undefined
--
disabled
Use disbaled property to disable user input in checkbox
boolean | undefined
--
onChange
The callback function that is triggered when the state changes
((event: ChangeEvent<HTMLInputElement>) => void) | undefined
--
className
Additional class applied to checkbox
string | undefined
--
style
Styles property to apply on the entire Checkbox component
CSSProperties | undefined
--
defaultChecked
Default checked property to intialize component
boolean | undefined
--
label
To show label on the right side of checkbox
ReactNode
--
error
Error property to render checkbox border and label text in red whenever error occurs
boolean | undefined
--

Checkbox.Group Props

NameDescriptionDefault Value
options
Specifies options of checkbox to render
(string | OptionType)[]
--
value
Default selected values
string[] | undefined
--
disabled
If disable all checkboxes
boolean | undefined
--
onChange
The callback function that is triggered when the state changes
((checkedValues: string[]) => void) | undefined
--
className
Additional class to apply on each individual checkbox
string | undefined
--
style
Apply styles on each individual checkbox
CSSProperties | undefined
--