Skip to content

[select] add "value" and other state to SelectValue.State #2010

@literalpie

Description

@literalpie

Feature request

Summary

In the Select.Value component, I would like a way to change my className or render values based on the current value of the component. Now, the only way to do that would be to make it a controlled component because SelectValue.State has nothing in it.

Examples in other libraries

The concept of passing state to class/render callbacks is unique to Base UI as far as I know. SliderRoot.State and NumberFieldRoot.State are examples of components that have value in the state that's provided to callbacks.

Motivation

We would like to have the text of our Value component be a "dim" color if it is displaying placeholder text, but a normal color when a value is selected.

I also expect there will be a need for the Value to display more than just the text content of the selected Item (for example, showing an icon)

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: selectChanges related to the select component.

    Projects

    Status

    Recently completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions