Checkbox

Box squashes on press, fills with the accent and draws its tick in. Inputs.

Open playground

About

Checkbox is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Checkbox } from "@ashutoshswamy/smoui" and set children, checked, defaultChecked among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Checkbox } from "@ashutoshswamy/smoui";

<Checkbox onChange={setSubscribed}>Send me release notes</Checkbox>

Props 4

children

Label. Clicking it toggles too.

ReactNode
checked

Controlled state.

boolean
defaultChecked

Initial state when uncontrolled.

booleandefault false
onChange

Called on toggle.

(checked: boolean) => void