base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[menu] Add `data-label` attribute to menu items

Open benface opened this issue 8 months ago • 0 comments

Feature request

Summary

It could be useful for different reasons to add a data-label attribute to the element that Menu.Item (or Menu.CheckboxItem or Menu.RadioItem) renders:

  • Easily inspect how Base UI converts children into a string label (when label is not set), e.g. for debugging purposes.
  • Write custom search/filtering functionality in the menu (this is what I'm trying to do).
  • Maybe even style a specific menu item from an ancestor that doesn't control the rendering of individual items (though it would be a fragile selector).

Examples in other libraries

N/A

Motivation

See above. Thank you!

benface avatar Apr 30 '25 18:04 benface