Skip to main content

Checkbox

The TkCheckbox component is another basic element for user input. You can use this to supply a way for the user to toggle an option.

import { TkCheckbox } from '@takeoff-ui/react'

Basic​

This demo visualizes the checked, unchecked, and indeterminate states of a checkbox component.

View Code
<TkCheckbox label="unchecked" value={false} />
<TkCheckbox label="checked" value={true} />
<TkCheckbox label="indeterminate" indeterminate={true} />

State​

This demo showcases the disabled and invalid states of the checkbox component.

View Code
<TkCheckbox label="Invalid" invalid={true} />
<TkCheckbox label="Disabled" disabled />

Type​

This demo visualizes the different appearances of checkbox with type prop.

View Code
<TkCheckbox label="default type" />
<TkCheckbox label="card type" type="card" />

Label & Description​

This demo visualizes the description sub text.

View Code
<TkCheckbox description="example description" />

Content Slot​

This demo illustrates the custom content slots.

Label
View Code
<TkCheckbox type="card">
<div slot="content" className="flex items-center gap-2">
<div>Label</div>
<TkBadge icon="info" variant="info" label="İnformation" size="small" />
</div>
</TkCheckbox>

API​

Props​

NameTypeDefaultDescription
stringnullThe description sub text displayed.
booleanfalseIf true, the user cannot interact with the checkbox.
booleanfalseIf true, the checkbox will be indeterminate.
booleanfalseIndicates whether the input is in an invalid state
stringnullDefines the label for the checkbox.
stringnullName of the checkbox
"card", "default"'default'Determines the appearance types of the checkbox.
booleanfalseSets the checkbox value

Events​

NameDescription
tk-changeEmitted when the checkbox checked state changes.

Slots​

NameDescription
contentCustom content template.