Install SheenUI Glass Components in Next.js and Vite
Tested install steps for SheenUI in Next.js App Router and Vite (React Router or TanStack Router): the shadcn CLI, the packed package, or copying files.
By Lokendra Singh Rathore (GitHub, opens in a new tab)About the authorPublished Updated 12 min read




Every step below was first run end to end on 8 Nov 2026 in throwaway apps; on 12 Nov 2026 the versions in the table were re-checked against the packages installed in this repository (Vite 8.3.8, React 19.3.1, Tailwind 4.3.5). A real browser exercised ten components (button, dialog, menu, tabs, toast, data table, line chart, chat widget, backdrop, theme switcher) and reported no console errors or hydration warnings, and every interaction worked.
For the short version (one CLI command and two CSS lines) see the installation page; this guide has the framework detail and the tested versions.
SheenUI needs React 19.2 or newer (the components use useEffectEvent) and Tailwind CSS v4 (the Tailwind CSS v4 setup explains how the tokens and layers fit). Two ways to get the code:
- Package (
@sheenui/theme): compiled ES modules plus the stylesheet.clsx,tailwind-mergeand@tanstack/react-tableinstall with it;react,react-dom,tailwindcss,@base-ui/reactandmotionare peer dependencies that your app adds (see below; the Base UI docs page explains what Base UI contributes). - Copy the files: the shadcn CLI or a manual copy puts the source into your project, like shadcn/ui.
Many code samples on the docs pages use icons from lucide-react. The components do not need it, but a pasted sample does: pnpm add lucide-react.
Basis: the end-to-end runs and the version re-check this guide reports in its opening (8 Nov 2026 and 12 Nov 2026), and the files the registry installs. First published 8 Nov 2026, last revised 16 Nov 2026; the later date marks an edit of the text, and the table lists the versions that were actually tested.
0. Get the package (until it is on npm)
@sheenui/theme is marked private in the repo, so it is not on npm yet. Pack it from a clone, then install the tarball:
Once it is published, this becomes pnpm add @sheenui/theme. Publish with pnpm publish (not npm publish): the repo keeps exports pointing at src/ for development and relies on pnpm's publishConfig.exports to point at dist/ in the tarball.
1. Next.js (App Router)
Option A: the package
src/app/globals.css: Tailwind first, then SheenUI. No @source line is needed, the stylesheet already scans the package.
src/app/layout.tsx (a Server Component; no "use client" needed):
suppressHydrationWarning on <html> and the inline script are what keep a saved theme or style from flashing or mismatching: the script sets data-theme, data-sheen-style and friends on <html> before React hydrates.
Pages can be Server Components that compose SheenUI components directly. Only code that uses a hook or an event handler of your own needs "use client":
Notes, all verified:
- Next 16's
create-next-appsets up Tailwind v4 for Turbopack (@tailwindcss/turbopackrule innext.config.ts). To build withnext build --webpack, add the PostCSS plugin instead:pnpm add -D @tailwindcss/postcssand apostcss.config.mjswithexport default { plugins: { "@tailwindcss/postcss": {} } };. The CSS lines above stay the same. - No
transpilePackagesand nonext.configchange: the package ships compiled JavaScript, and every component module starts with"use client". Importing from the@sheenui/themebarrel in a Server Component is safe; client modules become client references and nothing client-only runs on the server. - Values that are not components are only usable on the server when they live in a plain module. Safe in Server Components:
cn, the motion tokens (duration,ease,spring,fadeUp, ...),defaultChatLabels,defaultDataTableLabels,toCsv,tokenize,formatBytes,parseColor, date helpers such astoISODate. Helpers anddefault…Labelsobjects that sit next to a component (formatCompact,formatCurrency,getPageItems,defaultLineChartLabels, ...) and every hook belong to a client module: call them in a Client Component. In a Server Component, calling one throwsAttempted to call formatCompact() from the server but formatCompact is on the client, and spreading a label object gives{}. ChatWidget,DataTableand the charts take plain props, so a Server Component can pass them arrays and aDate(pass a fixednowandlocaleto the chat so server and client text match).- In
next dev, Motion logsYou have Reduced Motion enabled on your devicewhen the OS or the in-app switch asks for reduced motion. It is an informational notice from the Motion library, not an error. Smaller CSS:
@sheenui/theme/styles.cssmakes Tailwind generate the utilities of every component (about 390 KB, 66 KB gzip). To pay only for the components you use, import the base and scan just those folders (about 110 KB, 30 KB gzip with Button):
Option B: copy the files with the shadcn CLI
Each item installs into components/sheenui/<item>/ and pulls in sheenui-theme (tokens, glass, motion, hooks, styles) and the npm packages it needs. input is listed because the Dialog example uses it, and analytics-demo-saas is the SaaS dashboard together with its sample data (the plain analytics-saas item is the dashboard alone). Then:
The CLI appends
@import "@/components/sheenui/styles/index.css";to your global CSS. Next.js cannot resolve the@/alias inside CSS (next buildfails withCan't resolve '@/components/sheenui/styles/index.css'). Change it to the relative path:This is the same text in
src/app/globals.cssand inapp/globals.css(an app made without--src-dir):components/sits next toapp/in both layouts. Vite resolves the alias, so keep the@/form there.- Import from the installed paths and mount the motion provider and the backdrop once. Use the
RootLayoutfrom option A (src/app/layout.tsx, orapp/layout.tsxwithout--src-dir) and replace only its package import with these three copied-files imports (SheenMotionProviderfrom@/components/sheenui/motion/provider,SheenBackdropfrom@/components/sheenui/backdrop/backdrop,sheenPreferenceScriptfrom@/components/sheenui/hooks/use-preferences), written asimport { SheenMotionProvider } from "@/components/sheenui/motion/provider";and so on. Addtoast.jsonand wrap the children inToastProviderandToaster(@/components/sheenui/toast/toast,.../toast/toaster) only if you use toasts. Components that only take plain props can sit in a Server Component. Anything that takes a function (a chart's
format,legend={seriesLegend(...)}, a dashboard'sload) must live in a file that starts with"use client"; see "Function props" below. This page is a Server Component (src/app/page.tsx):
To install a whole family instead of single items, use a bundle. A bundle has no files of its own, it only lists existing items, so nothing is copied twice:
The other bundles are components, charts and blocks. With the namespace entry below in components.json, the same installs read pnpm dlx shadcn@latest add @sheenui/all (also @sheenui/button and so on); the CLI replaces {name} with the item name. This was run with shadcn CLI 4.23.
The site serves the registry at https://lokendra-builds.github.io/sheenui/r/<name>.json. To test the steps without the network, or against changes you have not published, serve a local copy (this is how the steps above were tested):
Function props: charts and dashboards in Next.js
Every chart and dashboard module already starts with "use client", so you can render them from a Server Component. What cannot cross the server/client boundary is a function: a chart's format, the seriesLegend(...) and formatCompact(...) helpers (they live in client modules, so calling one on the server throws Attempted to call seriesLegend() from the server but seriesLegend is on the client), and a dashboard's load and liveStep. The docs samples for charts and dashboards pass functions, so paste them into a file that starts with "use client" and import that file from your page. They work there exactly as written; only the import lines change to the copied paths. For example src/app/sheen-islands.tsx:
2. Vite + React Router or TanStack Router (SPA, no SSR)
Start from any Vite React TypeScript app (pnpm create vite@latest my-app --template react-ts), then:
vite.config.ts:
src/index.css:
index.html: inline the preference script in <head> (it is the text of sheenPreferenceScript) and set the default style on <html>:
src/main.tsx with React Router: the providers wrap the router, so the backdrop and toasts survive navigation. Home is any page component of yours; this one is enough to try it:
With TanStack Router the shape is the same: replace <BrowserRouter>…</BrowserRouter> with <RouterProvider router={router} /> (code-based routes via createRootRoute, createRoute, createRouter).
Verified: tsc --noEmit with skipLibCheck: false, vite build, vite preview and vite dev all pass; navigating away and back remounts every component without errors.
Option B: copy the files with the shadcn CLI
The add command only copies files. The alias, the CSS import, the SheenMotionProvider and backdrop, and the preference script are still your steps below before a dashboard looks styled. In Vite the preference script goes into index.html as an inline <script> in <head> (its text is sheenPreferenceScript), because a component cannot be imported there. If the CLI fails with a 503 from github.io, run the command again.
pnpm dlx shadcn@latest init stops on a fresh Vite app with Could not find valid path aliases until the @/* alias exists in three files. Add it first, then run init. Start from the same app as above and add Tailwind:
src/index.css: replace the whole file with the Tailwind import (the CLI adds the SheenUI import after it):tsconfig.jsonandtsconfig.app.json: add the samepathsentry to thecompilerOptionsof both files.tsconfig.jsonhas nocompilerOptionsyet, so add the object; intsconfig.app.jsonadd one line to the existing one. The CLI reads the first file and TypeScript uses the second.The second block shows only the line to add to
tsconfig.app.json; keep its other options. Do not addbaseUrl: TypeScript 7 (whatcreate-viteinstalls today) rejects it, and TypeScript 6 deprecates it.pathsalone has worked since TypeScript 4.1 and resolves relative to the tsconfig file, so this exact form is the same on TypeScript 5, 6 and 7 (checked with 5.9.3, 6.0.3 and 7.0.2). On TypeScript 5 the build also needs"DOM.Iterable"in thelibarray oftsconfig.app.json("lib": ["ES2023", "DOM", "DOM.Iterable"]), because the copied files loop over aNodeList; 6 and 7 do not need it.vite.config.ts: the same alias for the bundler (no@types/nodeneeded):
Now the CLI works: run the same shadcn init -d and shadcn add commands as in the Next.js option B above (the list of items is the same).
init creates components.json and src/lib/utils.ts; add copies the items into src/components/sheenui/ and appends @import "@/components/sheenui/styles/index.css"; to src/index.css. Vite resolves the @/ alias inside CSS, so keep that line as it is (only Next.js needs the relative path). Use input for the Dialog example and analytics-demo-saas for the SaaS dashboard with its sample data. Wrap the app once in the motion provider and the backdrop (src/providers.tsx):
In src/main.tsx add import { Providers } from "./providers"; and render <Providers><App /></Providers> instead of <App />. Then src/App.tsx can use every item. A Vite app has no server, so the function props of charts and dashboards need no "use client" here: copy sheen-islands.tsx from the Next.js section into src/ without its "use client" line and import Revenue and SaasDashboard from it. The GlassCard and the Dialog are the ones from the Next.js page in step 3 (same imports, same markup):
3. Copy the files by hand
Use this when you want the source in your repo without the CLI (any bundler, any framework):
Every docs page has a "Files to copy" box with the exact folders and npm packages for that component, computed from the real import graph (pnpm copy-test builds each one in an empty Vite app). Then in your global CSS, after Tailwind:
This is the same stylesheet path the shadcn CLI writes (option B; in Next.js use the relative path there too). Files inside your project are scanned by Tailwind automatically; add an @source line pointing at components/sheenui, relative to the CSS file, only if your setup excludes them (for example a git-ignored folder). A hand copy keeps the folder layout of theme/src, so a component is one level deeper than after shadcn add: import { Button } from "@/components/sheenui/components/button/button". Each file already carries "use client" where it needs it, so the copy also works in the Next.js App Router.
Package hygiene (what pnpm pack ships)
Checked against the tarball of @sheenui/theme:
exports:.(barrel, ESM +.d.ts),./components/*,./blocks/*,./motion/*,./hooks/*(one file per module, for importing a single component),./styles.css,./styles/*,./package.json.sideEffects: ["**/*.css"]: bundlers drop every unused module and keep CSS imports. A bundle that imports onlyButtoncontains no charts, chat or Motion engine: 276 KB (88 KB gzip) in total against 220 KB (69 KB gzip) for a barereact-domapp, so Button adds about 57 KB (19 KB gzip) of JavaScript, including Base UI,clsxandtailwind-merge(measured on 16 Nov 2026 with Vite 8.3.8 and React 19.3.1). Importing@sheenui/theme/components/button/buttondirectly gives the same size. The stylesheet is separate and carries every token and both style presets: 473 KB, 76 KB gzip.- Types resolve with
moduleResolutionbundler,node16andnodenext(skipLibCheck: false), and Node canimport("@sheenui/theme")directly. - Peer dependencies:
react,react-dom(19.2 or newer),tailwindcss(4.1 or newer),@base-ui/react(1.9 or newer),motion(14.10 or newer), optional@types/react. Two copies of Motion would breakMotionConfig, so the app owns the one copy. - The tarball holds
dist/,LICENSE,README.mdandpackage.jsononly: no tests, source maps, local paths or secrets.