nook
Browse the docs

Customizing components

The code lives in your project, so you can change anything. These are the patterns Nook is built around.

Add a variant

Variants are defined in one place, at the top of the file:

export const buttonVariants = cva("inline-flex items-center ...", {
  variants: {
    variant: {
      default: "bg-primary text-primary-foreground",
      // add yours:
      brand: "bg-accent text-accent-foreground border border-primary",
    },
  },
});

TypeScript picks the new value up automatically.

Compose parts

Components are built from parts, not long prop lists. Rearrange or leave parts out:

<Card>
  <CardHeader>
    <CardTitle>Plan</CardTitle>
  </CardHeader>
  <CardContent>...</CardContent>
</Card>

Override with className

Classes you pass win over the defaults, because Nook merges them with tailwind-merge:

<Button className="rounded-full">Pill</Button>

Style anything as a button

buttonVariants() returns the class names, so a link or a router link can look like a button:

<a href="/pricing" className={buttonVariants({ size: "lg" })}>See pricing</a>

Use your own icons

Every component takes icons from a single module (components/icons.tsx by default). Replace its contents with another set and keep the export names.

Change the behavior engine

Nook wraps Base UI in its own API. Components expose Nook names (DialogContent, not Dialog.Popup), so the engine can change without breaking your imports.