Checkbox
const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<CheckboxHandle>>;Toggle checkbox with label. Activated via Space or Enter.
Example
Section titled “Example”const [agreed, setAgreed] = useState(false);
<Checkbox checked={agreed} onChange={setAgreed} label="I agree to the terms" focusedStyle={{ bg: "cyan", color: "black" }}/>Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
checked | boolean | Whether the checkbox is checked |
checkedChar? | string | Custom character for checked state (default: ”✓”) |
disabled? | boolean | Whether the checkbox is disabled |
focusedStyle? | Style | Style when focused |
label? | string | Label text displayed next to the checkbox |
onChange | (checked) => void | Called when the checkbox is toggled |
style? | Style | Style for the checkbox container |
uncheckedChar? | string | Custom character for unchecked state (default: ” “) |
CheckboxHandle
Section titled “CheckboxHandle”Handle for Checkbox — exposes checked state
Extends
Section titled “Extends”Methods
Section titled “Methods”blur()
Section titled “blur()”blur(): void;Programmatically blur (unfocus) this element
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”focus()
Section titled “focus()”focus(): void;Programmatically focus this element
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”scrollIntoView()
Section titled “scrollIntoView()”scrollIntoView(options?): void;Scroll the nearest parent ScrollView to make this element visible.
Behaves like the DOM Element.scrollIntoView() method.
No-op if the element is not inside a ScrollView.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | ScrollIntoViewOptions | Alignment options (default: { block: "nearest" }) |
Returns
Section titled “Returns”void
Example
Section titled “Example”const inputRef = useRef<InputHandle>(null);
// Minimal scroll — just enough to make it visibleinputRef.current?.scrollIntoView();
// Center the element in the viewportinputRef.current?.scrollIntoView({ block: "center" });Inherited from
Section titled “Inherited from”FocusableHandle.scrollIntoView
Properties
Section titled “Properties”| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
checked | readonly | boolean | Whether the checkbox is currently checked | - |
isFocused | readonly | boolean | Whether this element is currently focused | FocusableHandle.isFocused |