VelocityUI logoVelocityUI

Checkbox

A custom-styled accessible checkbox with label, description text, error state, and three sizes. Forwards refs and spreads all native input attributes.

Import

tsx
import { Checkbox } from 'https://git.cameronlow.com/cam/VelocityUI/packages'

Preview

Receive updates about your account activity.

Props

PropTypeDefaultDescription
labelstringLabel text rendered beside the checkbox.
descriptionstringHelper text rendered below the label.
errorstringError message rendered below. Sets aria-invalid.
size'sm' | 'md' | 'lg''md'Controls the checkbox and label size.
checkedbooleanControlled checked state.
defaultCheckedbooleanUncontrolled default checked state.
disabledbooleanfalseDisables the checkbox.

Examples

Basic

tsx
import { Checkbox } from 'https://git.cameronlow.com/cam/VelocityUI/packages'

export default function Example() {
  return <Checkbox label="Accept terms and conditions" />
}

With description

tsx
import { Checkbox } from 'https://git.cameronlow.com/cam/VelocityUI/packages'

export default function Example() {
  return (
    <Checkbox
      label="Email notifications"
      description="Receive updates about your account activity."
      defaultChecked
    />
  )
}

Sizes

tsx
import { Checkbox } from 'https://git.cameronlow.com/cam/VelocityUI/packages'

export default function Example() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: '0.75rem' }}>
      <Checkbox size="sm" label="Small" defaultChecked />
      <Checkbox size="md" label="Medium" defaultChecked />
      <Checkbox size="lg" label="Large" defaultChecked />
    </div>
  )
}

Theming

Apply a named theme class to <body> or any parent element. All VelocityUI components inside that element will automatically adopt its colors, shadows, and effects. Combine with a density modifier for complete control:

css
/* Pick any named theme */
<body class="vui-theme-ocean">

/* Add a density modifier (optional) */
<body class="vui-theme-midnight vui-density-compact">
<body class="vui-theme-construction vui-density-spacious">

/* Available themes */
/* default  midnight  ocean */
/* construction  glass  soft  high-contrast  monochrome-red */

/* Available densities */
/* vui-density-compact  vui-density-comfortable  vui-density-spacious */