Checklist
Complete a set of real tasks and see how much remains.
Live — this one is real
Usage
"use client";
import { useState } from "react";
import { Checklist } from "mizu-ui";
export function Example() {
const [items, setItems] = useState([
{ id: "types", label: "Check types", checked: true },
{
id: "browser",
label: "Review in the browser",
description: "Include a narrow screen and keyboard navigation.",
checked: false,
},
{ id: "package", label: "Install mizu-ui", checked: false },
]);
return (
<Checklist
label="Release checks"
items={items}
onChange={(id, checked) =>
setItems(items.map((i) => (i.id === id ? { ...i, checked } : i)))
}
/>
);
}
It starts with "use client" because it keeps state or passes functions to components, so it pastes into a Next.js page as it is. Other React setups ignore the directive.
Source & setup
Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with base.css, Mizu’s tokens, and the stylesheets that hold its rules. Each rule lives in one stylesheet, so components you add together never repeat CSS. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.
npx shadcn@latest add 0xuser64bit/mizu/checklistEvery component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:
import { Checklist } from "@/components/ui/mizu/checklist";For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Uses native React and CSS; install the package peers for root imports. A Client Component: its source starts with “use client”.
Inspect content/Checklist.tsx
Source is included in the npm package under src/content/Checklist.tsx.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | ChecklistItem[] | — | Stable id, label, description, checked and disabled. |
| onChange | (id: string, checked: boolean) => void | — | Persist or update each task. |
| label | string | — | Checklist legend. |
Accessibility
Native fieldset/checkboxes with linked descriptions. Count is derived from supplied state; no automatic completion.
Motion
State changes remain stable; no layout travel.