Skip to content

fix(ui): update the free trial badge spacing and rendering#8712

Merged
jacekradko merged 5 commits into
mainfrom
lamone/bill-1800-fix-free-trial-badge-in-checkout-and-price-transition-modal
Jun 2, 2026
Merged

fix(ui): update the free trial badge spacing and rendering#8712
jacekradko merged 5 commits into
mainfrom
lamone/bill-1800-fix-free-trial-badge-in-checkout-and-price-transition-modal

Conversation

@l-armstrong
Copy link
Copy Markdown
Contributor

@l-armstrong l-armstrong commented Jun 1, 2026

Description

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:
Screenshot 2026-06-02 at 3 29 13 PM

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 2, 2026 6:51pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: 1573490

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the ui label Jun 1, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR updates LineItems.Title: it increases the inline gap between icon and text/badge from t.space.$1 to t.space.$2, and when a badge is present it is rendered wrapped in a Box (badge ? {badge} : null). It also adds a changeset marking @clerk/ui for a patch bump referencing a fix for free trial badge rendering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description is minimal and lacks detail. It provides no explanation of what the bug fix addresses, why the changes were made, or how to test them, though a screenshot is included suggesting a UI change. Add a detailed description explaining the rendering issue being fixed, why the specific changes (gap spacing and badge wrapping) resolve it, and provide testing steps.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately describes the main changes: fixing spacing and rendering issues for the free trial badge in the LineItems component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/ui/src/elements/LineItems.tsx (1)

116-116: Consider adding tests for this spacing change.

While the spacing adjustment looks appropriate, consider adding snapshot tests or visual regression tests to prevent unintended changes to the badge layout in the future. For styling changes like this, snapshot tests can capture the rendered structure and catch regressions.

As per coding guidelines, tests should be added to cover changes when possible.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/elements/LineItems.tsx` at line 116, Add tests that lock the
spacing change in LineItems.tsx so future regressions are caught: create a unit
snapshot test that renders the LineItems component (or the specific
Badge/line-item fragment that uses gap: t.space.$2) using your test renderer
(e.g., react-testing-library + jest) and assert the output with toMatchSnapshot,
and/or add a visual regression/storybook snapshot that captures the rendered
badge layout; reference the LineItems component and the gap: t.space.$2 style
when naming the test to make the intent obvious.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/ui/src/elements/LineItems.tsx`:
- Line 116: Add tests that lock the spacing change in LineItems.tsx so future
regressions are caught: create a unit snapshot test that renders the LineItems
component (or the specific Badge/line-item fragment that uses gap: t.space.$2)
using your test renderer (e.g., react-testing-library + jest) and assert the
output with toMatchSnapshot, and/or add a visual regression/storybook snapshot
that captures the rendered badge layout; reference the LineItems component and
the gap: t.space.$2 style when naming the test to make the intent obvious.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: b489f214-26ed-4b1a-a48c-0032398ea4b0

📥 Commits

Reviewing files that changed from the base of the PR and between 35020c3 and 523d676.

📒 Files selected for processing (1)
  • packages/ui/src/elements/LineItems.tsx

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 1, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8712

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8712

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8712

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8712

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8712

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8712

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8712

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8712

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8712

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8712

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8712

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8712

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8712

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8712

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8712

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8712

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8712

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8712

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8712

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8712

commit: 1573490

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Snapi: no API changes detected in @clerk/backend, @clerk/clerk-js, @clerk/nextjs, @clerk/react, @clerk/shared, @clerk/ui.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/ui/src/elements/LineItems.tsx (1)

127-136: ⚡ Quick win

Add a regression test for badge spacing/alignment behavior.

This change alters badge rendering structure and vertical alignment (Line 127-Line 136). Please add/adjust a UI test so spacing/alignment regressions are caught.

As per coding guidelines, "**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/elements/LineItems.tsx` around lines 127 - 136, The badge
rendering change in LineItems.tsx (the conditional that renders the Span when
the badge prop is present) can affect vertical spacing/alignment; add a UI
regression test that mounts the LineItems component with and without the badge
prop and asserts the badge is rendered as an inline-flex element with the
expected vertical spacing (margin-block: -2px) and proper alignment relative to
sibling text/avatars; target the Span wrapper (the Span element in LineItems)
and check computed style or class that ensures display:inline-flex and
marginBlock '-2px', and include a failing-case snapshot or DOM assertion so
future changes to LineItems/Span will be caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui/src/elements/LineItems.tsx`:
- Around line 128-135: The new themable wrapper Span around {badge} lacks an
elementDescriptor, so add an elementDescriptor prop to the Span (e.g.,
elementDescriptor={{ name: 'lineItemBadge' }} or using your naming convention)
so consumers can target/customize this node; update the Span usage in the
LineItems component to include that elementDescriptor and ensure the descriptor
name is documented/consistent with other elementDescriptor names in the project.

---

Nitpick comments:
In `@packages/ui/src/elements/LineItems.tsx`:
- Around line 127-136: The badge rendering change in LineItems.tsx (the
conditional that renders the Span when the badge prop is present) can affect
vertical spacing/alignment; add a UI regression test that mounts the LineItems
component with and without the badge prop and asserts the badge is rendered as
an inline-flex element with the expected vertical spacing (margin-block: -2px)
and proper alignment relative to sibling text/avatars; target the Span wrapper
(the Span element in LineItems) and check computed style or class that ensures
display:inline-flex and marginBlock '-2px', and include a failing-case snapshot
or DOM assertion so future changes to LineItems/Span will be caught.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f45c0b72-63b9-4f70-9d27-24e9f153dc0b

📥 Commits

Reviewing files that changed from the base of the PR and between 523d676 and e9747d6.

📒 Files selected for processing (1)
  • packages/ui/src/elements/LineItems.tsx

Comment thread packages/ui/src/elements/LineItems.tsx Outdated
Comment on lines +128 to +135
<Span
sx={{
display: 'inline-flex',
marginBlock: '-2px',
}}
>
{badge}
</Span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Expose the new badge wrapper through an element descriptor.

Line 128-Line 135 adds a new themable wrapper <Span>, but it has no elementDescriptor, so consumers can’t target/customize this node consistently.

Suggested change
           {badge ? (
             <Span
+              elementDescriptor={descriptors.lineItemsTitleBadge}
               sx={{
                 display: 'inline-flex',
                 marginBlock: '-2px',
               }}
             >
               {badge}
             </Span>
           ) : null}

As per coding guidelines, "Use element descriptors for all themable elements by applying elementDescriptor prop to components."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/elements/LineItems.tsx` around lines 128 - 135, The new
themable wrapper Span around {badge} lacks an elementDescriptor, so add an
elementDescriptor prop to the Span (e.g., elementDescriptor={{ name:
'lineItemBadge' }} or using your naming convention) so consumers can
target/customize this node; update the Span usage in the LineItems component to
include that elementDescriptor and ensure the descriptor name is
documented/consistent with other elementDescriptor names in the project.

Comment thread packages/ui/src/elements/LineItems.tsx Outdated
<Span localizationKey={title} />
{badge}
{badge ? (
<Span
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

instead of wrapping in a span with custom styles, I think wrapping in <Box> should fix this, since the Box will inherit the height of the flex container, and the Badge will then be allowed to shrink to its intrinsic height.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So just something like this?

{badge ? (
  <Box>
    {badge}
  </Box>
) : null}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yup!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Break Check: no API changes detected across the tracked packages.

@l-armstrong l-armstrong force-pushed the lamone/bill-1800-fix-free-trial-badge-in-checkout-and-price-transition-modal branch from 38b7aaa to efec22f Compare June 2, 2026 17:18
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/empty-spiders-happen.md:
- Line 2: Update the changeset to use a patch-level semver bump instead of a
major one: locate the line containing "'`@clerk/ui`': major" in the .changeset
file and change the value from major to patch (or minor if you intentionally
added a non-breaking feature), then save the file so the changeset reflects the
correct non-breaking bug-fix scope.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 95e1ea22-fbbc-4f46-bf6c-03ebece02ea5

📥 Commits

Reviewing files that changed from the base of the PR and between ebc9437 and efec22f.

📒 Files selected for processing (1)
  • .changeset/empty-spiders-happen.md

Comment thread .changeset/empty-spiders-happen.md Outdated
@l-armstrong l-armstrong changed the title fix: fix the free trial badge spacing and rendering fix: fix(LineItems) Jun 2, 2026
@l-armstrong l-armstrong changed the title fix: fix(LineItems) fix(ui): fix: fix the free trial badge spacing and rendering Jun 2, 2026
@l-armstrong l-armstrong changed the title fix(ui): fix: fix the free trial badge spacing and rendering fix(ui): fix the free trial badge spacing and rendering Jun 2, 2026
@l-armstrong l-armstrong changed the title fix(ui): fix the free trial badge spacing and rendering fix(ui): update the free trial badge spacing and rendering Jun 2, 2026
@l-armstrong l-armstrong changed the title fix(ui): update the free trial badge spacing and rendering fix(ui): update the free trial badge spacing and rendering Jun 2, 2026
@l-armstrong l-armstrong force-pushed the lamone/bill-1800-fix-free-trial-badge-in-checkout-and-price-transition-modal branch from 259b7f1 to 1573490 Compare June 2, 2026 18:50
) : null}
<Span localizationKey={title} />
{badge}
{badge ? <Box>{badge}</Box> : null}
Copy link
Copy Markdown
Member

@alexcarpenter alexcarpenter Jun 2, 2026

Choose a reason for hiding this comment

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

@l-armstrong why'd we add a Box wrapper here? This shouldn't be needed from my testing. We are just adding more spacing between the title and the badge?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

didn't see your comment here @alexcarpenter sry

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alexcarpenter Previously, I tried fixing an issue I noticed with the free trial badge during checkouts when testing in staging. The badge occupied more space than necessary. Initially, I tried fixing it with a span and negative margins, but it was suggested by @dstaley to use a Box wrapper instead.
Screenshot 2026-05-29 at 4 54 45 PM

@jacekradko jacekradko merged commit 03c83ba into main Jun 2, 2026
47 checks passed
@jacekradko jacekradko deleted the lamone/bill-1800-fix-free-trial-badge-in-checkout-and-price-transition-modal branch June 2, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants