Checkbox
Checkbox uses checked and onCheckedChange to expose a controlled boolean state, with an optional indeterminate presentation.
Practical React example
Record an explicit opt-in choice with a persistent visible label.
Before you copy and paste
Keep the example in the React rendering environment required by the imported component. Copy components/motion/checkbox.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: clsx, motion, react, tailwind-merge.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Record an explicit opt-in choice with a persistent visible label
// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";
import { useState } from "react";
import { Checkbox } from "@/components/motion/checkbox";
export function CheckboxPreview() {
const [terms, setTerms] = useState(true);
const [updates, setUpdates] = useState(false);
return (
<div className="flex flex-col gap-3">
<Checkbox
checked={terms}
onCheckedChange={setTerms}
label="Accept terms and conditions"
/>
<Checkbox
checked={updates}
onCheckedChange={setUpdates}
label="Email me product updates"
/>
<Checkbox checked indeterminate onCheckedChange={() => {}} label="Select all (partial)" />
<Checkbox checked disabled onCheckedChange={() => {}} label="Disabled" />
</div>
);
}
Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.
Treat indeterminate as a mixed-state presentation for grouped items, not as an extra saved boolean. Store the actual child selections when building a select-all control.
Customization
- CheckboxProps.checked
- Required; boolean.
- CheckboxProps.onCheckedChange
- Required; (checked: boolean) => void.
- CheckboxProps.disabled
- Optional; boolean.
- CheckboxProps.indeterminate
- Optional; boolean.
- CheckboxProps.label
- Optional; string.
- CheckboxProps.className
- Optional; string.
- CheckboxProps.id
- Optional; string.
- CheckboxProps."aria-label"
- Optional; string.
- CheckboxProps."aria-describedby"
- Optional; string. Associates an external message (e.g. a form error) with the control.
Integration notes
- Associate validation text through aria-describedby when appropriate.
- Do not infer consent from a preselected or merely displayed checkbox; the application owns the consent record.
Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.