Skip to content

CheckboxCard

A yes/no drawn as a card: a title, a sentence about what it does, and the whole card to press.

import { CheckboxCard, CheckboxCardSkeleton } from '@sypnia/ui/react'

On this page
  1. An option with its explanation
  2. Several under one question
  3. Disabled
  4. Skeleton
  5. When to use it
  6. For everyone
  7. Props

An option with its explanation

Tick it: the text under the card says what will happen.

Without it, backups are made once a week.

Code
import { useState } from 'react';
import { CheckboxCard } from '@sypnia/ui/react';

export default function Basic() {
  const [daily, setDaily] = useState(false);
  return (
    <div className="sy-stack">
      <CheckboxCard label="Daily backups" description="A copy of the whole database every night at 03:00, kept for 30 days." icon="shield" checked={daily} onChange={setDaily} />
      <p className="sy-text--sm sy-text--muted">{daily ? 'Adds USD 5 a month. The first backup runs tonight.' : 'Without it, backups are made once a week.'}</p>
    </div>
  );
}

Several under one question

Cards that do not exclude each other, inside a Fieldset that names the question.

Add-ons
Code
import { CheckboxCard, Fieldset } from '@sypnia/ui/react';

export default function Several() {
  return (
    <Fieldset legend="Add-ons">
      <div className="sy-grid">
        <CheckboxCard label="Point-in-time recovery" description="Go back to any second of the last 7 days." icon="clock" defaultChecked />
        <CheckboxCard label="Read replica" description="A second copy that answers queries, in another region." icon="copy" />
        <CheckboxCard label="Audit log" description="Who changed what, and when, kept for a year." icon="users" />
      </div>
    </Fieldset>
  );
}

Disabled

Off and on. A sentence beside them says why they cannot be changed.

Code
import { CheckboxCard } from '@sypnia/ui/react';

export default function States() {
  return (
    <div className="sy-stack">
      <div className="sy-grid">
        <CheckboxCard disabled label="Audit log" description="Comes with the Team plan." />
        <CheckboxCard disabled defaultChecked label="Encryption at rest" description="Always on, in every plan." icon="lock" />
      </div>
    </div>
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

Code
import type { CSSProperties } from 'react';
import { CheckboxCard, CheckboxCardSkeleton } from '@sypnia/ui/react';

// An option whose words are still loading. The skeleton has the same box as the real one, so nothing moves when the data arrives.
export default function Skeleton() {
  return (
    <div className="sy-grid" style={{ '--min': '16rem' } as CSSProperties}>
      <CheckboxCard label="Daily backups" description="Kept for 30 days." defaultChecked />
      <CheckboxCardSkeleton />
    </div>
  );
}

When to use it

Use it when

  • An option that deserves an explanation before it is ticked: an add-on, a consent, a feature with a cost.
  • A few of them side by side, when several can be on at once.

Do not use it when

  • The option is self-evident in a few words: Checkbox.
  • It applies at once instead of being saved with a form: Switch.
  • Only one of the cards can be chosen: RadioCards.

For everyone

  • It is a native checkbox inside a label: Space ticks it, and pressing anywhere on the card does too.
  • It reads the title first and then the sentence.
  • On is told by the border and tint and by the ticked box: never by colour alone.
  • Several cards about one question go inside a Fieldset, so the question is announced with each.

Props

CheckboxCardTypeDefault
labelrequired string
checked boolean
className string
defaultChecked boolean
description

What turning it on means, in a sentence.

string
disabled boolean
icon "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui"
id

Inside a Field it comes from the Field.

string
name string
onChange ((checked: boolean) => void)
value string
  1. An option with its explanation
  2. Several under one question
  3. Disabled
  4. Skeleton
  5. When to use it
  6. For everyone
  7. Props

    Search pages, sections and terms