Skip to content

Centered text in product buttons - #14952

Merged
oliverabrahams merged 7 commits into
mainfrom
oa/cta-center-text
Dec 9, 2025
Merged

oliverabrahams merged 7 commits into
mainfrom
oa/cta-center-text

Conversation

@oliverabrahams

@oliverabrahams oliverabrahams commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

What does this change?

Some product CTAs have long labels that occasionally wrap onto two lines. We want to keep them on one line whenever possible, but when wrapping is unavoidable they should still look good.

  1. Use CSS Property text-wrap: balance
    text-wrap: balance allows the browser to distribute the text more evenly across two lines instead of pushing a single word onto its own line. This creates a more visually balanced multi-line CTA. Chrome does a nice video showing how this works
  2. Center-align the text
    Centering the text prevents it from sitting too close to the left when wrapping occurs, which solves the “tight left edge” issue caused by reduced padding.
  3. Make the text container full width
    Allowing the text span to take up the full width of the button ensures that the text and icon align consistently across buttons.

Why?

Screenshots

Before After
before after

@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 2, 2025
@oliverabrahams oliverabrahams changed the title make text centered in product buttons Centered text in product buttons Dec 2, 2025
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Dec 2, 2025
@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown

@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 3, 2025
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Dec 3, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 8, 2025
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Dec 8, 2025
@oliverabrahams
oliverabrahams marked this pull request as ready for review December 8, 2025 16:18
@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@charleycampbell charleycampbell left a comment

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.

Such an improvement! 🚀

@oliverabrahams
oliverabrahams merged commit e506f3f into main Dec 9, 2025
30 checks passed
@oliverabrahams
oliverabrahams deleted the oa/cta-center-text branch December 9, 2025 09:49
@gu-prout

gu-prout Bot commented Dec 9, 2025

Copy link
Copy Markdown

Seen on PROD (merged by @oliverabrahams 7 minutes and 54 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants