~/docs/installation
Installation
Run npx mpkcn init, then npx mpkcn add <name>. The CLI writes the theme, wires your CSS and installs the packages.
Requirements
| Package | Supported | Tested with |
|---|---|---|
| React | 19 | 19.3.0 |
| Next.js | 15+ (16 recommended) | 16.4.5 |
| Tailwind CSS | 4 | 4.x |
| next-themes | 0.4 (only for theme-toggle) | 0.4.6 |
| framer-motion | 13 (only for reveal) | 13.4.4 |
| TypeScript | 5 | 5.x |
| Node.js | 22 or newer (current LTS), for the CLI | 22.x |
The components are plain React client components. Next.js is the reference setup, but any React 19 app with Tailwind 4 works; only theme-toggle expects next-themes.
Quick start
Run one command from your project root. That is the whole setup:
npx mpkcn add theme-toggleAdding theme-toggle (+ theme, theme-provider)
created src/components/mpkcn/mpkcn-theme.css
created src/components/mpkcn/theme-provider.tsx
created src/components/mpkcn/theme-toggle.tsx
updated src/app/globals.css (+ @import "../components/mpkcn/mpkcn-theme.css";)
updated src/app/layout.tsx (+ fonts, theme provider)
Installing dependencies
npm install next-themes
Done. Use it:
import { ThemeToggle } from "@/components/mpkcn/theme-toggle";In a Next.js app, that one command:
- writes the component, the theme (
mpkcn-theme.css) and the theme provider tosrc/components/mpkcn(orcomponents/mpkcnwithoutsrc/); - imports the theme in your global CSS, right after
@import "tailwindcss"; - loads Space Grotesk and JetBrains Mono with
next/fontin your root layout; - wraps your app in the theme provider and adds
suppressHydrationWarningto<html>; - installs
next-themeswith your package manager (npm, pnpm, yarn or bun, from your lockfile).
Paste the import line where you need the component, and you are done. Any other component works the same way: npx mpkcn add boot-screen. Run it again as often as you like: nothing is added twice.
What changes in your layout
For the src/app/layout.tsx that create-next-app generates, the CLI adds the two fonts next to Geist, their CSS variables on <html>, and the provider around {children}:
import type { Metadata } from "next";
import { Geist, Geist_Mono, JetBrains_Mono, Space_Grotesk } from "next/font/google";
import { MpkcnThemeProvider } from "@/components/mpkcn/theme-provider";
import "./globals.css";
// geistSans, geistMono: unchanged
const spaceGrotesk = Space_Grotesk({
variable: "--font-space-grotesk",
subsets: ["latin"],
});
const jetbrainsMono = JetBrains_Mono({
variable: "--font-jetbrains-mono",
subsets: ["latin"],
});
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
<html
lang="en"
className={`${geistSans.variable} ${geistMono.variable} ${spaceGrotesk.variable} ${jetbrainsMono.variable} h-full antialiased`}
suppressHydrationWarning
>
<body className="min-h-full flex flex-col">
<MpkcnThemeProvider>{children}</MpkcnThemeProvider>
</body>
</html>
);
}The theme's font-mpk-sans and font-mpk-mono read those variables first, then fall back to the font names and system fonts.
When the CLI leaves your layout alone
The CLI edits the layout only when it has the simple shape above. It never touches a layout that already has a ThemeProvider from next-themes, or already loads the fonts. If your layout is different (more content in <body>, a className built with cn(…), no app/layout.tsx), nothing is written and the CLI prints the exact lines to paste instead:
src/app/layout.tsx has an unusual shape, so it was left as is. Add the theme provider to it:
import { MpkcnThemeProvider } from "@/components/mpkcn/theme-provider";
<html lang="en" suppressHydrationWarning>
<body><MpkcnThemeProvider>{children}</MpkcnThemeProvider></body>Pass --no-layout to never edit the layout, or --no-fonts to skip the fonts.
Other frameworks
Without Next.js (Vite, React Router, …) the CLI does not edit your app code. It prints where to put the provider and one Google Fonts line for the top of your global CSS:
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400..700&family=Space+Grotesk:wght@400..700&display=swap");Install with the shadcn CLI
mpkcn is also a shadcn registry. In a project set up with npx shadcn@latest init, add any component by its URL:
npx shadcn@latest add https://blhasn-sehli.github.io/mpkcn/r/shadcn/boot-screen.jsonOr add the registry to components.json once and use short names:
{
"registries": {
"@mpkcn": "https://blhasn-sehli.github.io/mpkcn/r/shadcn/{name}.json"
}
}npx shadcn@latest add @mpkcn/boot-screen @mpkcn/theme-toggleThe shadcn CLI writes the component to your ui folder (components/ui/boot-screen.tsx), adds the mpkcn colors, font stacks and blink animation to your global CSS, loads Space Grotesk and JetBrains Mono with next/font in your root layout, and installs the npm packages. The index of every item is at /r/shadcn/registry.json.
It does not edit the rest of your layout, so two things stay with you:
- Theme provider (only for
theme-toggle, which needsnext-themes): the CLI writescomponents/theme-provider.tsx. Wrap{children}in<MpkcnThemeProvider>in your root layout and addsuppressHydrationWarningto<html>, as in What changes in your layout. - Dark by default: like shadcn's own themes, the light palette goes in
:rootand the dark one in.dark. The provider starts in dark; without it, addclassName="dark"to<html>to get the dark terminal look.
Import from the ui folder: import { BootScreen } from "@/components/ui/boot-screen";.
Manual setup
Use this if you prefer to do each step yourself.
Create a Next.js app with Tailwind 4
Skip this if you already have one. create-next-app sets up Tailwind 4 for you.
npx create-next-app@latest my-app --typescript --tailwind --app --src-dirAdd the theme file
mpkcn-theme.css holds the eight color tokens, the two font stacks and the blink animation as Tailwind 4 theme variables. Copy it from Theming to src/components/mpkcn/mpkcn-theme.css.
Import it in your global CSS, right after Tailwind (the path is relative to the CSS file):
@import "tailwindcss";
@import "../components/mpkcn/mpkcn-theme.css";This gives you utilities like bg-mpk-bg, text-mpk-ink, border-mpk-line, text-mpk-amber, font-mpk-mono and animate-mpk-blink.
Add the theme provider
mpkcn switches themes with a dark / light class on <html>, set by next-themes. Install it:
npm i next-themesSave this as src/components/mpkcn/theme-provider.tsx:
"use client";
import { ThemeProvider, type ThemeProviderProps } from "next-themes";
export function MpkcnThemeProvider({ children, ...props }: ThemeProviderProps) {
return (
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem={false}
themes={["dark", "light"]}
disableTransitionOnChange
{...props}
>
{children}
</ThemeProvider>
);
}Load the fonts and use the provider
In your root layout (src/app/layout.tsx), load both fonts with next/font, put their variables on <html>, and wrap {children} in the provider. suppressHydrationWarning is needed because next-themes sets the class before React hydrates:
import { JetBrains_Mono, Space_Grotesk } from "next/font/google";
import { MpkcnThemeProvider } from "@/components/mpkcn/theme-provider";
import "./globals.css";
const spaceGrotesk = Space_Grotesk({ subsets: ["latin"], variable: "--font-space-grotesk" });
const jetbrainsMono = JetBrains_Mono({ subsets: ["latin"], variable: "--font-jetbrains-mono" });
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" className={`${spaceGrotesk.variable} ${jetbrainsMono.variable}`} suppressHydrationWarning>
<body className="bg-mpk-bg text-mpk-ink">
<MpkcnThemeProvider>{children}</MpkcnThemeProvider>
</body>
</html>
);
}Add a component
Every component page has a Manual tab with the source and its npm packages. Copy the files into your components folder, install the packages, then import it:
import { BootScreen } from "@/components/mpkcn/boot-screen";What the CLI does
mpkcn add downloads the component from the registry at https://blhasn-sehli.github.io/mpkcn/r and writes the source files, skipping files that already exist. On the first run it also writes the theme and adds the theme @import to your global CSS, once. In a Next.js app it loads the fonts in your root layout and, for components that need it (such as theme-toggle), adds the theme provider. It then installs the npm packages your package.json does not list yet, with your package manager. Pass --no-install to only print the install command. See CLI for every option.