Ariakit
/

checkbox-controlled

Open preview in a new tab
Edit withViteNext.js
import { useState } from "react";
import { Checkbox } from "@ariakit/react";
import "./style.css";
export default function Example() {
const [checked, setChecked] = useState(true);
return (
<label className="label">
className="checkbox"
checked={checked}
onChange={(event) => setChecked(event.target.checked)}
/>
I have read and agree to the terms and conditions
</label>
);
}

Follow updates

Join 1,000+ subscribers and receive monthly updates with the latest improvements on Examples.

Read latest issue

No Spam. Unsubscribe at any time.