Checkbox
이 콘텐츠는 아직 번역되지 않았습니다.
A choice that is applied later, with the form it belongs to.
The frame above shows the real web components, in the mode this site is in.
The design preview shows it next to every other web component.
When to use it
Section titled “When to use it”- For a setting that takes effect at once, use a Switch.
Example
Section titled “Example”import { Checkbox } from "@acme/ui";
<Checkbox label="Remember me" checked={remember} onChange={setRemember} />Options
Section titled “Options”The web component’s props. The other platforms take the same options under their own naming conventions.
| Prop | Type | Notes |
|---|---|---|
checked |
boolean |
Required. |
onChange |
(checked: boolean) => void |
Required. |
label |
string |
Shown beside the box. Pressing it toggles too. |
aria-label |
string |
Names the checkbox when there is no visible label. |
name |
string |
|
disabled |
boolean |
Source
Section titled “Source”| Platform | File |
|---|---|
| Web (React) | packages/ui/src/Checkbox.tsx |
| Desktop (GPUI) | crates/acme-ui/src/controls.rs |
| React Native | packages/ui-native/src/Checkbox.tsx |
| Compose Multiplatform | kotlin/ui/src/commonMain/kotlin/acme/ui/Checkbox.kt |