Skip to content

[Radio] Allow to be used standalone without RadioGroup #1328

Open
@nizhnyk

Description

Feature request

Summary

Enhance the Radio component to support standalone usage without requiring it to be part of a RadioGroup. Specifically, add support for checked and onChange props. This will allow developers to manage the state of individual Radio components, enabling more flexibility for custom visual designs or use cases where RadioGroup is not needed.

Examples in other libraries

Motivation

The current implementation tightly couples the Radio component with RadioGroup, making it less versatile in scenarios where developers:

  1. Need a static representation of radio buttons for read-only or decorative purposes.
  2. Want to use the Radio component for custom designs without needing full RadioGroup functionality.
  3. Handle state or interactions independently for each Radio, such as in the case of custom forms, polls, or conditional UI.

By allowing Radio to accept checked and onChange, developers can use it more flexibly in a variety of contexts. Currently, developers building their own components on Base UI need to create two versions of Radio components: one based on the Base UI Radio for use with RadioGroup, and another that is a clone of the first to be used independently without RadioGroup. Supporting checked and onChange directly in the Base UI Radio would eliminate the need for such duplication, simplifying development and improving consistency across implementations.

Metadata

Assignees

No one assigned

    Labels

    component: radioThis is the name of the generic UI component, not the React module!status: waiting for maintainerThese issues haven't been looked at yet by a maintainer

    Projects

    • Status

      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions