Rime

Checkbox

A native checkbox drawn as a gradient tick, plain or as a selectable card, with indeterminate.

Checkbox keeps the real <input type="checkbox"> (visually hidden, focusable, form-posting) and draws the box beside it. variant="card" turns the whole option into a bordered target for statements a user agrees to (terms, declarations).

Installation

npx shadcn@latest add KezLahd/rime/checkbox

Also installs: base, field, icon.

Usage

import { Checkbox } from "@/components/ui";

<Checkbox label="I accept the workspace terms" checked={ok} onChange={(e) => setOk(e.target.checked)} />

Examples

Plain, card, indeterminate

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

Checkbox

Checkbox props
PropTypeDefaultDescription
labelRequiredReactNode
descriptionReactNode
indeterminateboolean
errorReactNodeError text for a standalone checkbox (a declaration, accepting the terms).
invalidboolean
variant"plain" | "card""plain"plain = box and label. card = a bordered opt-in box that washes accent when ticked (declarations, an opt-in to email updates).

Also accepts the native attributes of AriaAttributes, DOMAttributes, HTMLAttributes, InputHTMLAttributes.

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

This component has no tokens of its own; it reads the system tokens below.

System tokens it reads

Checkbox system tokens
TokenDefaultLive value
--brandtokens.css…
--brand-gradienttokens.css…
--danger-basetokens.css…
--danger-field-filltokens.css…
--danger-inktokens.css…
--durtokens.css…
--easetokens.css…
--focus-ringtokens.css…
--glow-smtokens.css…
--ink-bodytokens.css…
--ink-disabledtokens.css…
--ink-headingtokens.css…
--ink-inversetokens.css…
--ink-mutedtokens.css…
--linetokens.css…
--neutral-bordertokens.css…
--r-2xstokens.css…
--r-lgtokens.css…
--rgb-brandtokens.css…
--rgb-brand-deeptokens.css…
--rgb-contacttokens.css…
--rgb-dangertokens.css…
--rgb-whitetokens.css…
--surface-solidtokens.css…
--surface-sunkentokens.css…
--text-bodytokens.css…
--text-captiontokens.css…

Accessibility

  • The label is the <label> of the real input, so the whole row toggles it.
  • error renders under the option and is tied by aria-describedby.

Do and don't

Do

  • Use the card variant for statements a user signs up to.

Don't

  • Don't use a checkbox to trigger an immediate action; that is a Switch.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open checkbox.md