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/radio-group.md.
lynx-ui logo
lynx-ui
  • English
  • RadioGroup

    A headless RadioGroup component for ReactLynx. It manages single-selection state across a group of radio buttons.
    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

    Examples

    Disabled

    RadioGroup supports disabling the entire group or individual options.

    Structure

    <RadioGroupRoot>
      <Radio>
        <RadioIndicator />
      </Radio>
    </RadioGroupRoot>

    Component API

    RadioGroupRoot

    The root component of the RadioGroup, containing all of its child components.

    defaultValueiOSAndroidHarmony
    Typestring
    If the Radio is initially selected with certain value. Use this property means the RadioGroup is uncontrolled. If the value matches none of the Radio's value, the RadioGroup will be unselected.
    disablediOSAndroidHarmony
    Typeboolean·Defaultfalse
    If set to true, the RadioGroup can not accept interactions.
    onValueChangeiOSAndroidHarmony
    Type(value: string) => void
    Send when selected value changed
    valueiOSAndroidHarmony
    Typestring
    Control the selected value of the RadioGroup. Use this property means the RadioGroup is controlled. If the value matches none of the Radio's value, the RadioGroup will be unselected.
    childreniOSAndroidHarmony
    TypeReactNode | ((state: { value: string | null; 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.

    RadioGroupRoot exposes the following render prop states.

    Render PropTypeDescription
    valuestring | nullThe current selected value of the RadioGroup.
    disabledbooleanWhether the RadioGroup is disabled.

    Radio

    The item inside RadioGroup.

    childreniOSAndroidHarmony
    TypeReactNode
    children
    classNameiOSAndroidHarmony
    Typestring
    className
    disablediOSAndroidHarmony
    Typeboolean
    Disable this Radio. If set to true, this single Radio can not accept interactions.
    radioPropsiOSAndroid
    TypeViewProps
    Radio supports original view props to be directly spread in this prop.
    styleiOSAndroidHarmony
    TypeCSSProperties
    style
    valueiOSAndroidHarmony
    Typestring
    The identifier of this Radio

    UI variants applied by Radio.

    Class NameDescription
    ui-activeApplied while the Radio is pressed and not disabled.
    ui-checkedApplied when the Radio is checked.
    ui-disabledApplied when the Radio is disabled.

    RadioIndicator

    The check slot indicating this Radio is now selected. Normally a circle. It's children will only be rendered when selected so it can be a custom inner selected indicator. Can be a ReactNode or a render function returns a ReactNode.

    childreniOSAndroidHarmony
    TypeReactNode
    children.
    classNameiOSAndroidHarmony
    Typestring
    className
    forceMountiOSAndroid
    Typeboolean·Defaultfalse
    Force mount the children. If set to true, the children will always be mounted even when checked is false.
    styleiOSAndroidHarmony
    TypeCSSProperties
    style

    UI variants applied by RadioIndicator.

    Class NameDescription
    ui-activeApplied while the Radio is pressed and not disabled.
    ui-checkedApplied when the Radio is checked.
    ui-disabledApplied when the Radio is disabled.
    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.