feat(Badge): add label prop for API consistency - #709
Merged
Conversation
cixzhang
force-pushed
the
navi/feat/badge-label-prop
branch
from
March 19, 2026 02:59
f09e80f to
3e562e1
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBadge · View in Storybook
Button · View in Storybook
SideNav · View in Storybook
Table · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 2 accessibility violation(s) found — 2 serious. XDSSideNav - 1 issue(s)
Selection - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
force-pushed
the
navi/feat/badge-label-prop
branch
3 times, most recently
from
March 19, 2026 03:18
9848913 to
e055509
Compare
XDSBadge now accepts a `label` prop as the primary way to set text content, matching the pattern used by XDSButton, XDSToken, and XDSListItem. Vibe testing showed that without docs, LLMs hallucinate `label` on Badge 100% of the time because surrounding components all use `label`. With docs, they use `children` correctly — but the API shouldn't fight the ecosystem. Changes: - Add `label` prop to XDSBadge (string, optional) - `children` still works (for advanced cases like mixed icon+text) - `label` takes precedence when both are provided - Updated all usages across example apps, storybook, and doc files - Added codemod: migrate-badge-children-to-label (v0.0.5) Closes #706 Co-authored-by: Navi <navi@navibot.dev>
Co-authored-by: Navi <navi@navibot.dev>
cixzhang
force-pushed
the
navi/feat/badge-label-prop
branch
from
March 19, 2026 18:45
441fc35 to
431ebf9
Compare
josephfarina
added a commit
that referenced
this pull request
Mar 20, 2026
Badge: add label prop (new in #709) to English, Chinese, and dense docs. Section: add xstyle and padding props (xstyle new in #721) to all translations. SideNavItem: add collapsible prop (new in #680) with controlled/uncontrolled mode documentation. Updated nested items example to show collapsible usage. Found during Night Watch doc review. Co-authored-by: Navi <navi@multimango.com>
4 tasks
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
* feat(Badge): add label prop for API consistency with Button/Token XDSBadge now accepts a `label` prop as the primary way to set text content, matching the pattern used by XDSButton, XDSToken, and XDSListItem. Vibe testing showed that without docs, LLMs hallucinate `label` on Badge 100% of the time because surrounding components all use `label`. With docs, they use `children` correctly — but the API shouldn't fight the ecosystem. Changes: - Add `label` prop to XDSBadge (string, optional) - `children` still works (for advanced cases like mixed icon+text) - `label` takes precedence when both are provided - Updated all usages across example apps, storybook, and doc files - Added codemod: migrate-badge-children-to-label (v0.0.5) Closes #706 Co-authored-by: Navi <navi@users.noreply.github.com> * chore: move codemod from v0.0.5 to v0.0.6 Co-authored-by: Navi <navi@users.noreply.github.com> --------- Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
* feat(Badge): add label prop for API consistency with Button/Token XDSBadge now accepts a `label` prop as the primary way to set text content, matching the pattern used by XDSButton, XDSToken, and XDSListItem. Vibe testing showed that without docs, LLMs hallucinate `label` on Badge 100% of the time because surrounding components all use `label`. With docs, they use `children` correctly — but the API shouldn't fight the ecosystem. Changes: - Add `label` prop to XDSBadge (string, optional) - `children` still works (for advanced cases like mixed icon+text) - `label` takes precedence when both are provided - Updated all usages across example apps, storybook, and doc files - Added codemod: migrate-badge-children-to-label (v0.0.5) Closes #706 Co-authored-by: Navi <navi@users.noreply.github.com> * chore: move codemod from v0.0.5 to v0.0.6 Co-authored-by: Navi <navi@users.noreply.github.com> --------- Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
* feat(Badge): add label prop for API consistency with Button/Token XDSBadge now accepts a `label` prop as the primary way to set text content, matching the pattern used by XDSButton, XDSToken, and XDSListItem. Vibe testing showed that without docs, LLMs hallucinate `label` on Badge 100% of the time because surrounding components all use `label`. With docs, they use `children` correctly — but the API shouldn't fight the ecosystem. Changes: - Add `label` prop to XDSBadge (string, optional) - `children` still works (for advanced cases like mixed icon+text) - `label` takes precedence when both are provided - Updated all usages across example apps, storybook, and doc files - Added codemod: migrate-badge-children-to-label (v0.0.5) Closes #706 * chore: move codemod from v0.0.5 to v0.0.6 ---------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Vibe testing: LLMs write
<XDSBadge label="Active" />100% of the time without docs, because Button, Token, and ListItem all uselabel. With docs they usechildrencorrectly — but the API shouldn't fight developer expectations.children(current)label(hallucinated)Fix
Add
labelprop to XDSBadge. Both work:childrenoverrideslabelwhen both are provided.Changes
XDSBadge: newlabelprop,childrendeprecated for simple textmigrate-badge-children-to-labelin v0.0.5 transformsCloses #706