Installation

One package. A shared foundation for your apps.

1. Authenticate

GitHub Packages requires authentication even for public npm packages. Create a classic GitHub token with read:packages using an account that can access the package. Configure the registry with an environment-variable placeholder, never the token itself.

.npmrc
@jnpll:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

Supply NODE_AUTH_TOKEN in your shell before installing. This Bash/zsh prompt keeps the token out of shell history and terminal output. npm does not load Next.js .env.local files.

shell
printf 'GitHub package token: '
read -rs NODE_AUTH_TOKEN
printf '\n'
export NODE_AUTH_TOKEN

2. Add the dependency

Version 0.4.1 is available from GitHub Packages. React 19 and Tailwind CSS 4 are required. No local library checkout is needed.

shell
npm install @jnpll/elements-ui@0.4.1

3. Connect the theme

Import the stylesheet in your global CSS, after Tailwind. Adjust the source path relative to that file so Tailwind scans the package classes.

globals.css
@import "tailwindcss";
@import "@jnpll/elements-ui/themes.css";

@source "../../node_modules/@jnpll/elements-ui/dist";

4. Import a component

tsx
import { Button } from "@jnpll/elements-ui/button";

export function SaveAction() {
  return <Button>Save changes</Button>;
}

Import components through their package exports. For Next.js, place interactive examples in a client component. Add the dark class to the document element for dark mode.

Deploy to Vercel

Create a dedicated classic GitHub token with only read:packages. In your Vercel project settings, add NODE_AUTH_TOKEN as a sensitive environment variable for Production and Preview, then redeploy. Keep the token out of source control and never prefix it with NEXT_PUBLIC_. The .npmrc above authenticates package installation during the build.

Theme switching

Available in version 0.4.1. The themes.css import loads all bundled palettes. Wrap your app once with the provider; the selector applies and remembers a palette without changing light/dark mode.

tsx
"use client";
import { ElementsThemeProvider } from "@jnpll/elements-ui/theme-provider";
import { ThemeSelector } from "@jnpll/elements-ui/theme-selector";

export function App({ children }) {
  return <ElementsThemeProvider storageKey="my-app-design">
    <ThemeSelector />
    {children}
  </ElementsThemeProvider>;
}
tsx
import { useElementsTheme } from "@jnpll/elements-ui/theme-provider";

const { selection, setTheme } = useElementsTheme();
setTheme({ theme: "britanniae", palette: "arthur" });

Use semantic color and geometry tokens throughout your app. Customize defaultSelection, storageKey, persist, or the themes registry on the provider. For server-rendered apps, insert getElementsThemeScript from the themes export in the document head using the same options to restore selections before paint.

Explore Button