Command palette

@yasinsensoy/native

React Native · Components

Checkbox

Checkbox (16 px box, same look as web).

2 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Code

import { Checkbox } from "@yasinsensoy/native";

<Checkbox label="I accept the terms" description="I've read the privacy policy." tooltip="Press and hold on mobile" onCheckedChange={setChecked} />

Events

  1. Events appear here when you interact with the preview.

Import

import { Checkbox } from "@yasinsensoy/native";

Checkbox

component

Checkbox (16 px box, same look as web). Can be used with a label, description and error message; the touch target is at least 44 px.

Checkbox(props: CheckboxProps): JSX.Element

Examples

`<Checkbox label="I accept the terms" checked={accepted} onCheckedChange={setAccepted} />`

CheckboxProps

interface

Props of Checkbox.

NameTypeDefaultDescription
ref?Ref<ViewRef>Ref of the underlying native element.
checked?booleanChecked (controlled).
defaultChecked?booleanfalseInitially checked (uncontrolled).
onCheckedChange?(checked: boolean) => voidWhen the state changes.
indeterminate?booleanPartially selected (e.g. a "select all" box): a dash is shown.
label?ReactNodeLabel next to the box; all of it is tappable.
description?ReactNodeDescription below the label.
error?ReactNodeError message; the box is drawn in the danger color.
disabled?booleanDisabled.
name?stringName in the form. Inside Form, state, error and disabled come from the form.
accessibilityLabel?stringScreen reader label (if the label is not text).
effect?EffectPropEffect of the box ("ripple", "bounce", "pulse"…). If omitted, appearance.defaults.checkbox.effect. See BuiltinEffect.
tooltip?TooltipPropTooltip shown on press and hold. See TooltipProp.
style?StyleProp<ViewStyle>Container style.