Skip to content

fix: [badge] apply default variants and make children optional - #922

Merged
rohanchkrabrty merged 3 commits into
mainfrom
feat/badge-variants
Oct 1, 2026
Merged

rohanchkrabrty merged 3 commits into
mainfrom
feat/badge-variants

Conversation

@rohanchkrabrty

@rohanchkrabrty rohanchkrabrty commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Move defaultVariants out of variants so CVA applies the accent and small defaults. This also removes the stray defaultVariants prop from BadgeProps.
  • Make children optional so a badge can be icon only or empty.
  • Correct the default size on the docs page to small.
  • Skip the dot and outline variants from [Badge] Fix CVA defaultVariants, support ref as prop, and add variants #598. Indicator already renders a status dot, and no design or consumer asks for an outline badge. ref already reaches the root span through ComponentProps<'span'>.

Closes #598

Move defaultVariants out of variants so CVA applies them, and drop the manual fallbacks. Make children optional. Add outline and dot boolean props.
@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
apsara Ready Ready Preview Oct 1, 2026 7:35am UTC

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ee004f8c-a243-42b9-a3a5-8e4c3da17f5d

📥 Commits

Reviewing files that changed from the base of the PR and between b6b5717 and 74b3012.

📒 Files selected for processing (1)
  • apps/www/src/content/docs/components/badge/index.mdx

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fd865c92-73d1-4c68-a296-7fe69923a2f2

📥 Commits

Reviewing files that changed from the base of the PR and between 8bf6f0d and b6b5717.

📒 Files selected for processing (2)
  • apps/www/src/content/docs/components/badge/index.mdx
  • packages/raystack/components/badge/badge.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Badge props no longer require children or explicitly declare className; both come from span props. The component removes parameter defaults for variant and size, while the badge configuration retains its default variants. The documentation now identifies small as the default size.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to b6b57

The Badge changes preserve the configured defaults, make children optional, and align the documented size default. No concrete merge risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b6b57

The reviewed Badge path renders into a span and does not show a new sensitive operation or trust-boundary crossing. The public contract change has limited apparent security impact, but coverage of other consumers is incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The identified exposure is the Badge UI contract and its consumers, rather than a newly reachable privileged operation; binding evidence for consumers outside the reviewed component is limited.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR satisfies the defaultVariants placement requirement in [#598] and makes children optional through ComponentProps<'span'>. The existing {...props} spread also preserves the ref-as-prop b… Implement the dot and outline Badge variants required by [#598]. Add or update focused automated tests and documentation when the repository's Badge test and documentation patterns require them.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The reviewed changes move CVA defaults, make Badge children optional, and correct the documented default size from regular to small. These changes directly support [#598]. No unrelated change is e…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Title check ✅ Passed The title clearly identifies the main Badge changes: applying default variants and making children optional.
Description check ✅ Passed The description accurately covers the Badge implementation changes, documentation update, omitted variants, and linked issue.
Full details: Linked Issues check

Explanation

The PR satisfies the defaultVariants placement requirement in [#598] and makes children optional through ComponentProps&lt;'span'&gt;. The existing {...props} spread also preserves the ref-as-prop behavior. However, the final Badge configuration has no dot or outline variant. These variants remain direct coding requirements in [#598].

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@raystack/apsara@922

commit: b6b5717

Indicator already renders a status dot, and no design or consumer asks for an outline badge. Drop the ref test: ref already reached the span through the props spread.
@rohanchkrabrty rohanchkrabrty changed the title feat: [badge] add outline and dot variants, fix default variants fix: [badge] apply default variants and make children optional Sep 29, 2026
Comment thread apps/www/src/content/docs/components/badge/index.mdx Outdated
Comment thread packages/raystack/components/badge/badge.tsx
@rohanchkrabrty
rohanchkrabrty merged commit 1f94920 into main Oct 1, 2026
5 of 7 checks passed
@rohanchkrabrty
rohanchkrabrty deleted the feat/badge-variants branch October 1, 2026 07:32

This branch was successfully deployed

1 active deployment
Preview — 74b3012c Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Badge] Fix CVA defaultVariants, support ref as prop, and add variants

2 participants