Skip to content

[all components] Decide on a common generic value type #1076

Open

Description

@vladmoroz

Current situation:

value: any

  • Select
  • Menu Radio
  • Menu Radio Group
  • Toggle Group
  • Tabs

value: unknown

  • Field (in validate callback)
  • Radio
  • Radio Group

value: string

  • Toggle Group
  • Select.Value (in children render function)

My preferences/suggestions:

  • We can't use unknown because it comes with a difficult DX
  • any is OK but might be a footgun with non-primitive values causing unexpected rerenders due to different references. I could go either way though as it's more powerful too.
    • Any potential issues with non-primitive values in forms?
  • Toggle needs to align with whatever everything else is using
  • Select.Value needs to use the actual value type for the children render function

Search keywords:

Activity

  1. added
    breaking change
    on Dec 12, 2024
  2. changed the title [-]Decide on a common generic value type[/-] [+]Decide on a common generic `value` type[/+] on Dec 12, 2024
  3. cgatian commented on May 22, 2025

    @cgatian
    Contributor

    I'm a consumer of Base UI here. I've discovered that many of the value props cannot be typed. It would be ideal if some props could take a generic T to specify the type.

  4. mj12albert commented on May 28, 2025

    @mj12albert
    Member

    @cgatian Thanks for using Base UI ~ could you share a bit more about use-cases where this is an issue for you and which components?

  5. added
    scope: all components
    on Aug 10, 2025
  6. matthewmorek commented on Sep 29, 2025

    @matthewmorek

    This is a problem when implementing components, such as RadioGroup, especially when using onValueChange, which ends up with a following TypeScript error, and cannot be side-stepped.

    Image
  7. mj12albert commented on Sep 29, 2025

    @mj12albert
    Member

    For RadioGroup we could change it from unknown to string to match Checkbox(Group)

  8. added this to the v1.0.0 milestone on Oct 22, 2025
  9. benface commented on Dec 19, 2025

    @benface

    I was hoping you would do the other way around @mj12albert, i.e. support non-string values in Checkbox(Group). 🫠

  10. atomiks commented on Dec 19, 2025

    @atomiks
    Contributor

    The type for RadioGroup (until there are generics for all values) should at least be any, which matches Menu.RadioGroup, not unknown.

  11. changed the title [-]Decide on a common generic `value` type[/-] [+][all components] Decide on a common generic `value` type[/+] on Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changescope: all components

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions