About
A checkbox input with support for an indeterminate "mixed" state, an optional hint line, and disabled state — ported from the ngx-aurora-ui Angular library's au-checkbox by Konica Maheshwari (MIT).
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Checkbox to your project and fits it to your theme.
Code
How Checkbox is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import Checkbox from "@/components/ui/checkbox";
import * as React from "react";
export default function CheckboxDemo() {
const [items, setItems] = React.useState([
{ label: "Mentions", checked: true },
{ label: "Replies", checked: false },
{ label: "Weekly digest", checked: false },
]);
const checkedCount = items.filter((i) => i.checked).length;
const allState =
checkedCount === 0
? "none"
: checkedCount === items.length
? "all"
: "some";
function toggle(index, checked) {
setItems((list) =>
list.map((item, i) => (i === index ? { ...item, checked } : item)),
);
}
function setAll(checked) {
setItems((list) => list.map((item) => ({ ...item, checked })));
}
return (
<div className="w-full max-w-sm rounded-lg border p-4">
<fieldset className="m-0 border-0 flex flex-col gap-3">
<legend className="px-1 text-sm font-medium">Notifications</legend>
<Checkbox
checked={allState === "all"}
indeterminate={allState === "some"}
onCheckedChange={setAll}
>
All notifications
</Checkbox>
<div className="flex flex-col gap-2.5 pl-7">
{items.map((item, i) => (
<Checkbox
key={item.label}
checked={item.checked}
onCheckedChange={(v) => toggle(i, v)}
>
{item.label}
</Checkbox>
))}
</div>
</fieldset>
</div>
);
}













