Skip to content

feat: rework fontsize classes with pixels to rem - #1116

Merged
alexdln merged 8 commits into
npmx-dev:mainfrom
Sybren-crwk:feat/rework-text-size-in-pixels-to-rem
Feb 7, 2026
Merged

feat: rework fontsize classes with pixels to rem#1116
alexdln merged 8 commits into
npmx-dev:mainfrom
Sybren-crwk:feat/rework-text-size-in-pixels-to-rem

Conversation

@Sybren-crwk

Copy link
Copy Markdown
Contributor

This PR is a proposal so please feel free to give your feedback.

I noticed that there were a bunch of text fontsize classes used as text-[8px], text-[9px], text-[10px] and text-[11px].
First I wanted to change font sizes from pixels to rem for better scalability and a11y.
Then I choose the rem size of 0.625rem, which is 10px taken with base is 16px, since this was the most common used text-[*px] classes in the project.
To make it easier to use and more consistent I extended the Uno-CSS theme with a new text class text-xxs. And applied this overall in the project.

Screenshot 2026-02-06 at 23 46 16

@vercel

vercelBot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
npmx.devReadyReadyPreview, CommentFeb 7, 2026 10:24pm
2 Skipped Deployments
ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devIgnoredIgnoredPreviewFeb 7, 2026 10:24pm
npmx-lunariaIgnoredIgnoredFeb 7, 2026 10:24pm

Request Review

@coderabbitai

coderabbitaiBot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR standardises typography across multiple Vue components by replacing pixel-based utility classes (e.g. text-[10px], text-[9px], text-[11px], text-[8px]) with new utility sizes (text-2xs, text-3xs, text-4xs, text-5xs). A corresponding extension in uno.config.ts adds these text sizes with rem values. Affected files include FacetSelector, DependencyPathPopup, AccountMenu, OperationsQueue, DownloadAnalytics, Versions, VulnerabilityTree, VersionSelector, and the compare page. No changes to component logic, data flow, state management, or public APIs.

Possibly related PRs

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check nameStatusExplanation
Description check✅ PassedThe pull request description clearly explains the motivation (converting pixel-based font-size utilities to rem for better scalability and accessibility) and approach (extending Uno-CSS theme with new text size classes and replacing pixel classes across the project).

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


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

@coderabbitaicoderabbitaiBot 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
uno.config.ts (1)

43-46: Consider specifying a lineHeight alongside fontSize.

The built-in Wind4 text size tokens (e.g. xs, sm) typically define both fontSize and lineHeight to ensure consistent vertical rhythm. Omitting lineHeight here means text-xxs will inherit whatever line-height is set by the parent, which may produce inconsistent results across the various contexts where it's now used.

Also worth noting: this single 0.625rem token replaces classes that previously ranged from text-[8px] through text-[11px]. Elements that were intentionally sized at 8px or 9px will now render larger (10px-equivalent), and those at 11px will render smaller. Please confirm that collapsing these into one size is the desired visual outcome.

Suggested addition of lineHeight
 text: {
// This should add to the existing Wind4 preset text sizes
- xxs: { fontSize: '0.625rem' },+ xxs: { fontSize: '0.625rem', lineHeight: '1rem' },
},

Comment threadapp/components/LicenseDisplay.vue Outdated
Comment threadapp/components/VersionSelector.vue Outdated
@codecov

codecovBot commented Feb 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
app/components/Compare/FacetSelector.vue66.66%1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@knowlerknowler added the a11y Related to accessibility and inclusion label Feb 7, 2026
Comment threaduno.config.ts Outdated
Comment threaduno.config.ts Outdated
Comment threadapp/components/Package/Versions.vue Outdated
@danielroe

danielroe commented Feb 7, 2026

Copy link
Copy Markdown
Member

it was a deliberate decision to use px for font size, to allow browsers to scale font size separately from ui

but we probably shouldn't hard code px in the classes

@knowler

knowler commented Feb 7, 2026

Copy link
Copy Markdown
Member

@danielroe that one changed the spacing (padding/margin/gap/sizes) to be pixel based. Font size is still rem based, so this is good.

@alexdln

Copy link
Copy Markdown
Member

@danielroe there seems to be a bit of confusion here - we currently use px for spacings (paddings, margins, widths, etc.) and rem for font-sizes. In this issue, the places where the font-size was set to px (like text-[8px]) are changed to rem (an old story, I changed this in size-picker too)

Then it could have been changed to text-[0.5rem], but the author created a new class in which the size is specified in rem (what we expect for now from font-sizes)

text-[X_rem]

margin-[X_px]

@danielroe

Copy link
Copy Markdown
Member

ah - my apologies!

@alexdln

Copy link
Copy Markdown
Member

Looks great, thanks for working on it ❤️

Would you like to continue this part and as a result get rid of the smallest dimensions?

Seems like minor changes to the layout or related elements may be needed in some places, but I hope it would be a very small part

@alexdln
alexdln added this pull request to the merge queueFeb 7, 2026
Merged via the queue into npmx-dev:main with commit 281877cFeb 7, 2026
15 checks passed
@Sybren-crwk

Sybren-crwk commented Feb 7, 2026

Copy link
Copy Markdown
ContributorAuthor

Looks great, thanks for working on it ❤️

Would you like to continue this part and as a result get rid of the smallest dimensions?

Seems like minor changes to the layout or related elements may be needed in some places, but I hope it would be a very small part

@alexdln You are welcome!
I will put it on my todo list for the coming days to look into this. I assume the goal would be to move towards just2xs and maybe 3xs class and fix the layout where needed, isn't it?

@alexdln

Copy link
Copy Markdown
Member

In some places, the logic of the content structure may be lost. For example if both the text and the additional text will have the same size after update. In some places, an icon can take away attention and look visually cumbersome next to small text.

And yes, remove as much classes as possible (honestly even 12px seems crazy to me, and here it's 8px)

Would you create an issue or would you prefer that I create one?

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

Labels

a11yRelated to accessibility and inclusion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Sybren-crwk@danielroe@knowler@alexdln