# mpkcn > Terminal-style React components you copy, paste and own. 36 components (boot screens, command palettes, file explorers, tmux bars), set up with one command or by asking your AI assistant. mpkcn is distributed like shadcn/ui: `npx mpkcn add ` copies a component's source into the project (default `src/components/mpkcn`, or `components/mpkcn` without `src/`), imports `mpkcn-theme.css` in the global CSS, loads the fonts and the theme provider in a Next.js root layout, and installs the npm packages it needs. Every component is a `"use client"` React 19 component with a named export, styled with Tailwind CSS 4 utilities built on eight `--mpk-*` tokens, dark and light. AI assistants can use the MCP server instead of the shell: `npx -y mpkcn@latest mcp` exposes `list_components`, `get_component`, `add_components` and `init_project`. Claude Code: `claude mcp add mpkcn -- npx -y mpkcn@latest mcp`. --- # Introduction URL: https://blhasn-sehli.github.io/mpkcn/docs/ > A terminal-flavoured React UI kit you install by copying source, not by adding a package. ## What is mpkcn? mpkcn is a set of 35 React components with a terminal feel: a login-style **boot screen**, **terminal windows and shells**, a **command palette**, a **tmux status bar**, and quiet effects like **grain**, **spotlight** and scroll **reveals**. Browse them all, running live, in the [gallery](/components/). They come from the portfolio of MpK and are now packaged so anyone can use them. It is not a library you install from npm. Like [shadcn/ui](https://ui.shadcn.com), you run one command and the component's source is copied into your project: ```bash npx mpkcn add boot-screen ``` From then on the code is yours. Read it, change the timings, rename the props, delete what you don't need. There is no package to upgrade and no API to fight. ## Principles - **You own the code.** Every component is one readable file (plus a helper when needed), styled with Tailwind classes. - **Tokens, not colors.** Components only use eight `--mpk-*` CSS variables, so a theme change is a few lines of CSS. See [Theming](/docs/theming/). - **Dark first, light ready.** Dark is the default; every token has a light value too, switched with `next-themes`. - **Quiet details.** Square corners, hairline borders, no shadows, amber and blue accents, monospace where it means something. - **Accessible by default.** Visible focus, labelled icon buttons, and `prefers-reduced-motion` respected everywhere. ## Components | Component | What it does | Extra npm deps | | --- | --- | --- | | [Arch Diagram](/docs/components/arch-diagram/) | A small architecture diagram of boxes on a grid joined by right-angled lines; pick a box to light up its links and print its details. | none | | [ASCII Image](/docs/components/ascii-image/) | An image that starts as a wall of flickering code glyphs and decodes into the real picture in a left-to-right sweep. | none | | [Back to Top](/docs/components/back-to-top/) | A small square button that appears after the first screen and scrolls back up, with a reduced-motion jump and optional focus target. | none | | [Boot Screen](/docs/components/boot-screen/) | A tuigreet-style login screen with a typed username, password dots and optional matrix rain that plays before your page appears. | none | | [Case Card](/docs/components/case-card/) | A project case study card: name, one-liner, tags, links and a screenshot beside a spec-sheet list of features. | none | | [Command Palette](/docs/components/command-palette/) | A terminal-style Ctrl+K command palette with groups, fuzzy word filtering and full keyboard control, as a dialog or inline. | none | | [Cursor](/docs/components/cursor/) | A terminal-style pointer follower, a block caret with a trailing square ring and magnetic buttons, that steps aside for touch, text fields, the keyboard and reduced motion. | none | | [Env Card](/docs/components/env-card/) | Contact or config details shown as a syntax-colored .env file, with links, copy buttons and masked secrets. | none | | [Eyebrow](/docs/components/eyebrow/) | A small mono label for above a heading that types itself out, with a block cursor, as it scrolls into view. | none | | [Feature List](/docs/components/feature-list/) | A spec-sheet list of label and value rows between hairlines, sliding in one by one. | `framer-motion` | | [Fetch Card](/docs/components/fetch-card/) | A neofetch-style info card: ASCII art, a user@host header, key / value rows and a palette strip, with lines that slide in and art that tilts towards the pointer. | `framer-motion` | | [File Explorer](/docs/components/file-explorer/) | A ranger-style file browser with Miller columns, a preview pane, a path bar and a / filter, driven entirely from the keyboard. | none | | [Grain](/docs/components/grain/) | A static film-grain overlay in two blend layers that stays visible on both the dark and the light theme, at no per-frame cost. | none | | [Image Placeholder](/docs/components/image-placeholder/) | A framed image slot that shows a striped placeholder with a mono label until the image exists or when it fails to load. | none | | [Kbd](/docs/components/kbd/) | A keyboard key badge with a thick bottom edge, for single keys or combos like Ctrl + K. | none | | [Konami](/docs/components/konami/) | A useKonami hook and an easter-egg component that fires a callback and plays matrix rain when someone types the Konami code. | none | | [Letter Reveal](/docs/components/letter-reveal/) | Splits a heading into letters that spring up and flip into place one after another. | `framer-motion` | | [Media Lightbox](/docs/components/media-lightbox/) | An accessible image and video lightbox with arrows, keyboard and swipe navigation, thumbnails, click-to-zoom and a focus trap. | none | | [Parallax Image](/docs/components/parallax-image/) | An image in a viewfinder frame that drifts with the pointer and with scroll, and holds still under reduced motion. | `framer-motion` | | [Prompt Footer](/docs/components/prompt-footer/) | A site footer laid out as a shell session: ls prints your link columns, date the copyright and an optional live clock, and the last prompt blinks. | none | | [Reveal](/docs/components/reveal/) | Fades and slides content in as it scrolls into view, and keeps still under reduced motion. | `framer-motion` | | [Roadmap](/docs/components/roadmap/) | A roadmap of milestones joined by a path that draws itself as you scroll, with a marker travelling along it and stops that light up when reached. | none | | [Scene Canvas](/docs/components/scene-canvas/) | A slow wave rippling through a grid of dots on a canvas, capped at 30fps and paused off screen, in hidden tabs, on weak devices and under reduced motion. | none | | [Scroll Hint](/docs/components/scroll-hint/) | An animated scroll-down indicator (line, chevron or mouse) that fades out as you scroll and can jump to the next section. | `framer-motion` | | [Scroll Progress](/docs/components/scroll-progress/) | A thin accent bar that fills as the page or a scroll container is scrolled. | none | | [Section Divider](/docs/components/section-divider/) | A terminal-style break between sections: hairlines grow out and a linked label types "EOF about $ cd ../work". | none | | [Section Rail](/docs/components/section-rail/) | A slim side rail of numbered dots that tracks the section in view and jumps to a section on click. | none | | [Shortcuts Dialog](/docs/components/shortcuts-dialog/) | A keyboard-shortcut cheat sheet in a terminal-style dialog that opens with "?". | none | | [Site Header](/docs/components/site-header/) | A sticky terminal-style top bar with a logo slot and block cursor, numbered links with a sliding active marker, an actions slot and a drop-down mobile menu. | `framer-motion` | | [Spotlight](/docs/components/spotlight/) | A panel with a soft accent glow that follows the pointer while it hovers, drawn in CSS without re-rendering. | none | | [Tech Stack](/docs/components/tech-stack/) | A tech stack grouped by category, as a stack.json file or a chip grid, with optional icons and a jq-style detail panel for the picked item. | `framer-motion` | | [Terminal Form](/docs/components/terminal-form/) | A form that runs like a terminal prompt: one question at a time, editable answers, then a confirm step that hands the values to your callback. | none | | [Terminal Shell](/docs/components/terminal-shell/) | An interactive fake shell: you pass the commands, it handles the prompt, history, tab completion, help, clear and Ctrl+L. | none | | [Terminal Window](/docs/components/terminal-window/) | A terminal window with title bar and dots that types out commands and their output line by line, then shows your content. | none | | [Theme Toggle](/docs/components/theme-toggle/) | A dark and light switch for next-themes, as a round icon button or a mono text flag, with no hydration flash. | `next-themes` | | [Tmux Bar](/docs/components/tmux-bar/) | A tmux-style status bar with a session block, clickable windows, custom segments, a clock, uptime and scroll position. | none | ## Next steps > **New here?** > > Start with [Installation](/docs/installation/) to set up Tailwind 4, `next-themes` and the theme file, then add your first component with the [CLI](/docs/cli/). --- # Installation URL: https://blhasn-sehli.github.io/mpkcn/docs/installation/ > Run npx mpkcn init, then npx mpkcn add . 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` | > mpkcn targets the latest stable releases; older majors (React 18, Tailwind 3) are not supported. 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: ```bash npx mpkcn add theme-toggle ``` ```txt Adding 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 to `src/components/mpkcn` (or `components/mpkcn` without `src/`); - imports the theme in your global CSS, right after `@import "tailwindcss"`; - loads **Space Grotesk** and **JetBrains Mono** with `next/font` in your root layout; - wraps your app in the theme provider and adds `suppressHydrationWarning` to ``; - installs `next-themes` with 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. > Prefer to set up before adding anything? `npx mpkcn init` does the same setup without a component, and checks React 19, Tailwind 4, next-themes, the theme provider and the fonts. ### 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 ``, and the provider around `{children}`: ```tsx 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 ( {children} ); } ``` 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 ``, a `className` built with `cn(…)`, no `app/layout.tsx`), nothing is written and the CLI prints the exact lines to paste instead: ```txt 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"; {children} ``` 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: ```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](https://ui.shadcn.com/docs/registry). In a project set up with `npx shadcn@latest init`, add any component by its URL: ```bash npx shadcn@latest add https://blhasn-sehli.github.io/mpkcn/r/shadcn/boot-screen.json ``` Or add the registry to `components.json` once and use short names: ```json { "registries": { "@mpkcn": "https://blhasn-sehli.github.io/mpkcn/r/shadcn/{name}.json" } } ``` ```bash npx shadcn@latest add @mpkcn/boot-screen @mpkcn/theme-toggle ``` The 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`](https://blhasn-sehli.github.io/mpkcn/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 needs `next-themes`): the CLI writes `components/theme-provider.tsx`. Wrap `{children}` in `` in your root layout and add `suppressHydrationWarning` to ``, as in [What changes in your layout](#what-changes-in-your-layout). - **Dark by default**: like shadcn's own themes, the light palette goes in `:root` and the dark one in `.dark`. The provider starts in dark; without it, add `className="dark"` to `` 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. ```bash npx create-next-app@latest my-app --typescript --tailwind --app --src-dir ``` ### Add 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](/docs/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): ```css @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 ``, set by `next-themes`. Install it: ```bash npm i next-themes ``` Save this as `src/components/mpkcn/theme-provider.tsx`: ```tsx "use client"; import { ThemeProvider, type ThemeProviderProps } from "next-themes"; export function MpkcnThemeProvider({ children, ...props }: ThemeProviderProps) { return ( {children} ); } ``` ### 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 ``, and wrap `{children}` in the provider. `suppressHydrationWarning` is needed because `next-themes` sets the class before React hydrates: ```tsx 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 ( {children} ); } ``` ### 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: ```tsx 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](/docs/cli/) for every option. --- # Theming URL: https://blhasn-sehli.github.io/mpkcn/docs/theming/ > Eight CSS variables drive every component. Here is each one, in both themes. ## Tokens Every mpkcn component is styled with eight CSS variables. The dark values live on `:root` and `.dark`, the light values on `.light`. Tailwind 4 turns each one into a color utility (`bg-mpk-*`, `text-mpk-*`, `border-mpk-*`, …). Two font stacks and one animation complete the set: | Variable | Value | Utility | | --- | --- | --- | | `--font-mpk-sans` | Space Grotesk (`next/font` variable `--font-space-grotesk` first), system sans fallback | `font-mpk-sans` | | `--font-mpk-mono` | JetBrains Mono (`next/font` variable `--font-jetbrains-mono` first), system mono fallback | `font-mpk-mono` | | `--animate-mpk-blink` | `mpk-blink 1s steps(1) infinite` | `animate-mpk-blink` | ## The theme file This is `mpkcn-theme.css` in full. It is the file the CLI writes next to your components: ```css :root, .dark { --mpk-bg: #0a0d10; --mpk-bg-soft: #10151a; --mpk-line: #1f2b34; --mpk-ink: #eef2f4; --mpk-dim: #7c8fa0; --mpk-dim2: #47555f; --mpk-amber: #e8a33d; --mpk-blue: #6fb2ff; } .light { --mpk-bg: oklch(0.975 0.006 240); --mpk-bg-soft: oklch(0.945 0.011 240); --mpk-line: oklch(0.86 0.014 240); --mpk-ink: oklch(0.21 0.02 250); --mpk-dim: oklch(0.45 0.022 245); --mpk-dim2: oklch(0.5 0.02 245); --mpk-amber: oklch(0.5 0.115 65); --mpk-blue: oklch(0.49 0.17 258); } @theme inline { --color-mpk-bg: var(--mpk-bg); --color-mpk-bg-soft: var(--mpk-bg-soft); --color-mpk-line: var(--mpk-line); --color-mpk-ink: var(--mpk-ink); --color-mpk-dim: var(--mpk-dim); --color-mpk-dim2: var(--mpk-dim2); --color-mpk-amber: var(--mpk-amber); --color-mpk-blue: var(--mpk-blue); --font-mpk-mono: var(--font-jetbrains-mono, "JetBrains Mono"), ui-monospace, Consolas, monospace; --font-mpk-sans: var(--font-space-grotesk, "Space Grotesk"), ui-sans-serif, system-ui, sans-serif; --animate-mpk-blink: mpk-blink 1s steps(1) infinite; } @keyframes mpk-blink { 50% { opacity: 0; } } ``` ## Customize Because the utilities read the variables at runtime, you change the look by overriding variables, not by editing components. Put overrides **after** the theme import: ```css @import "tailwindcss"; @import "../components/mpkcn/mpkcn-theme.css"; /* A green phosphor accent instead of amber, in dark mode only */ :root, .dark { --mpk-amber: #7ee787; } /* A warmer light background */ .light { --mpk-bg: oklch(0.98 0.01 80); } ``` ### Scope a theme to one section Variables cascade, so you can retheme a single part of the page: ```tsx
``` ### Use the tokens in your own UI The utilities are regular Tailwind colors, so opacity modifiers work too: ```tsx
$ ready
``` > Check contrast when you change values. In the defaults, `ink` and `dim` are the text colors meant for reading; `dim2` is low contrast on purpose and is only for decoration and de-emphasized hints. --- # CLI URL: https://blhasn-sehli.github.io/mpkcn/docs/cli/ > Use the mpkcn CLI to set up your project, add components and install what they need. ## Usage Run it with `npx`, no install needed. It requires Node.js 22 or newer and has no runtime dependencies. ```bash npx mpkcn [options] ``` The usual flow is one command. The first `add` sets up everything it needs: ```bash npx mpkcn add theme-toggle ``` ## init Sets up your project once: ```bash npx mpkcn init ``` `init`: - writes `mpkcn-theme.css` to the components folder (skipped if it is already there); - adds `@import "/mpkcn-theme.css";` to your global CSS, right after `@import "tailwindcss"`. It never adds it twice; - in a Next.js app, writes `theme-provider.tsx`, installs `next-themes` and wires your root layout (see [Root layout](#root-layout)); - checks `package.json` for React 19, Tailwind CSS 4 and next-themes, then the theme provider and the fonts, and prints a `warn` line with the fix for anything missing or too old. It looks for the global CSS at the usual Next.js and Vite paths (`src/app/globals.css`, `app/globals.css`, `src/styles/globals.css`, `src/index.css`, …), then in any CSS file that has `@import "tailwindcss"`. Pass `--css ` to choose the file. If none is found, it prints the exact line to add. You can skip `init`: the first `add` runs the same steps, and only prints the warnings. ## add Copies one or more components, plus everything they depend on, into your project: ```bash npx mpkcn add boot-screen npx mpkcn add theme-toggle reveal ``` For each item, `add`: - resolves its `registryDependencies` (every component pulls in `theme`, the `mpkcn-theme.css` file; `theme-toggle` also pulls in `theme-provider`); - writes the files to the target folder, keeping sub-folders such as `lib/matrix-rain.ts`; - skips files that already exist, unless you pass `--overwrite`; - in a Next.js app, loads the fonts and (when an item needs it) the theme provider in your root layout; - installs the npm packages your `package.json` does not list yet, with the package manager it detects (the `packageManager` field, then `pnpm-lock.yaml`, `yarn.lock`, `bun.lock` or `package-lock.json`; npm otherwise). The install output streams to your terminal; - ends with the import line to paste, using the `@/` alias when your `tsconfig.json` has it. ```txt Adding 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 (npm output) Done. Use it: import { ThemeToggle } from "@/components/mpkcn/theme-toggle"; ``` If the install fails, `add` prints the command to run yourself and exits with code 1. The files stay in place. Item names must match `[a-z0-9-]+`. Every file target is checked before anything is written: absolute paths and paths that leave the target folder are rejected. npm package names from the registry are checked too before they reach your package manager. ## Root layout In a Next.js app (`next` in `package.json`), `init` and `add` update `src/app/layout.tsx` (or `app/layout.tsx`) so nothing is left to do by hand: - **Fonts:** imports `Space_Grotesk` and `JetBrains_Mono` from `next/font/google`, declares them with the variables `--font-space-grotesk` and `--font-jetbrains-mono`, and adds those to the `className` of ``. The theme's `font-mpk-sans` and `font-mpk-mono` read them. - **Theme provider** (for `theme-toggle` and anything else that uses `next-themes`): imports `MpkcnThemeProvider`, wraps `{children}` in `` with it and adds `suppressHydrationWarning` to ``. The change shows as one line, `updated src/app/layout.tsx (+ fonts, theme provider)`. It is idempotent: a layout that already has the provider or the fonts is not changed again. The CLI only edits a layout with the simple `create-next-app` shape: one ``, one `` whose only content is `{children}`, and a `className` on `` that is absent, a string or a template literal. It leaves alone a layout that already uses its own `ThemeProvider` or `next-themes`. For anything else it writes nothing and prints the exact lines to paste. Without Next.js, nothing is edited: `add` prints where to put the provider and a Google Fonts `@import` line for the top of your global CSS. ## list Shows every item in the registry with its description: ```bash npx mpkcn list ``` ## Options | Option | Description | Default | | --- | --- | --- | | `-d, --dir ` | Folder the files are written to | `src/components/mpkcn`, or `components/mpkcn` without `src/` | | `-c, --css ` | Global CSS file to add the theme `@import` to | auto-detected | | `-r, --registry ` | Registry URL, or a local folder | `https://blhasn-sehli.github.io/mpkcn/r` | | `-o, --overwrite` | Replace files that already exist | off | | `--no-install` | Do not install npm packages, only print the command | off | | `--no-layout` | Never edit the root layout; print the lines to add instead | off | | `--no-fonts` | Do not load the fonts | off | | `-y, --yes` | Non-interactive (mpkcn never prompts; accepted for scripts) | off | | `-h, --help` | Show usage | | | `-v, --version` | Show the version | | ### --dir ```bash npx mpkcn add reveal --dir app/ui/terminal ``` ### --css ```bash npx mpkcn init --css src/styles/main.css ``` ### --no-install Useful in CI or when you manage dependencies yourself: ```bash npx mpkcn add reveal --no-install ``` ```txt Install the npm dependencies: npm install framer-motion ``` ### --no-layout and --no-fonts Keep your root layout exactly as it is (for example when your provider lives in another file), or skip the fonts: ```bash npx mpkcn add theme-toggle --no-layout npx mpkcn add boot-screen --no-fonts ``` ### --registry Point the CLI at another registry, such as a fork of mpkcn or a local build of this site: ```bash npx mpkcn add boot-screen --registry https://example.com/r npx mpkcn add boot-screen --registry ./apps/docs/public/r ``` ## Registry format The registry is a set of static JSON files served by this site: | File | Content | | --- | --- | | `/r/index.json` | `{ name, title, description }[]` | | `/r/.json` | `{ name, title, description, dependencies, registryDependencies, files: { target, content }[] }` | Anyone can host a compatible registry: any static file host that serves these two shapes works with `--registry`. --- # Use with AI URL: https://blhasn-sehli.github.io/mpkcn/docs/ai/ > Connect Claude Code, Cursor or VS Code to mpkcn with one line, then ask for a component in plain words. The mpkcn CLI is also an [MCP](https://modelcontextprotocol.io) server. Connect it to your AI assistant once, and you can ask for components in plain words: the assistant finds the right one, reads its source and props, and adds it to your project the same way `npx mpkcn add` does. It writes the files, imports the theme, wires your root layout, installs the npm packages and hands back the import line. Nothing to install: your assistant starts it with `npx` when it needs it. It requires Node.js 22 or newer. ## Setup Claude Code: ```bash claude mcp add mpkcn -- npx -y mpkcn@latest mcp ``` Cursor, `.cursor/mcp.json`: ```json { "mcpServers": { "mpkcn": { "type": "stdio", "command": "npx", "args": [ "-y", "mpkcn@latest", "mcp" ] } } } ``` VS Code, `.vscode/mcp.json`: ```json { "servers": { "mpkcn": { "type": "stdio", "command": "npx", "args": [ "-y", "mpkcn@latest", "mcp" ] } } } ``` Windsurf (`~/.codeium/windsurf/mcp_config.json`) and Claude Desktop (`claude_desktop_config.json`): ```json { "mcpServers": { "mpkcn": { "command": "npx", "args": [ "-y", "mpkcn@latest", "mcp" ] } } } ``` > **On Windows** > > If the server does not start from a JSON config, run `npx` through `cmd`: `"command": "cmd"` with `"args": ["/c", "npx", "-y", "mpkcn@latest", "mcp"]`. `npx mpkcn mcp --help` prints the same snippets in your terminal. ## Try it Open your project with the assistant and ask: - "Add a terminal boot screen to my site." - "Add a boot screen to my landing page, only the first time someone visits." - "Which mpkcn component fits a status bar?" - "Show me the props of the command palette, then add it with Ctrl+K." - "Set up mpkcn in this project and tell me what is missing." - "Add the theme toggle and the scroll progress bar, but don't install anything yet." A typical run: the assistant calls `list_components` to search, `get_component` to read the source and usage, then `add_components` with your project folder. It gets back the files it created or updated, the packages it installed and the import line, and uses that line in your page. ## Tools | Tool | What it does | Changes files | | --- | --- | --- | | `list_components` | Lists every component with its title, one-line description, category, npm dependencies and mpkcn dependencies. An optional `query` filters it, e.g. `"status bar"`. | No | | `get_component` | Returns one component's full source files, npm and registry dependencies, the import line, a short usage example and the docs URL. | No | | `add_components` | Same as `mpkcn add`. Takes `names`, `cwd` (project root), `overwrite` (default `false`), `install` (default `true`), `layout` (default `true`) and `dir`. Returns the created, updated and skipped files, installed packages, import lines, manual steps and warnings. | Yes | | `init_project` | Same as `mpkcn init`. Takes `cwd`, `install`, `layout` and `overwrite`. Returns the files and the project checks (React 19, Tailwind CSS 4, next-themes, provider, fonts). | Yes | `cwd` must be a folder with a `package.json`. It defaults to the folder the assistant starts the server in, which is your project for Claude Code, Cursor and VS Code. ## Security > **It only writes when asked** > > `list_components` and `get_component` are read-only. `add_components` and `init_project` write files and run your package manager, and only when the assistant calls them for something you asked for. Most assistants show you each tool call and ask before running it. - It runs on your machine, over stdio. There is no account, key or telemetry. The server itself only downloads component JSON from the registry; npm packages come through your own package manager. - Files are written only inside the components folder of the project you name. Item names must match `[a-z0-9-]+`, and file targets that are absolute or leave that folder are rejected before anything is written. - npm package names from the registry are validated before they reach your package manager. The package manager's output goes to the server log, never into the protocol. - Existing files are skipped unless the assistant passes `overwrite: true`. The root layout is only edited when it has the standard `create-next-app` shape; otherwise the tool returns the lines to add. - Pass `install: false` to see the install command without running it. ## Custom registry The server reads the public registry by default. To point it at your own (a URL or a local folder of `index.json` and `.json` files), add `--registry ` after `mcp`, or set the `MPKCN_REGISTRY` environment variable in the server config. ## llms.txt For assistants that read docs instead of calling tools, the site publishes [llms.txt](https://blhasn-sehli.github.io/mpkcn/llms.txt), an index of every docs page and registry file, and [llms-full.txt](https://blhasn-sehli.github.io/mpkcn/llms-full.txt), every page as plain Markdown in one file. Paste either link into a chat to give it the whole kit. --- # Changelog URL: https://blhasn-sehli.github.io/mpkcn/docs/changelog/ > What shipped in each mpkcn release. ## 0.5.0 One new component (36 in total). No CLI release needed: `mpkcn@0.3.0` and the shadcn CLI install it from the registry. - **New component:** [`roadmap`](/docs/components/roadmap/) (Text & layout). Milestones joined by a path that draws itself in amber as you scroll, with a square marker travelling along it and stops that light up when reached. Soft curves or right-angle turns, cards on both sides or on the right, a static mode for product roadmaps, and support for scroll containers. ## 0.4.0 CLI `mpkcn@0.3.0`: no manual steps left, 11 new components (35 in total), and setup from your AI assistant. - **New components:** `site-header`, `prompt-footer`, `file-explorer`, `scroll-hint` (Navigation); `case-card`, `tech-stack`, `arch-diagram` (Cards); `media-lightbox`, `parallax-image` (Media); `fetch-card`, `env-card` (Terminal). - **Theme provider:** new `theme-provider` item, `MpkcnThemeProvider` (next-themes with `attribute="class"`, dark first, dark and light only, no transition flash). `theme-toggle` depends on it, and the CLI wraps your root layout in it and adds `suppressHydrationWarning` to ``. - **Fonts:** in a Next.js app the CLI loads Space Grotesk and JetBrains Mono with `next/font` in your root layout. The theme's `--font-mpk-sans` / `--font-mpk-mono` now read the `next/font` variables first, then the font names and system fonts, so existing setups keep working. A 0.2 theme file is upgraded in place when its font lines are untouched. - **Safe edits:** the layout is only edited when it has the simple `create-next-app` shape; a layout that already has a `ThemeProvider` or the fonts is left alone, and anything unusual gets the exact lines to paste instead. Every edit is idempotent and shows as one `updated` line. - **Flags:** `--no-layout` never edits the layout, `--no-fonts` skips the fonts. - **Other frameworks:** without Next.js nothing is edited; the CLI prints where to put the provider and a Google Fonts `@import` line. - **`init`:** in a Next.js app it also sets up the provider and fonts, and checks both. - **Docs:** [Installation](/docs/installation/) is now one command, with the manual steps kept below it. - **Use with AI:** `mpkcn mcp` is an MCP server for Claude Code, Cursor, VS Code, Windsurf and Claude Desktop, with four tools: `list_components`, `get_component`, `add_components` and `init_project`. Setup is one line: `claude mcp add mpkcn -- npx -y mpkcn@latest mcp`. Hand-written on stdio, so the CLI still has no runtime dependencies. See [Use with AI](/docs/ai/). - **llms.txt:** the site publishes [`llms.txt`](https://blhasn-sehli.github.io/mpkcn/llms.txt) and [`llms-full.txt`](https://blhasn-sehli.github.io/mpkcn/llms-full.txt), built from the registry and the docs. The registry JSON now also carries each item's category, docs URL and usage example. ## 0.3.0 CLI `mpkcn@0.2.0`: one command, no manual steps. - **`mpkcn init`:** writes `mpkcn-theme.css`, adds its `@import` to your global CSS and checks `package.json` for React 19, Tailwind CSS 4 and next-themes, with the fix for anything missing. - **Automatic install:** `mpkcn add` installs the npm packages a component needs with your package manager (npm, pnpm, yarn or bun) and skips packages already in `package.json`. `--no-install` only prints the command. - **Automatic theme import:** the first `add` finds your global CSS (`src/app/globals.css`, `src/index.css`, … or any file that imports Tailwind) and adds the theme `@import` right after `@import "tailwindcss"`, once. `--css ` picks the file. - **Next step:** `add` ends with the import line to paste, using the `@/` alias when `tsconfig.json` has it. - **Docs:** [Installation](/docs/installation/) is now `npx mpkcn init`, then `npx mpkcn add `, with the manual steps kept as a fallback. ## 0.2.0 21 new components and a gallery to browse them all. - **Gallery:** [/components](/components/) shows every component running live, with search, category filters, the full source and a copy button for the install command. - **Terminal:** `terminal-window`, `terminal-shell`, `command-palette`, `shortcuts-dialog`, `tmux-bar`, `terminal-form`, `konami`. - **Effects:** `cursor`, `grain`, `spotlight`, `scene-canvas`, `ascii-image`, `letter-reveal`. - **Text & layout:** `kbd`, `eyebrow`, `section-divider`, `section-rail`, `image-placeholder`, `feature-list`, `scroll-progress`, `back-to-top`. - **Accessibility:** every animated component respects `prefers-reduced-motion` and has an `ignoreReducedMotion` escape hatch; dialogs trap and return focus. - **CLI:** unchanged (`mpkcn@0.1.0` installs every new component). ## 0.1.0 First release. - **Components:** `boot-screen`, `theme-toggle` and `reveal`, each with dark and light support and `prefers-reduced-motion` handling. - **Theme:** `mpkcn-theme.css` with eight `--mpk-*` tokens, two font stacks and the blink animation, as Tailwind 4 theme variables. - **CLI:** `mpkcn add` and `mpkcn list`, with `--dir`, `--registry` and `--overwrite`. Requires Node.js 22 or newer. - **Registry:** static JSON at `/r/index.json` and `/r/.json`. - **Tested with:** React `19.3.0`, Next.js `16.4.5`, Tailwind CSS `4.x`, next-themes `0.4.6`, framer-motion `13.4.4`. --- # Arch Diagram URL: https://blhasn-sehli.github.io/mpkcn/docs/components/arch-diagram/ > A small architecture diagram of boxes on a grid joined by right-angled lines; pick a box to light up its links and print its details. ## Installation ```bash npx mpkcn add arch-diagram ``` ## Usage Place boxes on a grid with `col` and `row`, then join them with `links`. ```tsx import { ArchDiagram } from "@/components/mpkcn/arch-diagram"; export function Architecture() { return ( ); } ``` Boxes on the same row join with a straight line; others get a right-angled line from the bottom of the upper box to the top of the lower one. The picked box and its links turn blue, and its `tags` and `note` print under the diagram. The diagram is an SVG that scales to its width. Keep labels short (about 12 characters) and stick to three or four columns so the text stays readable on phones. ## Examples ### Small ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `nodes` | `ArchNode[]` | — | Boxes, placed on a grid by col and row. | | `links` | `[string, string][]` | [] | Connections as [fromId, toId] pairs. | | `defaultActive` | `string` | first node | Id of the box picked at first. | | `onSelect` | `(node: ArchNode) => void` | — | Called when a box is picked. | | `command` | `string \| null` | "tree . --arch" | Command shown above the diagram. null hides it. | | `label` | `string` | "Architecture diagram" | Accessible name of the diagram. | | `className` | `string` | — | Extra classes for the root. | `ArchNode` is `{ id: string; label: string; col: number; row: number; tags?: string[]; note?: ReactNode }`. ## Accessibility - Each box is focusable with `role="button"` and `aria-pressed`. Enter or Space picks it; the arrow keys move focus to the nearest box in that direction. - The details line is a polite live region and describes the picked box, so screen readers hear it on selection and on focus. - The lines are decorative. Everything a line says (which boxes connect) should also be in your text if it matters. - Nothing animates beyond color changes, so there is nothing to turn off for reduced motion. --- # ASCII Image URL: https://blhasn-sehli.github.io/mpkcn/docs/components/ascii-image/ > An image that starts as a wall of flickering code glyphs and decodes into the real picture in a left-to-right sweep. ## Installation ```bash npx mpkcn add ascii-image ``` ## Usage Give it an image and a size: ```tsx import { AsciiImage } from "@/components/mpkcn/ascii-image"; export function Portrait() { return ; } ``` Right after hydration the picture is covered by a wall of glyphs (`01<>/{}$#=+*`) in the blue accent. When the frame scrolls into view, each cell flickers, flashes bright and drops away in a noisy left-to-right sweep (1.8s), until only the photo is left. The canvas is then removed. ## Examples ### Bigger glyphs ```tsx ``` ### Custom characters, start on load ```tsx ``` ### Wait for an intro `play={false}` keeps the code wall up until you flip it, for example when a [Boot Screen](/docs/components/boot-screen/) ends: ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `src` | `string` | — | Image URL. | | `alt` | `string` | — | Alt text for the image. | | `trigger` | `"mount" \| "view"` | "view" | "view" decodes when the image scrolls into view; "mount" right after load. | | `play` | `boolean` | true | Hold the code wall until this turns true. | | `chars` | `string` | "01<>/{}$#=+*" | Characters the code wall is made of. | | `cell` | `number` | 14 | Size of one glyph cell in px. | | `delay` | `number` | 300 | Milliseconds to wait, wall fully shown, before decoding starts. | | `duration` | `number` | 1800 | Milliseconds the left-to-right decode takes. | | `skipOnLowPower` | `boolean` | true | Skip the effect on weak devices (4 cores or fewer, 4 GB memory or less, or Save-Data on). | | `ignoreReducedMotion` | `boolean` | false | Animate even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button. | | `onDone` | `() => void` | — | Called once when the decode finishes, or right away when it is skipped. | | `className` | `string` | — | Classes for the frame. Set its size here, e.g. "aspect-[4/5] w-64". | ## Accessibility - The real `` with your `alt` text is always in the page, and it is what the server renders: without JavaScript you simply see the photo. - The glyph canvas is decorative (`aria-hidden`) and is removed once the decode ends. - Under `prefers-reduced-motion: reduce`, and on low-power devices, the effect is skipped and the photo shows straight away. - Glyph colors are read from `--mpk-bg`, `--mpk-blue` and `--mpk-ink` when it starts, so it matches the current theme. --- # Back to Top URL: https://blhasn-sehli.github.io/mpkcn/docs/components/back-to-top/ > A small square button that appears after the first screen and scrolls back up, with a reduced-motion jump and optional focus target. ## Installation ```bash npx mpkcn add back-to-top ``` ## Usage Render it once, in your root layout. A small square button fades in at the bottom right after the reader scrolls past most of the first screen. ```tsx import { BackToTop } from "@/components/mpkcn/back-to-top"; export default function RootLayout({ children }: { children: React.ReactNode }) { return (
{children}
); } ``` ## Examples ### Inside a scroll container Pass a ref as `target` and `fixed={false}` to watch and scroll that element, with the button placed in the nearest positioned parent. Here it shows after 120px. ```tsx import { useRef } from "react"; import { BackToTop } from "@/components/mpkcn/back-to-top"; export function BuildLog() { const ref = useRef(null); return (
…
); } ``` ### Terminal label ```tsx cd ~ ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `target` | `RefObject` | window | Scroll container to watch and scroll. Leave empty to use the page. | | `fixed` | `boolean` | true | Pin the button to the bottom right of the viewport. false places it in the nearest positioned parent instead (use with target). | | `threshold` | `number` | 0.8 | Show the button after this much scroll: below 1 is a share of the visible height, otherwise px. | | `label` | `string` | "Back to top" | Accessible name (and tooltip) of the button. | | `focusSelector` | `string` | — | Element to focus after scrolling up, e.g. "#main". Keyboard users then continue from the top. | | `ignoreReducedMotion` | `boolean` | false | Scroll smoothly even when the user prefers reduced motion. Use sparingly. | | `children` | `ReactNode` | "↑" | Button content. | | `className` | `string` | — | Extra classes for the button. | ## Accessibility - It is a real `button` with an `aria-label` and a visible focus outline. - While hidden it is `inert`: out of the tab order and the accessibility tree, so no one tabs onto an invisible control. - Scrolling is smooth by default and jumps instantly under `prefers-reduced-motion: reduce`. The fade-in also turns off. - Use `focusSelector` to move keyboard focus to the top of the page after scrolling; otherwise focus would land on `body` once the button hides. Elements that are not focusable get `tabindex="-1"` first. --- # Boot Screen URL: https://blhasn-sehli.github.io/mpkcn/docs/components/boot-screen/ > A tuigreet-style login screen that types itself out, rains a little matrix and gets out of the way. ## Installation ```bash npx mpkcn add boot-screen ``` ## Usage Render it once, at the top of your root layout. By default it covers the whole page as a fixed overlay, plays once per browser session, then removes itself. ```tsx import { BootScreen } from "@/components/mpkcn/boot-screen"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` The sequence: a clock at the top, a login box with the title set in its border, the username typed in, password dots, `authenticating…`, then an optional matrix rain and a fade out. Any key or click skips straight to the end. ## Examples ### Inside a box Pass `fullscreen={false}` to fill the nearest positioned parent instead of the viewport. Give the parent `position: relative` and a height. Change `key` to replay it. ```tsx import { useState } from "react"; import { BootScreen } from "@/components/mpkcn/boot-screen"; export function BootPreview() { const [run, setRun] = useState(0); return (
); } ``` ### Custom user, host and hints ```tsx ``` ### Run code when it ends `onDone` fires once when the screen finishes, is skipped, or is not shown at all (already seen this session, or reduced motion). Use it to start your own intro animations. ```tsx "use client"; import { useState } from "react"; import { BootScreen } from "@/components/mpkcn/boot-screen"; export function Intro({ children }: { children: React.ReactNode }) { const [ready, setReady] = useState(false); return ( <> setReady(true)} />
{children}
); } ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `user` | `string` | "guest" | Username typed into the login box. | | `host` | `string` | "mpkcn.dev" | Host shown in the box title, which reads "Log in to {host}". | | `hints` | `{ key: string; label: string }[]` | ESC · ENTER · ANY KEY | Key-hint badges docked to the bottom. Defaults: ESC Reset, ENTER Start session, ANY KEY Skip. | | `matrix` | `boolean` | true | Play a short matrix rain after login. Skipped on low-power devices (4 cores or fewer, 4 GB memory or less, or Save-Data on). | | `oncePerSession` | `boolean` | true | Play only once per browser session, using the sessionStorage key "mpkcn-booted". | | `fullscreen` | `boolean` | true | Fixed overlay over the whole page. false fills the nearest positioned parent (for previews). | | `ignoreReducedMotion` | `boolean` | false | Play even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button. | | `onDone` | `() => void` | — | Called once when the screen finishes, is skipped, or is not shown at all. | | `className` | `string` | — | Extra classes for the root element. | ## Accessibility - Under `prefers-reduced-motion: reduce` the screen is skipped entirely and `onDone` fires right away, unless `ignoreReducedMotion` is set (the previews on this site only set it after you click "play anyway"). - Any key or pointer press skips it. In fullscreen mode it listens on the window; inside a box, only on itself. - Inside a box it is a focusable `button` labelled "Boot screen. Press any key or click to skip.", with a visible focus ring. - Once finished it is `aria-hidden`, fades out and unmounts, so it never traps focus or hides content from screen readers. - The box-drawing corners and the matrix canvas are decorative and hidden from assistive technology. --- # Case Card URL: https://blhasn-sehli.github.io/mpkcn/docs/components/case-card/ > A project case study card: name, one-liner, tags, links and a screenshot beside a spec-sheet list of features. ## Installation ```bash npx mpkcn add case-card ``` ## Usage One card per project. Stack several in a list; each one draws a hairline above and below, so neighbours share a line. ```tsx import { CaseCard } from "@/components/mpkcn/case-card"; export function Work() { return ( ); } ``` With `features`, the card splits into two columns once it is 768px wide (a container query, so it also stacks inside a narrow layout). Without them it stays one column. ## Examples ### Text only Leave out `image` and `features` for a short entry. A missing or broken `image.src` shows a striped "screenshot coming soon" placeholder instead. ```tsx ``` ### Placeholder ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `title` | `ReactNode` | — | Project name, shown large. | | `index` | `string` | — | Small number or tag above the title. | | `subtitle` | `ReactNode` | — | Mono line under the title. | | `description` | `ReactNode` | — | A sentence or two about the project. | | `role` | `ReactNode` | — | What you did on it, as a second paragraph. | | `tags` | `string[]` | [] | Tech or topic tags. | | `links` | `{ label; href; ariaLabel? }[]` | [] | Buttons under the tags; http(s) links open in a new tab. | | `image` | `{ src?; alt }` | — | Screenshot; a missing or broken src shows a placeholder. | | `media` | `ReactNode` | — | Your own media in place of image. | | `features` | `{ label; value }[]` | — | Spec rows in the second column. | | `headingLevel` | `2 \| 3 \| 4` | 3 | Heading level of the title. | | `className` | `string` | — | Extra classes for the card. | ## Accessibility - Each card is an `
` with a real heading; pick `headingLevel` to fit your page outline. - Tags are a list labelled "Tags", and features a description list, so each label is tied to its value. - Give links an `ariaLabel` like "Atlas source code" when several cards share the same "code" label. External links also say "(opens in a new tab)". - The placeholder is an image named by `image.alt`. Nothing in the card moves, so there is no motion to reduce. --- # Command Palette URL: https://blhasn-sehli.github.io/mpkcn/docs/components/command-palette/ > A terminal-style Ctrl+K command palette with groups, fuzzy word filtering and full keyboard control, as a dialog or inline. ## Installation ```bash npx mpkcn add command-palette ``` ## Usage Render it once, anywhere (a layout is a good place), and give it items. Ctrl+K (Cmd+K on macOS) opens it. ```tsx "use client"; import { useRouter } from "next/navigation"; import { useTheme } from "next-themes"; import { CommandPalette } from "@/components/mpkcn/command-palette"; export function Palette() { const router = useRouter(); const { setTheme } = useTheme(); return ( router.push("/docs") }, { label: "open github", group: "links", keywords: ["source"], onSelect: () => window.open("https://github.com/you") }, { label: "theme dark", group: "actions", onSelect: () => setTheme("dark") }, { label: "theme light", group: "actions", onSelect: () => setTheme("light") }, ]} /> ); } ``` Type to filter: every word of the query must appear in the label, group or `keywords`. ↑ ↓ move (and wrap), Home and End jump, Enter runs, Esc or a click outside closes. Items are listed under their `group`, in the order groups first appear. ## Examples ### Open it from a button Control it with `open` and `onOpenChange`. The hotkey keeps working alongside. ```tsx const [open, setOpen] = useState(false); ``` ### Inline `modal={false}` renders the panel in place, always visible, with no backdrop. The hotkey then focuses its input. ```tsx ``` ### Another shortcut `hotkey` is the key pressed with Ctrl or Cmd. Pass `false` if your site already uses Ctrl+K (this page does, so the previews above turn it off). ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `items` | `CommandItem[]` | — | { label, onSelect, id?, group?, hint?, shortcut?, keywords?, disabled? }. | | `open` | `boolean` | — | Controlled open state. | | `defaultOpen` | `boolean` | false | Initial open state when uncontrolled. | | `onOpenChange` | `(open: boolean) => void` | — | Called when it wants to open or close. | | `hotkey` | `string \| false` | "k" | Key pressed with Ctrl/Cmd to toggle it (focuses the input when inline). | | `modal` | `boolean` | true | Centered dialog over the page. false renders the panel inline. | | `placeholder` | `string` | "type a command…" | Placeholder of the search input. | | `emptyText` | `ReactNode` | "no match" | Shown when nothing matches. | | `prompt` | `string` | "$" | Prompt in front of the input. | | `label` | `string` | "Command palette" | Accessible name of the dialog and list. | | `footer` | `ReactNode \| false` | "↑↓ select · ⏎ run · esc close" | Key-hint footer; false hides it. | | `closeOnSelect` | `boolean` | true | Close the dialog after an item runs. | | `filter` | `(item, query) => boolean` | word match | Custom matcher. | | `className` | `string` | — | Extra classes for the panel. | ## Accessibility - Built on the ARIA combobox pattern: the input is a `combobox` that controls a `listbox` of `option`s, and `aria-activedescendant` follows the highlighted one, so focus never leaves the input. - Groups are `role="group"` with their heading as the label. Disabled items are `aria-disabled` and skipped by the arrow keys. - As a dialog it is `role="dialog"` with `aria-modal`, rendered in a portal. Focus moves to the input, Tab cannot leave, page scroll is locked, and focus goes back to where it was when it closes. - The picked command runs right after the dialog closes, so a command that moves focus or navigates is not undone by the focus return. --- # Cursor URL: https://blhasn-sehli.github.io/mpkcn/docs/components/cursor/ > A terminal-style pointer follower, a block caret with a trailing square ring and magnetic buttons, that steps aside for touch, text fields, the keyboard and reduced motion. ## Installation ```bash npx mpkcn add cursor ``` ## Usage Render it once, in your root layout. By default it follows the pointer across the whole window as a fixed layer that never catches clicks. ```tsx import { Cursor } from "@/components/mpkcn/cursor"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` A small amber block sits on the pointer and a square ring trails behind it. Mark buttons or links with `data-magnetic` and they lean toward the pointer while the ring grows and turns blue. ```tsx ``` ## Examples ### Inside a box Pass `contained` to follow the pointer only inside the nearest positioned parent. Give the parent `position: relative`. ```tsx
``` ### Hide the system cursor `hideNativeCursor` hides the system arrow while the custom cursor is visible. Text fields (inputs, textareas, selects and `contenteditable`) always keep the system I-beam, and the custom cursor steps aside over them. ```tsx ``` ### No magnets, snappier ring ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `contained` | `boolean` | false | Fill the nearest positioned parent and follow the pointer only inside it, instead of the whole window. | | `magnetic` | `boolean` | true | Pull elements marked data-magnetic toward the pointer and grow the ring over them. Their inline transform is replaced while hovered. | | `hideNativeCursor` | `boolean` | false | Hide the system cursor while the custom one is active. Text fields always keep the system cursor. | | `lag` | `number` | 0.16 | How fast the ring catches up with the pointer, from 0 (never) to 1 (instantly). | | `ignoreReducedMotion` | `boolean` | false | Run even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button. | | `className` | `string` | — | Extra classes for the wrapper, e.g. a different z-index (default z-[90]). | ## Accessibility - It only runs for a real mouse: on touch screens and coarse pointers (`hover: none`, `pointer: coarse`) it never starts, and pen or touch events are ignored. - Under `prefers-reduced-motion: reduce` and on low-power devices (4 cores or fewer, 4 GB memory or less, Save-Data on, or ``) it stays off, unless `ignoreReducedMotion` is set. - Over text fields it hides itself and the system I-beam and caret stay. Pressing Tab, or typing in a field, hides it until the mouse moves again, so the focus ring is never covered. - It is `aria-hidden`, has `pointer-events: none`, and the ring only animates while it is catching up, so it costs nothing when the mouse is still. --- # Env Card URL: https://blhasn-sehli.github.io/mpkcn/docs/components/env-card/ > Contact or config details shown as a syntax-colored .env file, with links, copy buttons and masked secrets. ## Installation ```bash npx mpkcn add env-card ``` ## Usage Pass the lines of the file. A line is a variable (`key` and `value`) or a `comment`. ```tsx import { EnvCard } from "@/components/mpkcn/env-card"; export function Contact() { return ( ); } ``` Keys are amber, values blue and in quotes. Numbers and `true` / `false` print bare, in amber, like a real `.env` highlighter would. ## Examples ### Links and copy `href` turns a value into a link (`http(s)` links open in a new tab). Every variable gets a copy button unless you set `copyable={false}` on the card or `copy: false` on the line. `copyValue` copies something other than what is shown, such as the full URL behind a short one. ```tsx { key: "SITE", value: "you.dev", href: "https://you.dev", copyValue: "https://you.dev" } ``` ### Secrets `secret: true` masks the value with dots behind a show / hide toggle. The copy button still copies the real value, so people can grab a key without it ever showing on screen. ```tsx { key: "API_TOKEN", value: token, secret: true } ``` The value is still in the page's JavaScript: masking keeps it off the screen, not out of the browser. Never pass a real server secret to a client component. ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `entries` | `(EnvEntry \| { comment: string })[]` | — | Lines of the file, top to bottom. | | `filename` | `string \| null` | ".env" | File name in the header. null hides the header. | | `lineNumbers` | `boolean` | true | Show line numbers (hidden when the card is narrow). | | `copyable` | `boolean` | true | Give every variable a copy button unless the line says otherwise. | | `maskChar` | `string` | "•" | Character used to mask secrets. | | `actions` | `ReactNode` | — | Extra content on the right of the header. | | `className` | `string` | — | Extra classes for the card. | `EnvEntry` is `{ key: string; value: string; href?: string; secret?: boolean; copy?: boolean; copyValue?: string; live?: boolean; comment?: string }`. `live` adds a blinking dot before the value; `comment` adds a trailing `# comment` on wide cards. ## Accessibility - Copy and show / hide are real buttons named after the variable ("Copy EMAIL", "Show API_TOKEN"), with a visible focus ring. The toggle reports its state with `aria-pressed`. - A masked value is read as "hidden value", never as a string of dots. - The result of a copy ("EMAIL copied to clipboard", or a failure) is announced through a polite live region, and the button label changes for two seconds. - Line numbers are decorative and hidden. The live dot stops blinking under `prefers-reduced-motion: reduce`. --- # Eyebrow URL: https://blhasn-sehli.github.io/mpkcn/docs/components/eyebrow/ > A small mono label for above a heading that types itself out, with a block cursor, as it scrolls into view. ## Installation ```bash npx mpkcn add eyebrow ``` ## Usage Put it right above a section heading: ```tsx import { Eyebrow } from "@/components/mpkcn/eyebrow"; export function Work() { return (

Things I built

); } ``` Each time the label scrolls into view (80% visible) it clears and types itself back in at 32ms per character, with a blinking block cursor. The server renders the full text, so it is there before JavaScript runs. ## Examples ### Custom text ```tsx ``` ### Type once, slower `replay={false}` types it only the first time; `speed` sets the milliseconds per character. ```tsx ``` ### Static label `typing={false}` keeps the style and drops the animation. ```tsx ``` ### As a heading The default element is a `p`. Pass `as` when the label is part of your outline: ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `text` | `string` | — | The label, e.g. "// 02 — projects". | | `as` | `React.ElementType` | "p" | Element to render. Use "h2" or similar when the label is part of your heading structure. | | `typing` | `boolean` | true | Type the label in when it scrolls into view. false shows it as plain text. | | `speed` | `number` | 32 | Milliseconds per typed character. | | `replay` | `boolean` | true | Clear the label when it leaves the viewport, so it types again next time. | | `ignoreReducedMotion` | `boolean` | false | Type even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button. | | `className` | `string` | — | Extra classes for the root element. | ## Accessibility - Screen readers get the full label once, from a visually hidden copy. The typed characters and the cursor are `aria-hidden`, so nothing is announced letter by letter. - The untyped part of the text is still laid out (invisible), so the line never changes width or wraps differently while typing. - Under `prefers-reduced-motion: reduce` the label is simply shown, with no typing and no cursor. - Server and client render the same full text, so there is no hydration mismatch. --- # Feature List URL: https://blhasn-sehli.github.io/mpkcn/docs/components/feature-list/ > A spec-sheet list of label and value rows between hairlines, sliding in one by one. ## Installation ```bash npx mpkcn add feature-list ``` ## Usage ```tsx import { FeatureList } from "@/components/mpkcn/feature-list"; export function ProjectFacts() { return ( ); } ``` Each row is a label on the left (bright) and a value on the right (dimmed), between hairlines. When a third of the list is in view, the rows slide in from the left one by one, 80ms apart. ## Examples ### Without animation ```tsx ``` ### Rich values `label` and `value` take any React node, such as links or badges. ```tsx github.com/you/app }, { label: "Status", value: beta }, ]} /> ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `items` | `{ label: React.ReactNode; value: React.ReactNode }[]` | — | Rows to show, top to bottom. | | `animate` | `boolean` | true | Slide the rows in one after another when the list scrolls into view. | | `stagger` | `number` | 0.08 | Seconds between rows. | | `once` | `boolean` | true | Animate only the first time it scrolls into view. | | `ignoreReducedMotion` | `boolean` | false | Animate even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button. | | `className` | `string` | — | Extra classes for the list. | ## Accessibility - Rendered as a description list: each row is a `div` holding a `dt` (label) and a `dd` (value), so screen readers announce the pairs together. - Under `prefers-reduced-motion: reduce` the rows don't slide, they only fade in. - Server and client render the same markup, so there is no hydration mismatch. --- # Fetch Card URL: https://blhasn-sehli.github.io/mpkcn/docs/components/fetch-card/ > A neofetch-style info card: ASCII art, a user@host header, key / value rows and a palette strip, with lines that slide in and art that tilts towards the pointer. ## Installation ```bash npx mpkcn add fetch-card ``` ## Usage Pass ASCII art and the rows. The header reads `user@host`. ```tsx import { FetchCard } from "@/components/mpkcn/fetch-card"; const ART = ` /\\_/\\ ( o.o ) > ^ <`; export function About() { return ( ); } ``` A string `art` is split into lines that slide in one after another. Leading and trailing blank lines are trimmed, so you can start the template literal on a new line. Set its size with `artClassName` (block-letter logos usually need `text-[9px]` to `text-[11px]`). Any other node works as art too: an ``, an SVG, an `AsciiImage`. ## Examples ### Amber, without the palette ```tsx ``` ### Your own header `title` replaces the `user@host` line, for a name or a link. ```tsx read more} rows={rows} art={ART} /> ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `art` | `ReactNode` | — | ASCII art on the left. A string is split into lines. | | `artLabel` | `string` | — | Accessible name for the art. Without it the art is hidden from screen readers. | | `user` | `string` | "guest" | User part of the header. | | `host` | `string` | "localhost" | Host part of the header. | | `title` | `ReactNode` | — | Replaces the user@host header. | | `rows` | `{ label: string; value: ReactNode }[]` | — | Key / value rows under the header. | | `palette` | `boolean` | true | Show the strip of theme color swatches. | | `tone` | `"blue" \| "amber"` | "blue" | Accent of the art and header. | | `animate` | `boolean` | true | Slide the lines in when the card scrolls into view. | | `tilt` | `boolean` | true | Tilt the art in 3D towards a mouse pointer. | | `ignoreReducedMotion` | `boolean` | false | Animate even under reduced motion. Only use it behind an explicit action. | | `className` | `string` | — | Extra classes for the root. | | `artClassName` | `string` | "text-[11px]" | Classes for the art (font size, line height). Replaces the default size. | ## Accessibility - The rows are a description list, so each label is tied to its value. - ASCII art is noise to a screen reader: it is hidden unless you give it an `artLabel`, which turns it into an image with that name. - The palette strip and the rule under the header are decorative and hidden. - Under `prefers-reduced-motion: reduce` nothing slides and the art does not tilt. Touch input never tilts it. --- # File Explorer URL: https://blhasn-sehli.github.io/mpkcn/docs/components/file-explorer/ > A ranger-style file browser with Miller columns, a preview pane, a path bar and a / filter, driven entirely from the keyboard. ## Installation ```bash npx mpkcn add file-explorer ``` ## Usage Give it a tree of folders (nodes with `children`) and files. Each folder opens in the next column; the selected file shows in the preview pane. ```tsx import { FileExplorer } from "@/components/mpkcn/file-explorer"; const tree = [ { name: "projects", children: [ { name: "atlas", meta: "2026", description: "A map viewer that works offline.", image: { src: "/shots/atlas.png", alt: "Atlas map view" }, details: [ { label: "status", value: "shipped" }, { label: "stack", value: "Next.js, MapLibre" }, ], href: "https://atlas.example.com", }, ], }, { name: "readme.md", description: "Hello." }, ]; export function Projects() { return ; } ``` The built-in preview shows `image`, the name, `description`, `details` and an `href` link. Give one file a `preview` to replace it, or pass `renderPreview` to draw every preview yourself. ## Examples ### Open a file `onOpen` runs on Enter or double click on a file, and adds an "open" button to the preview. In the demo above it opens the project pictures in a [Media Lightbox](/docs/components/media-lightbox/). ```tsx router.push(`/work/${node.id}`)} /> ``` ### Narrow widths Below 672px of its own width (a container query), it shows one column at a time above the preview, with a `‹ ..` button to go back up. ```tsx ``` ### Your own preview `renderPreview` gets the selected file and the path to it. ```tsx (

$ stat {path.map((n) => n.name).join("/")}

)} /> ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `items` | `FileNode[]` | — | Top-level files and folders. A node with `children` is a folder. | | `root` | `string` | "~" | Root shown at the start of the path bar. | | `defaultPath` | `string[]` | first at each level | Ids (or names) of the starting selection, top level first. | | `maxColumns` | `number` | 3 | Most columns side by side on wide screens. | | `height` | `number \| string` | 420 | Height of the browser body. | | `onSelect` | `(node, path) => void` | — | Called when the selected file changes. | | `onOpen` | `(node, path) => void` | — | Called on Enter or double click on a file. | | `renderPreview` | `(node, path) => ReactNode` | — | Your own preview for every file. | | `filter` | `boolean` | true | Let / open a filter box. | | `label` | `string` | "File explorer" | Accessible name of the whole browser. | | `className` | `string` | — | Extra classes for the outer box. | `FileNode` is `{ name; id?; meta?; children?; keywords?; description?; image?: { src; alt? }; details?: { label; value }[]; href?; preview? }`. `id` defaults to `name` and only needs to be unique among its siblings. ## Accessibility - Each column is a `listbox` named after its folder, and each row an `option` with `aria-selected`. Only the selected row of each column is in the Tab order, so Tab moves from column to column and then into the preview. - ↑ ↓ Home End move, → or Enter go into a folder (Enter on a file calls `onOpen`, → moves to the preview), ← or Esc go back. / opens the filter; Esc clears it and Enter jumps to the results. The match count is a `status` region. - The preview is a labelled region you can focus and scroll with the keyboard. - The picture wipe and the blinking row cursor are skipped under `prefers-reduced-motion`. --- # Grain URL: https://blhasn-sehli.github.io/mpkcn/docs/components/grain/ > A static film-grain overlay in two blend layers that stays visible on both the dark and the light theme, at no per-frame cost. ## Installation ```bash npx mpkcn add grain ``` ## Usage Render it once, in your root layout. It covers the whole viewport as a fixed layer above the page and never catches clicks. It has no state, so it also works in a Server Component. ```tsx import { Grain } from "@/components/mpkcn/grain"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` The noise is two layers of the same SVG tile: a `screen` layer that lifts dark pixels and a `multiply` layer that darkens light ones. A single `overlay` layer almost disappears on a near-black background; the pair stays visible on both themes. The tile is a background image, so it is drawn once and costs nothing per frame. ## Examples ### Inside a box Pass `contained` to fill the nearest positioned parent instead of the viewport. Add `isolate` to the parent to blend only with what is inside it. ```tsx

A little texture on flat colors.

``` ### Stronger and coarser ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `contained` | `boolean` | false | Fill the nearest positioned parent instead of covering the whole viewport as a fixed overlay. | | `intensity` | `number` | 1 | Strength multiplier: 1 is the subtle default, 2 doubles it, 0 hides it. | | `size` | `number` | 160 | Size of the repeating noise tile in px. Smaller is finer grain. | | `className` | `string` | — | Extra classes for both noise layers, e.g. a different z-index (default z-[100]). | ## Accessibility - Both layers are `aria-hidden` and `pointer-events: none`: nothing to read, nothing to click through. - The grain is static, so there is nothing to turn off for reduced motion. - The default strength (4% and 2% on dark, 2% and 5% on light) is a texture, not a filter: text contrast stays the same. Keep `intensity` low over body text. - It is hidden when printing. --- # Image Placeholder URL: https://blhasn-sehli.github.io/mpkcn/docs/components/image-placeholder/ > A framed image slot that shows a striped placeholder with a mono label until the image exists or when it fails to load. ## Installation ```bash npx mpkcn add image-placeholder ``` ## Usage ```tsx import { ImagePlaceholder } from "@/components/mpkcn/image-placeholder"; export function ProjectCard() { return ; } ``` While `src` is empty, or if the file fails to load, the box shows faint diagonal stripes and a mono label in the corner. Once the image loads it fills the frame (`object-fit: cover`). So you can lay out a page before the screenshots exist, then drop the files in. ## Examples ### Wide, with a custom label ```tsx ``` ### Size it yourself `aspectRatio={null}` drops the built-in ratio so your classes decide the size. ```tsx ``` ### With next/image The component uses a plain `` so it works in any React app. In Next.js you can swap that tag for `next/image` with `fill` in your copy of the file. ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `src` | `string` | — | Image URL. When it is missing or fails to load, the striped placeholder shows instead. | | `alt` | `string` | — | Alt text for the image. Also the accessible name of the placeholder. | | `label` | `string` | "image coming soon" | Text shown in the placeholder's bottom-left corner. | | `aspectRatio` | `string \| null` | "4 / 5" | CSS aspect-ratio of the box, e.g. "16 / 10". null lets your className set the size. | | `className` | `string` | — | Extra classes for the box (width, height, margins). | ## Accessibility - With an image, the `` carries your `alt` text as usual. - Without one, the box is `role="img"` named by the same `alt`, so screen readers still know what belongs there. The stripes and the corner label are `aria-hidden`. - A load error that happens before hydration is caught too, so a broken URL never shows the browser's broken-image icon for long. --- # Kbd URL: https://blhasn-sehli.github.io/mpkcn/docs/components/kbd/ > A keyboard key badge with a thick bottom edge, for single keys or combos like Ctrl + K. ## Installation ```bash npx mpkcn add kbd ``` ## Usage ```tsx import { Kbd } from "@/components/mpkcn/kbd"; export function SearchHint() { return (

Press to search.

); } ``` `Kbd` is a plain server-friendly component: no state, no effects, no `"use client"`. ## Examples ### Single key ```tsx Enter ↵ ``` ### Combos and separators An array renders one badge per key. `separator` changes what goes between them, for example `/` for alternatives or `then` for sequences. ```tsx ``` ### Inline in small text Use `size="sm"` inside captions and footers. ```tsx

press for shortcuts

``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `keys` | `string \| string[]` | — | The key, or the keys of a combo, e.g. "K" or ["Ctrl", "K"]. Ignored when children is set. | | `children` | `React.ReactNode` | — | Custom content for a single key. Takes precedence over keys. | | `separator` | `React.ReactNode` | "+" | Text shown between the keys of a combo. | | `size` | `"sm" \| "md"` | "md" | "sm" for inline hints in small text, "md" for body text. | | `className` | `string` | — | Extra classes for the outer element. | ## Accessibility - Renders the semantic `` element. A combo is one outer `` wrapping one `` per key, as the HTML spec describes for key combinations. - The separator is real text, so a screen reader reads "Ctrl + K" rather than "Ctrl K". - It is not interactive and takes no focus. If you want the badge to trigger the shortcut on click, wrap it in a `button` with a label. --- # Konami URL: https://blhasn-sehli.github.io/mpkcn/docs/components/konami/ > A useKonami hook and an easter-egg component that fires a callback and plays matrix rain when someone types the Konami code. ## Installation ```bash npx mpkcn add konami ``` ## Usage Drop the component anywhere. Typing ↑ ↑ ↓ ↓ ← → ← → B A on the page plays a few seconds of matrix rain. ```tsx import { Konami } from "@/components/mpkcn/konami"; export default function Layout({ children }: { children: React.ReactNode }) { return ( <> {children} console.log("cheat unlocked")} /> ); } ``` A click or any key ends the rain early. Keys typed into fields are ignored. ## Examples ### Just the hook `useKonami` calls your function on a match and returns how many keys are matched so far, so you can show progress or trigger anything else. ```tsx "use client"; import { useState } from "react"; import { useKonami } from "@/components/mpkcn/konami"; export function Secret() { const [unlocked, setUnlocked] = useState(false); const matched = useKonami(() => setUnlocked(true)); return

{unlocked ? "+30 lives" : `${matched}/10`}

; } ``` ### Your own sequence `sequence` takes `KeyboardEvent.key` values, letters in lower case. ```tsx setTheme("light")} /> ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `onActivate` | `() => void` | — | Called each time the code is entered. | | `sequence` | `string[]` | KONAMI_CODE | Keys to match, as KeyboardEvent.key values. | | `enabled` | `boolean` | true | Listen at all. | | `rain` | `boolean` | true | Play matrix rain on a match. | | `duration` | `number` | 6000 | How long the rain lasts, in milliseconds. | | `fullscreen` | `boolean` | true | Rain over the viewport. false fills the nearest positioned parent. | | `ignoreReducedMotion` | `boolean` | false | Rain even under reduced motion. Only use it behind an explicit action. | | `onProgress` | `(matched: number) => void` | — | Number of keys matched so far. | `useKonami(onMatch, { sequence?, enabled?, ignoreInputs? })` returns the matched count. `KONAMI_CODE` is exported too. ## Accessibility - Under `prefers-reduced-motion: reduce` there is no rain, but `onActivate` still fires. - The rain is decorative: `aria-hidden`, never focusable, and gone after `duration` or on the first click or key. - Keys typed into inputs, textareas, selects and editable content never count, so the code cannot fire while someone types. --- # Letter Reveal URL: https://blhasn-sehli.github.io/mpkcn/docs/components/letter-reveal/ > Splits a heading into letters that spring up and flip into place one after another. ## Installation ```bash npx mpkcn add letter-reveal ``` ## Usage ```tsx import { LetterReveal } from "@/components/mpkcn/letter-reveal"; export function Hero() { return ; } ``` Each letter starts 0.7em low, tilted back 80°, and springs into place (stiffness 260, damping 18), 35ms after the one before it. Words never break in the middle. Hovering a letter lifts it and turns it blue. ## Examples ### Slower stagger ```tsx ``` ### Replay on every scroll `trigger="view"` plays the reveal each time the text comes back into view. ```tsx ``` ### Wait for an intro `play={false}` keeps the letters hidden until you flip it, for example when a [Boot Screen](/docs/components/boot-screen/) finishes: ```tsx "use client"; import { useState } from "react"; import { BootScreen } from "@/components/mpkcn/boot-screen"; import { LetterReveal } from "@/components/mpkcn/letter-reveal"; export function Hero() { const [booted, setBooted] = useState(false); return ( <> setBooted(true)} /> ); } ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `text` | `string` | — | The text to animate. Spaces are kept and words never break mid-word. | | `as` | `React.ElementType` | "span" | Element to render, e.g. "h1" for a hero heading. | | `delay` | `number` | 0 | Seconds before the first letter starts. | | `stagger` | `number` | 0.035 | Seconds between letters. | | `trigger` | `"mount" \| "view"` | "mount" | "mount" plays once on load; "view" replays every time the text scrolls into view. | | `play` | `boolean` | true | Hold the letters hidden until this turns true. Only used with trigger "mount". | | `hover` | `boolean` | true | Letters hop up and turn blue on hover. | | `ignoreReducedMotion` | `boolean` | false | Animate even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button. | | `className` | `string` | — | Extra classes for the root element. | ## Accessibility - Screen readers read the text once, whole, from a visually hidden copy. The letter spans are `aria-hidden`, so the heading is never spelled out letter by letter. - Under `prefers-reduced-motion: reduce` nothing moves or flips: the letters only fade in, and the hover hop is reduced to the color change. - Server and client render the same markup, so there is no hydration mismatch. > The letters start at opacity 0 until JavaScript runs. The hidden copy keeps the text available to screen readers and search engines, but sighted users without JavaScript see an empty heading. --- # Media Lightbox URL: https://blhasn-sehli.github.io/mpkcn/docs/components/media-lightbox/ > An accessible image and video lightbox with arrows, keyboard and swipe navigation, thumbnails, click-to-zoom and a focus trap. ## Installation ```bash npx mpkcn add media-lightbox ``` ## Usage You own the open state and the thumbnails; the lightbox only shows the items. Set `startIndex` to the one that was clicked. ```tsx "use client"; import { useState } from "react"; import { MediaLightbox } from "@/components/mpkcn/media-lightbox"; const shots = [ { src: "/shots/home.png", alt: "Home screen", caption: "home" }, { src: "/shots/demo.mp4", type: "video" as const, poster: "/shots/demo.png", caption: "demo" }, ]; export function Gallery() { const [open, setOpen] = useState(false); const [start, setStart] = useState(0); return ( <> {shots.map((s, i) => ( ))} ); } ``` By default it is a fullscreen overlay rendered into `document.body`, and the page behind it stops scrolling. ## Examples ### Inside a box `portal={false}` fills the nearest positioned parent instead of the screen (give the parent `position: relative`). That is how the preview above works. `onIndexChange` keeps the gallery behind it in sync: the outlined thumbnail is the last one you looked at. ```tsx
``` ### No loop, no zoom `loop={false}` stops at both ends (the arrows turn off), `zoom={false}` keeps images at their fitted size and `thumbnails={false}` hides the strip. ```tsx ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `items` | `{ src; type?; alt?; poster?; caption? }[]` | — | Images and videos, in order. | | `open` | `boolean` | — | Whether the lightbox is shown. | | `onOpenChange` | `(open: boolean) => void` | — | Called when it wants to close (Esc, ✕, backdrop click). | | `startIndex` | `number` | 0 | Item shown first each time it opens. | | `onIndexChange` | `(index: number) => void` | — | Called whenever the shown item changes. | | `title` | `string` | "Media" | Top-bar title and accessible name of the dialog. | | `loop` | `boolean` | true | Wrap from the last item to the first and back. | | `thumbnails` | `boolean` | true | Strip of thumbnails at the bottom. | | `zoom` | `boolean` | true | Click an image to zoom 2× on that spot. | | `portal` | `boolean` | true | Fullscreen in document.body; false fills the positioned parent. | | `className` | `string` | — | Extra classes for the dialog. | ## Accessibility - It is a `role="dialog"` with `aria-modal`, named by its title. Opening it focuses the close button; Tab and Shift+Tab stay inside it; closing puts focus back on the element that opened it. - ← → move, Home and End jump to the ends, Esc closes. While a video has focus, the arrow keys go to the video's own controls. - Every button has a label ("Previous", "Next", "Close", and each thumbnail's alt text); the current thumbnail has `aria-current`. A polite live region reads out the item and its position, e.g. "Mountains at dusk, 4 of 4". - Images use `alt`, then `caption`, then "Image n". Videos never autoplay. - Zoom and the thumbnail scroll are instant under `prefers-reduced-motion`. --- # Parallax Image URL: https://blhasn-sehli.github.io/mpkcn/docs/components/parallax-image/ > An image in a viewfinder frame that drifts with the pointer and with scroll, and holds still under reduced motion. ## Installation ```bash npx mpkcn add parallax-image ``` ## Usage Pass an image. Move the mouse over the preview and scroll the page to see both layers. ```tsx import { ParallaxImage } from "@/components/mpkcn/parallax-image"; export function Portrait() { return ( -- NORMAL --scan_ok} className="w-full max-w-md" /> ); } ``` Two layers move the picture: the pointer layer eases towards the mouse (relative to the window by default, or to the image with `pointerArea="element"`), and the scroll layer drifts it by `scroll` pixels while the frame crosses the viewport. The picture is enlarged by the biggest shift so its edges never show. ## Examples ### Stronger, without corners ```tsx ``` ### Anything as the picture Leave out `src` and pass children that fill the box: `next/image` with `fill`, a canvas, an `ImagePlaceholder`. ```tsx … ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `src` | `string` | — | Image URL. Leave it out to pass children. | | `alt` | `string` | "" | Alt text for the image. "" marks it decorative. | | `children` | `ReactNode` | — | Content to move instead of an image. Should fill its box. | | `pointer` | `number` | 12 | Largest pointer shift in px. 0 turns it off. | | `pointerArea` | `"window" \| "element"` | "window" | What the pointer position is measured against. | | `scroll` | `number` | 40 | Vertical drift in px across the viewport. 0 turns it off. | | `corners` | `boolean` | true | Draw the four viewfinder corners. | | `caption` | `ReactNode` | — | Bar at the bottom over the image. | | `aspectRatio` | `string \| null` | "4 / 5" | CSS aspect-ratio of the frame. null lets className size it. | | `ignoreReducedMotion` | `boolean` | false | Move even under reduced motion. Only use it behind an explicit action. | | `className` | `string` | — | Extra classes for the frame. | ## Accessibility - Give the image a real `alt`, or `""` if it is decorative. The corners are hidden from screen readers; the caption is read as text. - Under `prefers-reduced-motion: reduce` both layers stop and the image sits still at its normal size. - Touch screens never get the pointer layer. The pointer layer stops its animation frame loop once it has caught up, so a still mouse costs nothing. --- # Prompt Footer URL: https://blhasn-sehli.github.io/mpkcn/docs/components/prompt-footer/ > A site footer laid out as a shell session: ls prints your link columns, date the copyright and an optional live clock, and the last prompt blinks. ## Installation ```bash npx mpkcn add prompt-footer ``` ## Usage A footer that reads like a shell session. `ls` prints your link columns, `date` your copyright, and the last prompt waits with a blinking cursor. ```tsx import Link from "next/link"; import { PromptFooter } from "@/components/mpkcn/prompt-footer"; export function Footer() { return ( ); } ``` Links that start with `http` open in a new tab. Internal links use `linkComponent` when you pass one (next/link fits), plain `` otherwise. ## Examples ### Now block and clock `now` prints a few `label: value` lines as `cat now.txt`. `clock` adds a live HH:MM:SS clock on the date line; with `timeZone` and `clockLabel` it can show your own local time. ```tsx ``` ### Your own last line Anything you pass as `children` replaces the cursor after the last prompt, for example a status or a small input. ```tsx all systems normal ``` ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `user` | `string` | "guest" | User in the prompt. | | `host` | `string` | "localhost" | Host in the prompt. | | `path` | `string` | "~" | Working directory in the prompt. | | `groups` | `{ title; links: { label; href }[] }[]` | [] | Link columns, printed as the output of ls. | | `now` | `{ label; value }[]` | — | Lines printed as the output of cat now.txt. | | `owner` | `string` | — | Name after the © sign; leave it out to hide the copyright. | | `year` | `number` | current year | Year in the copyright. | | `note` | `ReactNode` | — | Text after the copyright. | | `clock` | `boolean` | false | Live HH:MM:SS clock on the date line. | | `timeZone` | `string` | visitor's own | IANA time zone for the clock. | | `clockLabel` | `string` | — | Text before the clock. | | `backToTop` | `boolean` | true | A cd ~ ↑ button that scrolls the window to the top. | | `children` | `ReactNode` | — | Content after the last prompt, in place of the cursor. | | `linkComponent` | `ComponentType<{ href; className; children }>` | "a" | Your link component for internal links, e.g. next/link. | | `className` | `string` | — | Extra classes for the footer. | ## Accessibility - It renders a `