Skip to content

Conversation

@atomiks
Copy link
Contributor

@atomiks atomiks commented Dec 24, 2025

When a null item isn't rendered in the list, placeholder acts as a typical placeholder, though it cannot be cleared.

Issues when trying to use a native <label>, which prompted the demos to use Field:

  • Clicking a <label> opens the popup, but this doesn't match native <select> behavior. Trying to workaround this is quite expensive and heavy-handed. On the other hand, <Field.Label> links to the hidden input and only gives focus to the trigger and matches native behavior.
  • Hovering the label activates .Trigger:hover, which unlike Checkbox/Radio, doesn't really look or feel right. <Field.Label> also avoids this.

Select: https://deploy-preview-3604--base-ui.netlify.app/react/components/select
Combobox: https://deploy-preview-3604--base-ui.netlify.app/react/components/combobox#input-inside-popup

Closes #3720

@atomiks atomiks added component: select Changes related to the select component. type: new feature Expand the scope of the product to solve a new problem. component: combobox Changes related to the combobox component. labels Dec 24, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 24, 2025

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@3604
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3604
    

commit: b0470ed

@mui-bot
Copy link

mui-bot commented Dec 24, 2025

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+822B(+0.20%) 🔺+306B(+0.23%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit b0470ed
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6965e1a83d5a170008d87b64
😎 Deploy Preview https://deploy-preview-3604--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch from b95e935 to ee223c0 Compare December 24, 2025 02:37
@atomiks atomiks marked this pull request as ready for review December 24, 2025 02:44
@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch 2 times, most recently from c8029dd to 5e4fa02 Compare December 24, 2025 08:39
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks good, left few comments/questions to be resolved before merging.

<Combobox.Positioner>
<Combobox.Popup>
<Combobox.List>
<Combobox.Item value={null}>None</Combobox.Item>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this even valid? I mean having items array that difference than the Combobox Items rendered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically yes, this pattern is currently half-broken but is specified throughout the tests. This PR gives it full support: #3594

const items = useStore(store, selectors.items);
const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
const serializedValue = useStore(store, selectors.serializedValue);
const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of repetition here and in the combobox, does it makes sense to extract this in a usePlaceholder hook, or is it too much of an abstraction considering we use different stores? 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "rule of three" for DRY works here and this is only 2 separate places

@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch 3 times, most recently from c62352e to b0baa48 Compare December 28, 2025 07:44
@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch 4 times, most recently from d017b70 to 951c7ab Compare December 30, 2025 11:35
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jan 9, 2026
@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch from 951c7ab to ebf30a7 Compare January 12, 2026 03:14
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jan 12, 2026
@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch 3 times, most recently from 6b426fd to 0c14c90 Compare January 13, 2026 06:08
@atomiks atomiks force-pushed the feat/combobox-select-placeholder branch from 0c14c90 to b0470ed Compare January 13, 2026 06:09
@atomiks atomiks merged commit 8c13aa9 into mui:master Jan 13, 2026
23 checks passed
@atomiks atomiks deleted the feat/combobox-select-placeholder branch January 13, 2026 06:14
atomiks added a commit to atomiks/base-ui that referenced this pull request Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: combobox Changes related to the combobox component. component: select Changes related to the select component. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<Select.Value /> placeholder

3 participants