Skip to content
nexubDesign System
v11.9.0

Getting Started

Next.js and server components

Since 3.1, @nexub/react and @nexub/marketing ship one file per module, each with its own 'use client' or none. Presentational components (Heading, Text, Container, Section, Stack, Badge, EyebrowChip, Logo, Float, Marquee and the marketing sections) render as React Server Components; interactive ones stay client components.

CSS with Tailwind 4

CSS
/* app/globals.css */
@import "tailwindcss";
@import "@nexub/tokens/tailwind.css";
@import "@nexub/themes/core" layer(base);      /* resets, no fonts, no page backdrop */
@import "@nexub/themes/light" layer(base);
@import "@nexub/themes/dark" layer(base);
@import "@nexub/themes/marketing" layer(base); /* marketing pages only */
@source "../node_modules/@nexub/react/dist";
@source "../node_modules/@nexub/marketing/dist";

Fonts from next/font

@nexub/themes/base self-hosts Plus Jakarta Sans, the one Nexub typeface; @nexub/themes/core leaves fonts to you. With next/font, name its variables after the tokens:

TSX
import { Plus_Jakarta_Sans } from 'next/font/google';
// One typeface; the two calls only name the two token variables (the files are shared).
const sans = Plus_Jakarta_Sans({ subsets: ['latin'], variable: '--font-family-sans' });
const display = Plus_Jakarta_Sans({ subsets: ['latin'], variable: '--font-family-display' });

<html className={`${sans.variable} ${display.variable}`}>…</html>

Import per component

Next.js sends every client component a barrel import can reach to the browser. Import each component from its own entry point, or let Next.js do it for you:

TSX
import { Button } from '@nexub/react/Button';
import { Hero } from '@nexub/marketing/Hero';
import { cn } from '@nexub/react/cn';

// or, keeping barrel imports:
// next.config.mjs
export default {
  experimental: { optimizePackageImports: ['@nexub/react', '@nexub/marketing', '@nexub/icons'] },
};

Measured in a fresh Next.js 15.5 app with Hero, StatBand and CTABand: 181 kB of page JavaScript through barrels, 19.4 kB either way above, with only Button and NumberTicker sent to the browser.

Server component rules

  • Compound components (Accordion.Root, TopNav.Root, DropdownMenu.Root) are client components: use them inside your own 'use client' file, or use the sections that wrap them (FAQ, MarketingNav).

  • Helpers exported next to a client component (buttonVariants, cardVariants) can’t be called in a server component. cn can.

  • Event handlers (onClick) need a client component; a link (Button asChild around an a) does not.