Checkbox - React
Checkbox
import { Checkbox } from '@idds/react';Contoh Penggunaan
Section titled “Contoh Penggunaan”Contoh 1
Section titled “Contoh 1”Contoh 2
Section titled “Contoh 2”| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | — | Yes | ID unik untuk input (untuk accessibility). |
label | string | — | Yes | Teks label utama. |
subtext? | string | '' | No | Teks kecil di bawah label (opsional). |
checked | boolean | — | Yes | Controlled: apakah checked. |
indeterminate? | boolean | false | No | Controlled: apakah indeterminate. |
onChange | (checked: boolean) => void | — | Yes | Callback saat di-toggle. |
disabled? | boolean | false | No | Jika true, tidak bisa diklik. |
className? | string | '' | No | Tambahan Tailwind classes. |
inputRef? | Ref<HTMLInputElement> | — | No | Ref ke `<input>` untuk indeterminate. |
invalid? | boolean | false | No | Jika true, tampilkan border merah dan state error. |