Skip to content

Conversation

@liuliu-dev
Copy link
Contributor

@liuliu-dev liuliu-dev commented Nov 7, 2025

Fixes multiple styling issues in the Token component to match Figma design.

Closes #5387

Changelog

Changed

  • Large variant: Updated font size from --text-body-size-small to --text-body-size-medium
  • XLarge variant: Changed horizontal padding from 16px to 12px (left and right)
  • Large variant: Updated close icon size from 12px to 16px to match Xlarge variant
  • Medium variant: Reduced horizontal padding from 8px to 4px (left and right)
  • Small variant: Disabled leadingVisual support (now only renders when size is not 'small')
  • Selected state: Added missing darker outline (border-style: solid and border-color: var(--borderColor-emphasis))

Rollout strategy

  • Patch release

Testing & Reviewing

Merge checklist

@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2025

🦋 Changeset detected

Latest commit: bba3edb

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

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

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 integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 7, 2025 21:43 Inactive
@liuliu-dev liuliu-dev added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 7, 2025
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 7, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 7, 2025 22:04 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 7, 2025 22:13 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 7, 2025 22:23 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 7, 2025 22:32 Inactive
@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Nov 7, 2025
@liuliu-dev liuliu-dev marked this pull request as ready for review November 7, 2025 23:11
@liuliu-dev liuliu-dev requested review from a team as code owners November 7, 2025 23:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses multiple styling issues in the Token component, focusing on size-specific adjustments for icon sizing, padding, font sizes, and visual treatment of selected tokens. The changes also prevent the leading visual from rendering when the token size is 'small'.

  • Adjusted remove button icon size to use 16px for 'large' and 'xlarge' sizes (previously all three non-small sizes used 12px)
  • Updated padding values for 'medium' and 'xlarge' token sizes
  • Changed font size for 'large' tokens from small to medium
  • Added border styling for selected tokens
  • Disabled leading visual rendering for 'small' tokens

Reviewed Changes

Copilot reviewed 6 out of 150 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react/src/Token/_RemoveTokenButton.tsx Updated icon size logic to use 16px for 'large' and 'xlarge' tokens
packages/react/src/Token/TokenBase.module.css Adjusted padding for 'medium' and 'xlarge' sizes, updated font size for 'large'
packages/react/src/Token/Token.tsx Added comment and conditional logic to prevent leading visual on 'small' tokens
packages/react/src/Token/Token.module.css Added border styling for selected tokens
.playwright/snapshots/**/*.png Updated visual regression test snapshots
.changeset/cuddly-worms-knock.md Added changeset for patch release

@lukasoppermann
Copy link
Contributor

Hey @liuliu-dev,

sorry, we need a little change:

  1. Please change the horizontal padding for the medium variant to 6px using --base-size-6
  2. Please reduce the margin left and right for leading and trailing visuals and actions to
  • variant=large--base-size-6
  • variant-xlarge--base-size-6
  • variant=medium → keep the current value (4)

@lukasoppermann
Copy link
Contributor

@liuliu-dev Nitpick, but could you please set the following storybook properties to false in the playground story?

  • leadingVisual
  • onRemove
  • onClick

This will make it nicer for users:

Before After
CleanShot 2025-11-10 at 12 06 22@2x CleanShot 2025-11-10 at 12 06 37@2x

Just to clarify, this is NOT a bug or something you introduced, but since we are touching the component we may use the opportunity to improve this. 🙏

@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 10, 2025 22:26 Inactive
@liuliu-dev liuliu-dev added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 10, 2025
@github-actions github-actions bot added integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm and removed update snapshots 🤖 Command that updates VRT snapshots on the pull request integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Nov 10, 2025
@github-actions
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions github-actions bot removed the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 10, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7165 November 10, 2025 22:52 Inactive
@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/6646

@primer-integration
Copy link

🟢 ci completed with status success.

@liuliu-dev
Copy link
Contributor Author

Hey @lukasoppermann , I've updated the padding/margin, and the storybook. You can view it here:
https://primer-1c328e7a49-13348165.drafts.github.io/storybook/?path=/story/components-token--playground

Copy link
Contributor

@lukasoppermann lukasoppermann left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you. 🚀

Copy link
Member

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

LGTM! Left feedback, but non-blocking!

export interface TokenProps extends TokenBaseProps {
/**
* A component that renders before the token text
* disabled when size is 'small'
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that any tokens using leading visuals and have a size of "small" will no longer render the leading visual?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that’s correct! as requested in the issue:
"small variant of the token should use not allow for leadingVisuals"

@@ -0,0 +1,5 @@
---
'@primer/react': patch
Copy link
Member

Choose a reason for hiding this comment

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

Depending on my last comment, maybe this is worth a minor? But let me know what you think! 😁

@liuliu-dev liuliu-dev added this pull request to the merge queue Nov 14, 2025
@liuliu-dev liuliu-dev removed this pull request from the merge queue due to a manual request Nov 14, 2025
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 14, 2025
@github-actions
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@liuliu-dev liuliu-dev added this pull request to the merge queue Nov 14, 2025
Merged via the queue into main with commit f2ba02a Nov 14, 2025
49 checks passed
@liuliu-dev liuliu-dev deleted the liuliu/token-fixes branch November 14, 2025 17:38
@primer primer bot mentioned this pull request Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants