Skip to content

refactor(fluid-type): container-based (cqi) instead of viewport (vw) - #280

Merged
tbielich merged 1 commit into
mainfrom
refactor/fluid-type-container
Aug 24, 2026
Merged

tbielich merged 1 commit into
mainfrom
refactor/fluid-type-container

Conversation

@tbielich

Copy link
Copy Markdown
Owner

Fluid typography now uses cqi (container query inline) units instead of vw.

Why: viewport-based fluid type breaks in multi-column layouts — a heading in a narrow sidebar would be the same size as in the main content area. Container-based scaling fixes this.

Changes:

  • fluid-transform.js: vw → cqi, viewport bounds → container bounds
  • tokens.config.json: containerMin=320, containerMax=1200
  • Generated output: clamp(1.75rem, 1.48rem + 1.36cqi, 2.5rem)
  • Docs: explains container-type: inline-size requirement

Requires: container-type: inline-size on a content ancestor.

Fluid typography now scales relative to its container width instead of
the viewport. This ensures correct sizing in multi-column layouts,
sidebars, and cards — a heading in a narrow column gets appropriately
smaller type regardless of the viewport size.

Changes:
- fluid-transform.js: vw → cqi, viewportMin/Max → containerMin/Max
- tokens.config.json: containerMin=320, containerMax=1200
- Generated tokens: clamp(...cqi...) instead of clamp(...vw...)
- Docs updated: explains container-type requirement and rationale

Requires: container-type: inline-size on an ancestor element.
@tbielich
tbielich merged commit 65fc910 into main Aug 24, 2026
2 checks passed
@netlify

netlify Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for ui-foundations ready!

Name Link
🔨 Latest commit 780da81
🔍 Latest deploy log https://app.netlify.com/projects/ui-foundations/deploys/6a8c59cd3c00a30008bece6b
😎 Deploy Preview https://deploy-preview-280--ui-foundations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant