Checkbox Controlled

PreviousNext

checkbox-controlled-demo

Docs
intentuipage

Preview

Loading preview…
components/docs/forms/checkbox/checkbox-controlled-demo.tsx
"use client"

import { useState } from "react"

import { Checkbox } from "@/components/ui/checkbox"
import { Description } from "@/components/ui/field"

export default function CheckboxControlledDemo() {
  const [selected, setSelection] = useState(false)
  return (
    <>
      <Checkbox isSelected={selected} onChange={setSelection} value="updates">
        Receive Updates
      </Checkbox>
      <Description className="mt-2 block [&>strong]:text-fg">
        You have <strong>{selected ? "enabled" : "disabled"}</strong> the option.
      </Description>
    </>
  )
}

Installation

npx shadcn@latest add @intentui/checkbox-controlled-demo

Usage

Usage varies by registry entry. Refer to the registry docs or source files below for details.