-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Field] Add focused and filled states #1324
Comments
I'm not seeing why this is "essential for creating modern, user-friendly forms"? You can do:
You also have the |
As I understand the whole purpose of having a Field component is to wrap all the elements and share the same state between them (Label, Input etc). Your suggestion will not work if I'm trying to style Label or Root component based on the state of input element (focused, filled). Of course I can use different CSS magic to style label if input is focused, but this adds complexity and in my opinion defeats the purpose of Field component. data-dirty is only assigned when the value has changed. This will not work when rendering a controlled input element with value already assigned. Additionally, this prevent migration from Material UI, old Base UI as it will require re-design of all fields making them less modern. |
Feature request
Summary
The Field component in Base UI is missing built-in support for focused and filled states, which are essential for creating modern, user-friendly forms. These states allow developers to indicate when a field is active (focused) or has content (filled), improving the user experience and consistency across applications.
Examples in other libraries
Material-UI (MUI): TextField supports these states with useFormControl hook. Documentation
Base UI v5 (Old base UI): Also had focused and filled states with FormControl
HeadlessUI: Supports focused state. Documentation
Motivation
Adding focused and filled states will:
This feature is critical for creating intuitive, modern forms and would benefit developers working on user-focused applications.
The text was updated successfully, but these errors were encountered: