Skip to content

Comments

[poc] Label component#4126

Draft
atomiks wants to merge 1 commit intomui:masterfrom
atomiks:codex/standalone-label-demos
Draft

[poc] Label component#4126
atomiks wants to merge 1 commit intomui:masterfrom
atomiks:codex/standalone-label-demos

Conversation

@atomiks
Copy link
Contributor

@atomiks atomiks commented Feb 18, 2026

Closes #4122

Preview: https://deploy-preview-4126--base-ui.netlify.app/react/components/label


Not all SRs support an enclosing native <label> around a non-form (<span>) control. Therefore the demos either need to use aria-labelledby or a custom render function to render a label-wrapped <button> with nativeButton.

This component provides aria-labelledby automatically (same as Field.Label) to ensure the accessible name works broadly while supporting enclosing labels without invalid HTML. This also separates Field validation from labeling when controls need a basic label (especially Select/Combobox demos) where the native <label> has some undesirable defaults. We can neatly use this in all form control demos that need a lightweight label instead of using Field.


This also adds a new useAriaLabelledby hook as a fallback for the sibling pattern without nativeButton, since it was common in Radix:

<label htmlFor="id" />
<Checkbox.Root id="id" />

@atomiks atomiks added the poc label Feb 18, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 18, 2026

commit: 85d0390

@mui-bot
Copy link

mui-bot commented Feb 18, 2026

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+1.32KB(+0.29%) 🔺+410B(+0.28%)

Details of bundle changes


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

@netlify
Copy link

netlify bot commented Feb 18, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 85d0390
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69970e9224720000080e1dbb
😎 Deploy Preview https://deploy-preview-4126--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 codex/standalone-label-demos branch 19 times, most recently from 8cad473 to 0b3e981 Compare February 19, 2026 13:09
@atomiks atomiks force-pushed the codex/standalone-label-demos branch from 0b3e981 to 85d0390 Compare February 19, 2026 13:22
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

poc PR: out-of-date The pull request has merge conflicts and can't be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radio.Root, Checkbox.Root, and Switch.Root do not receive an accessible name from a wrapping <label> element

2 participants