Ariakit
/

checkbox-controlled

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>
);
}

Stay tuned

Join 1,000+ subscribers and receive monthly tips & updates on new Ariakit content.

No spam. Unsubscribe anytime. Read latest issue