Dashral Pro is on the wayGet 30% off at launch

Dashral

Checkbox

A control that toggles between checked and unchecked.

$ pnpm dlx shadcn@latest add https://dashral.com/r/checkbox.json

A summary of your team's activity, every Monday.

Required to join the beta.

Installation

$ pnpm dlx shadcn@latest add https://dashral.com/r/checkbox.json

Adds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:

components.json
{
  "registries": {
    "@dashral": "https://dashral.com/r/{name}.json"
  }
}

Then add components by name:

$ pnpm dlx shadcn@latest add @dashral/checkbox

Usage

example.tsx
import { Checkbox } from "@/components/dashral/checkbox"

<Checkbox label="Email me about new releases" defaultChecked />

Examples

Colors

color for the ticked state; variant="outline" colors only the border and mark.

solid
outline

Role permissions

A role × permission grid: each column's header box ticks the whole role and shows half-ticked when some are on.

PermissionViewerEditorAdmin
View dashboards
Export data
Edit dashboards
Invite people
Manage billing

API reference

Checkbox

Also takes every prop of Radix Checkbox(opens in a new tab).

PropTypeDefault
checked / defaultCheckedboolean | "indeterminate"

Controlled or initial state.

—
onCheckedChange(checked: boolean | "indeterminate") => void

Called when it's toggled.

—
disabled / required / name / value

Like a native checkbox; it takes part in forms.

—
labelReactNode

Beside the control; clicking it works the control.

—
descriptionReactNode

A hint under the label.

—
errorboolean | ReactNode

true shows the error style; a message also shows under the label.

—
color"primary" | "neutral" | "info" | "success" | "warning" | "destructive" | "highlight"

The color when on, ticked or picked.

"primary"
variant"solid" | "outline"

solid fills the box when ticked; outline colors only its border and mark.

"solid"
labelPosition"end" | "start"

"start" puts the label first and the box at the far end.

"end"
classNames{ root, label, description, error, checkbox }

Classes for each part.

—

Keyboard

KeysAction
SpaceToggle

Accessibility

  • role="checkbox" with aria-checked (including "mixed").
  • Give it a label (or an aria-label); the description is linked through aria-describedby.

Motion

  • The check springs in from half size; the box changes color smoothly.