Skip to content

feat(client): power AutoFitText with fitty#2658

Merged
antfu merged 1 commit into
slidevjs:mainfrom
antfubot:feat/autofit-text-fitty
Jul 3, 2026
Merged

feat(client): power AutoFitText with fitty#2658
antfu merged 1 commit into
slidevjs:mainfrom
antfubot:feat/autofit-text-fitty

Conversation

@antfubot

@antfubot antfubot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the hand-rolled font-size fitting logic in the <AutoFitText> built-in component with fitty, a small zero-dependency library dedicated to snugly resizing text to fit its parent.

  • Same public API as before: modelValue/v-model, min, max, and the default slot
  • New multiLine prop (default true, matching the previous wrap-at-min-size behavior)
  • Refits automatically on content mutations, window resizes, container resizes, and once web fonts finish loading
  • Works around a fitty limitation where initializing on a hidden element (as happens on Slidev's preloaded adjacent slides) permanently poisons its internal state — the component reinitializes fitty when the container becomes visible
  • Drops the "Experimental" flag and updates the docs accordingly

Verified with a live deck via Cypress: fitting up to max, clamping to min with wrapping, multiLine: false never wrapping, slot content, and the preloaded-slide navigation path.


This PR was created with the help of an agent.

@netlify

netlify Bot commented Jul 3, 2026

Copy link
Copy Markdown

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit da5b1ed
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6a473f7028b0c5000813edfd
😎 Deploy Preview https://deploy-preview-2658--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@antfu
antfu merged commit 351b2e7 into slidevjs:main Jul 3, 2026
4 checks passed
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.

2 participants