Getting started

Base's look built on Native Shell (nsh): native views on every platform, and on the web through WebAssembly. Set a project up for Shell once, then add its components and blocks from their pages.

Shell is built on Native Shell: TSX that nsh draws with native views on every platform, and on the web with WebAssembly. Its components wrap nsh/base's parts, and a project copies their source: there's no CLI for nsh systems.

1. Add the theme

Save Shell's theme next to your nsh.json. It sets the tokens its classes name in light and dark mode, like primary, and its spacing scale as tokens, like --space-lg: nsh has no named spacing steps, so classes name the token instead.

theme.json
{
  "cssVars": {
    "theme": {
      "radius": "0",
      "space-3xs": "2px",
      "space-2xs": "4px",
      "space-xs": "6px",
      "space-sm": "8px",
      "space-md": "12px",
      "space-lg": "16px",
      "space-xl": "24px",
      "space-2xl": "32px",
      "space-3xl": "48px",
      "space-4xl": "64px"
    },
    "light": {
      "background": "oklch(1 0 0)",
      "foreground": "oklch(0.145 0 0)",
      "surface": "oklch(0.985 0 0)",
      "surface-foreground": "oklch(0.145 0 0)",
      "card": "oklch(1 0 0)",
      "card-foreground": "oklch(0.145 0 0)",
      "overlay": "oklch(1 0 0)",
      "overlay-foreground": "oklch(0.145 0 0)",
      "primary": "oklch(0.205 0 0)",
      "primary-foreground": "oklch(0.985 0 0)",
      "secondary": "oklch(0.97 0 0)",
      "secondary-foreground": "oklch(0.205 0 0)",
      "muted": "oklch(0.97 0 0)",
      "muted-foreground": "oklch(0.556 0 0)",
      "accent": "oklch(0.97 0 0)",
      "accent-foreground": "oklch(0.205 0 0)",
      "destructive": "oklch(0.577 0.245 27.325)",
      "destructive-foreground": "oklch(0.985 0 0)",
      "warning": "oklch(0.666 0.179 58.318)",
      "warning-foreground": "oklch(0.985 0 0)",
      "success": "oklch(0.6 0.14 150)",
      "success-foreground": "oklch(0.985 0 0)",
      "border": "oklch(0.922 0 0)",
      "input": "oklch(0.922 0 0)",
      "ring": "oklch(0.708 0 0)",
      "backdrop": "oklch(0 0 0 / 0.3)"
    },
    "dark": {
      "background": "oklch(0.145 0 0)",
      "foreground": "oklch(0.985 0 0)",
      "surface": "oklch(0.205 0 0)",
      "surface-foreground": "oklch(0.985 0 0)",
      "card": "oklch(0.205 0 0)",
      "card-foreground": "oklch(0.985 0 0)",
      "overlay": "oklch(0.205 0 0)",
      "overlay-foreground": "oklch(0.985 0 0)",
      "primary": "oklch(0.922 0 0)",
      "primary-foreground": "oklch(0.205 0 0)",
      "secondary": "oklch(0.269 0 0)",
      "secondary-foreground": "oklch(0.985 0 0)",
      "muted": "oklch(0.269 0 0)",
      "muted-foreground": "oklch(0.708 0 0)",
      "accent": "oklch(0.269 0 0)",
      "accent-foreground": "oklch(0.985 0 0)",
      "destructive": "oklch(0.704 0.191 22.216)",
      "destructive-foreground": "oklch(0.145 0 0)",
      "warning": "oklch(0.769 0.188 70.08)",
      "warning-foreground": "oklch(0.145 0 0)",
      "success": "oklch(0.72 0.15 150)",
      "success-foreground": "oklch(0.145 0 0)",
      "border": "oklch(1 0 0 / 0.1)",
      "input": "oklch(1 0 0 / 0.15)",
      "ring": "oklch(0.556 0 0)",
      "backdrop": "oklch(0 0 0 / 0.3)"
    }
  }
}

2. Point nsh.json at it

Name the theme, add Shell's changes to Tailwind's scales, and alias ~ to your source folder: components import each other and the helpers through it, like ~/components/ui/button.

nsh.json
{
  "theme": "theme.json",
  "tailwind": {
    "radius": {
      "sm": 0,
      "md": 0,
      "lg": 0,
      "xl": 0
    }
  },
  "resolve": {
    "alias": {
      "~": "./src"
    }
  }
}

3. Copy the shared helpers

src/lib/utils.ts
/** Joins class strings, skipping the empty ones: `cn("p-(--space-md)", active && "bg-muted")`. */
export function cn(...parts: (string | false | null | undefined)[]): string {
  return parts.filter(Boolean).join(" ")
}

Then copy primitives and the rest into src/components/ui/, each from its page.