Skip to content

docs: replace motion-v with CSS and remove it - #7432

Merged
benjamincanac merged 5 commits into
v5from
perf/docs-drop-motion-v-entry
Nov 18, 2026
Merged

benjamincanac merged 5 commits into
v5from
perf/docs-drop-motion-v-entry

Conversation

@atinux

@atinux atinux commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Written by an AI agent on behalf of @atinux.

🔗 Linked issue

Same change as nuxt/nuxt.com#2656 (the motion-v part).

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

On the docs, two things in the header pulled motion-v into the entry chunk, so every page loaded it: the mobile menu toggle (HeaderToggleButton) and the Nuxi icon in the Ask button (useNuxiIcon). The "Inspect theme slots" icon (ComponentThemeVisualizerIcon) also loaded it on every component page, as a 136 KB chunk (44 KB gzip). None of them needs a full animation library.

What changed

  • HeaderToggleButton.vue: the three <motion.line> became plain <line> with CSS transitions on translate, rotate and opacity. The overshoot curve cubic-bezier(0.34, 1.56, 0.64, 1) stands in for the old spring. UHeader renders a second toggle inside its open menu, so the toggle draws itself closed for its first frame and then animates into the X instead of popping in.

  • useNuxiIcon.ts: useAnimate() is replaced by a small animate() with the same call shape, built on the Web Animations API. The easter eggs (hi, nuxi, spin, flip, wobble, dizzy) keep their keyframes and easings unchanged.

  • ComponentThemeVisualizerIcon.vue: the eye blink and the eye-to-X morph are CSS keyframes and transitions in a scoped <style>, with the same durations, easings and delays. The open state is a data-open attribute on the <svg>. The blink stops under prefers-reduced-motion.

  • embla-carousel.svg: the custom icon was one path of thousands of tiny segments (13.4 KB). It's re-traced from a 2048px render with potrace and run through SVGO, now 4.2 KB with the same gradient. Every custom icon ends up in Nuxt Icon's client bundle, which the browser fetches on every page once it's idle, so this takes 9 KB out of it.

@benjamincanac's commit removes motion-v from the docs entirely, including the animated toggle example on the Header page.

Evidence

Two nuxt build runs of docs/ on the same orb (4 vCPU): v5 (142435a) before the change, this branch after. I walked the static imports from the entry script in .output/public/index.html and checked each chunk for motion's code (the transformPerspective string). One run each. The JS that / and /docs/getting-started load up front is the same set on both pages.

v5 This PR
Entry chunk 412.9 KB (127.4 KB gzip) 262.9 KB (78.1 KB gzip)
Static JS on load (136 chunks) 1,014.0 KB (353.0 KB gzip) 864.0 KB (303.7 KB gzip)
motion-v in the entry yes no

I checked the production build (node .output/server/index.mjs) in Chromium:

  • 390px wide, menu open: both toggles (header and menu) compute translate: 0px 6px; rotate: 45deg, opacity: 0, and 0px -6px; -45deg. After Escape they go back to none.
  • 1280px wide: typing spin rotates Nuxi (sampled at 274deg mid-way) and it ends at rotate: 0deg; scale: 1. flip samples went from -17px through -50px and 360deg back to 0px / 0deg / 1 (checked on the v4 build before the rebase).

The screenshots and recording below are from the v4 build; on v5 the open toggles compute the same values and the X looks the same.

Menu open (390px) Toggle open → close
Menu open Toggle frames at 20fps

Recording of the toggle opening and closing (390px):

toggle.webm

Theme slots icon

On this PR's Vercel preview, Lighthouse's network list for /docs/components/button (20 theme slots buttons) has 374 scripts and none of them contains motion's code. Before this commit, the same page loaded the 136 KB motion chunk.

Checked in the dev server, 900px wide so the button shows without hover: closed, the lines compute scale: 0; opacity: 0 and the eye blinks (scaleY sampled at 0.80 and 0.19); open, the lines compute rotate: ±45deg; scale: 1 and the eye and pupil scale: 0; opacity: 0; closing again brings the eye back.

Closed Mid-blink Open
Closed Mid-blink Open

Recording of opening and closing it:

visualizer.webm

Embla Carousel icon

The old and new icon rendered at 1024px in Chromium differ by a PSNR of 49 dB, which is not visible, and at 24px and 48px they look the same. On the Carousel page in the dev server the icon still renders with the blue to purple gradient.

Old New
Old icon New icon

Lint and nuxt typecheck in docs/ pass.

Lighthouse

Lighthouse 13.6.0 with its default mobile profile (simulated throttling), run from a 4 vCPU Linux sandbox against ui.nuxt.com (v4), the v5 branch preview and this PR's preview. Each cell is the median of 3 runs, which alternated between the three sites. v5 is the baseline for this PR.

Page Metric ui.nuxt.com v5 This PR
/ Performance score 70 69 69
Scripts transferred 505 KB 527 KB 475 KB
Unused JavaScript 556 KB 564 KB 531 KB
Total Blocking Time 2,380 ms 3,114 ms 2,536 ms
/docs/getting-started Performance score 72 70 70
Scripts transferred 517 KB 524 KB 472 KB
Unused JavaScript 299 KB 301 KB 269 KB
Total Blocking Time 1,849 ms 2,357 ms 2,112 ms
  • About 52 KB less JavaScript is transferred, and unused JavaScript drops by 32 to 33 KB on each page. These numbers were identical in every run.
  • The score doesn't change. It varies by 1 to 3 points between runs of the same site, more than this change moves it.
  • Total Blocking Time varies by up to a second between runs of the same site (for example 2,180 to 3,608 ms for v5 on /), so 3 runs can't tell whether this PR changes it. The two largest unused chunks (about 176 KB and 129 KB) are the same on v5 and this PR.

ELI5

Every docs page downloaded a whole animation library just to turn the menu icon into an X and make the Nuxi mascot wiggle, and component pages loaded it again for a blinking eye icon. The browser can do all of that on its own, so each page now loads about 150 KB less JavaScript up front, and component pages skip another 136 KB.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
ui Ready Ready Preview Nov 18, 2026 10:27am UTC
1 Skipped Deployment
Project Deployment Actions Updated
ui-repl Ignored Ignored Preview Nov 18, 2026 10:27am UTC

Request Review

@github-actions github-actions Bot added the v4 #4488 label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The header toggle now uses delayed readiness and CSS transitions instead of Motion Vue variants. The icon composable replaces Motion Vue’s useAnimate helper with a local Web Animations API function. It adds internal animation types and a helper for combining scale keyframes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: Minimal · up to 60221

This docs-only change swaps icon animations from a JavaScript library to CSS and native browser APIs, which should reduce the amount of JavaScript the docs site loads. No concrete risk was found. The animation visuals were checked by hand and have no automated coverage.

Pre-merge checks: Passed 4

Check name Status Explanation
Description check Passed The description is related to the changeset. It explains why motion-v is removed from the docs header toggle, the Nuxi icon, and the theme-slots icon. It also describes the CSS and Web Animations API …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title "docs: replace motion-v with CSS and remove it" matches the main change. The PR replaces motion-v animations in the docs header toggle, Nuxi icon and theme-slots icon with CSS transitions,…
Full details: Description check

Explanation

The description is related to the changeset. It explains why motion-v is removed from the docs header toggle, the Nuxi icon, and the theme-slots icon. It also describes the CSS and Web Animations API replacements, the re-traced Embla Carousel SVG, and the build and Lighthouse evidence.

Full details: Title check

Explanation

The title "docs: replace motion-v with CSS and remove it" matches the main change. The PR replaces motion-v animations in the docs header toggle, Nuxi icon and theme-slots icon with CSS transitions, keyframes or the Web Animations API. It also removes motion-v from nuxt.config.ts, docs/package.json and pnpm-workspace.yaml. The title is concise, specific and uses a conventional commit prefix. It does not mention the Embla Carousel SVG change, which is a minor secondary change.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 452d9f34-f3e6-474f-929e-458b33200969
Commits

Reviewing files that changed from the base of the PR and between 9be96eb and 60221ce.

Files selected for processing: 2

  • docs/app/components/content/ComponentThemeVisualizerIcon.vue
  • docs/app/components/content/HeaderToggleButton.vue
Files with no reviewable changes: 1

  • docs/app/components/content/ComponentThemeVisualizerIcon.vue

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@7432

commit: 60221ce

@codspeed

codspeed Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 36 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing perf/docs-drop-motion-v-entry (60221ce) with v5 (881a324)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@benjamincanac benjamincanac changed the title perf(docs): drop motion-v from the entry chunk docs: drop motion-v from the entry chunk Nov 17, 2026
@atinux
atinux force-pushed the perf/docs-drop-motion-v-entry branch from 15521f2 to 0b46371 Compare November 17, 2026 13:53
@atinux
atinux changed the base branch from v4 to v5 November 17, 2026 13:53
@github-actions github-actions Bot added the v5 #6918 label Nov 17, 2026
@github-actions

Copy link
Copy Markdown

Client output of the apps in test/bundle that changed, compared to the base branch.

Fixture JS (gzip) CSS (gzip)
nuxt 116.8 kB (+52 B, +0.0%) 32.3 kB (+0.1 kB, +0.4%)
nuxt-detection 116.8 kB (+52 B, +0.0%) 13.1 kB (+77 B, +0.6%)
nuxt-full 860.2 kB (+0.2 kB, +0.0%) 32.5 kB (+0.1 kB, +0.4%)
vue 93.9 kB (+53 B, +0.1%) 30.7 kB (+0.1 kB, +0.4%)
vue-detection 93.9 kB (+52 B, +0.1%) 11.4 kB (+68 B, +0.6%)
Raw sizes
Fixture JS CSS
nuxt 318.4 kB (+0.2 kB, +0.1%) 212.7 kB (+0.9 kB, +0.4%)
nuxt-detection 318.4 kB (+0.2 kB, +0.1%) 68.8 kB (+0.5 kB, +0.7%)
nuxt-full 2671.3 kB (+1.0 kB, +0.0%) 212.9 kB (+0.9 kB, +0.4%)
vue 265.0 kB (+0.2 kB, +0.1%) 215.4 kB (+0.9 kB, +0.4%)
vue-detection 265.0 kB (+0.2 kB, +0.1%) 66.6 kB (+0.5 kB, +0.7%)

@atinux atinux changed the title docs: drop motion-v from the entry chunk perf(docs): replace motion-v with CSS and remove it Nov 17, 2026
@benjamincanac benjamincanac changed the title perf(docs): replace motion-v with CSS and remove it docs: replace motion-v with CSS and remove it Nov 18, 2026

@benjamincanac benjamincanac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! 😊

@benjamincanac benjamincanac removed the v4 #4488 label Nov 18, 2026
@benjamincanac
benjamincanac merged commit 38e00b4 into v5 Nov 18, 2026
21 checks passed
@benjamincanac
benjamincanac deleted the perf/docs-drop-motion-v-entry branch November 18, 2026 11:29

This branch was successfully deployed

2 active (1 outdated) deployments
Preview – ui — 60221cee Deployed Nov 18, 2026 by vercel[bot]
Preview – ui-repl — 041d0fc9 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v5 #6918

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants