DOCS
v0.4

Components / Checkbox

Checkbox

Checkbox with animated tick stroke reveal, spring bounce, rounded variants, and indeterminate state.

formsv0.1.0

Playground

Examples

Basic
<cg-stack gap="sm"><cg-checkbox label="Default"></cg-checkbox><cg-checkbox label="Checked" checked></cg-checkbox><cg-checkbox label="Disabled" disabled></cg-checkbox></cg-stack>
Round
<cg-stack gap="sm"><cg-checkbox rounded="full" label="Round unchecked"></cg-checkbox><cg-checkbox rounded="full" label="Round checked" checked></cg-checkbox></cg-stack>
Indeterminate
<cg-checkbox label="Select all" indeterminate></cg-checkbox>
States
<cg-stack gap="sm"><cg-checkbox label="Error" error checked></cg-checkbox><cg-checkbox label="Success" success checked></cg-checkbox><cg-checkbox label="Loading" loading></cg-checkbox></cg-stack>
With description
<cg-stack gap="sm"><cg-checkbox label="Accept terms" description="Required to create your account"></cg-checkbox><cg-checkbox label="Marketing emails" description="Receive weekly product updates" checked></cg-checkbox></cg-stack>

Import

import { CgCheckbox } from '@cognivo/components';
// Or tree-shake: import '@cognivo/components/cg-checkbox';

Per-component imports ship only that component (~8 kB gzip).

API Reference

PropTypeDefaultDescription
labelstring""Label text
descriptionstring""Helper description below the label
namestring""Form field name
valuestring""Form value when checked
checkedbooleanfalseChecked state
indeterminatebooleanfalseIndeterminate state (horizontal dash)
disabledbooleanfalseDisabled state
errorbooleanfalseError state
successbooleanfalseSuccess state
loadingbooleanfalseLoading state
rounded"none" | "sm" | "md" | "lg" | "full""sm"Border radius — use "full" for circular checkbox

Events

EventDetailDescription
cg-change{checked: boolean, value: string}When toggled