For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/ui/components/checkbox.md.
lynx-ui logo
lynx-ui
  • English
  • Checkbox

    A headless Checkbox component for ReactLynx. It supports controlled/uncontrolled checked state and indeterminate mode.
    Info

    You can check the source code to understand how it works, and you're welcome to submit PRs to enhance its capabilities.

    Basic Usage

    The most basic usage of the <Checkbox>

    Examples

    Indeterminate State

    The indeterminate state is used when a <Checkbox> represents a group of options where some, but not all, are selected

    Structure

    <Checkbox>
      <CheckboxIndicator />
    </Checkbox>

    Component API

    Checkbox

    checkboxPropsiOSAndroid
    TypeViewProps
    Checkbox supports original view props to be directly spread in this prop.
    checkediOSAndroid
    Typeboolean
    Whether the Checkbox is checked. If this property is set, the Checkbox will be in controlled mode, meaning the defaultChecked property will take no effects.
    classNameiOSAndroidHarmony
    Typestring
    className
    defaultCheckediOSAndroid
    Typeboolean·Defaultfalse
    Determines whether the Checkbox is checked by default. Use this property means the Checkbox is uncontrolled.
    disablediOSAndroid
    Typeboolean·Defaultfalse
    Disables the Checkbox. The Checkbox cannot be interacted with.
    indeterminateiOSAndroid
    Typeboolean·Defaultfalse
    The indeterminate state of the Checkbox.
    onChangeiOSAndroid
    Type(checked: boolean) => void
    The callback function that is triggered when the state changes
    styleiOSAndroidHarmony
    TypeCSSProperties
    style
    childreniOSAndroid
    TypeReactNode | ((status: { checked: boolean; indeterminate: boolean; active: boolean; disabled: boolean }) => ReactNode)
    children

    State-based styling & rendering

    This component exposes runtime states through one or both of the following channels. The table lists only the channels available for each state:

    • UI variant class — when supported, a class like ui-<state> is toggled on the corresponding component node for selectors such as .ui-<state> { ... }.
    • Render-prop field — when supported and children is a function, the state is passed in via children({ <state>: boolean, ... }) for runtime-driven rendering.

    UI variants applied by Checkbox based on its render state.

    Class NameRender PropTypeDescription
    ui-activeactivebooleanWhether the checkbox is currently being pressed (and not disabled). Applied when `status.active` is true.
    ui-checkedcheckedbooleanWhether the checkbox is currently checked. Applied when `status.checked` is true.
    ui-disableddisabledbooleanWhether the checkbox is disabled. Applied when `status.disabled` is true.
    ui-indeterminateindeterminatebooleanWhether the checkbox is in an indeterminate state. Applied when `status.indeterminate` is true.

    CheckboxIndicator

    childreniOSAndroid
    TypeReactNode
    The indicator of the Checkbox. Only displays child nodes when checked or indeterminate is true. If you need to keep it displayed when checked or indeterminate is false, set forceMount to true.
    classNameiOSAndroidHarmony
    Typestring
    className
    forceMountiOSAndroid
    Typeboolean·Defaultfalse
    Force mount the children. If set to true, the children will always be mounted even when checked or indeterminate is false.
    styleiOSAndroidHarmony
    TypeCSSProperties
    style

    UI variants applied by CheckboxIndicator.

    Class NameDescription
    ui-activeWhether the checkbox is currently being pressed (and not disabled). Applied when `status.active` is true.
    ui-checkedWhether the checkbox is currently checked. Applied when `status.checked` is true.
    ui-disabledWhether the checkbox is disabled. Applied when `status.disabled` is true.
    ui-indeterminateWhether the checkbox is in an indeterminate state. Applied when `status.indeterminate` is true.
    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.