# Installation

Add the package to your app, import the stylesheet, and wrap your app in a Theme.

Womp UI is an open-source React component library. It began as a fork of [Radix Themes](https://www.radix-ui.com/themes); [Credits](/credits) lists what it builds on. Installation is simple: import the CSS, wrap your app with the Theme provider, and start building.

## Install

Add Womp UI to your project using your preferred package manager:

```bash
npm install @kushagradhawan/kookie-ui
```

```bash
pnpm add @kushagradhawan/kookie-ui
```

```bash
yarn add @kushagradhawan/kookie-ui
```

## Requirements

Womp UI needs React 19. TypeScript support is built-in. Node.js 22+ is required for development.

```json
{
  "peerDependencies": {
    "react": "^19.0",
    "react-dom": "^19.0"
  }
}
```

## CSS

Import the complete stylesheet in your application entry point. The CSS import must come before any component imports.

```tsx
import '@kushagradhawan/kookie-ui/styles.css';
```

## Fonts

`styles.css` loads no webfonts — it defaults to system stacks, so installing Womp UI costs zero font requests. Choose one of:

```tsx
// Womp UI's own typefaces: Inter, Inter Tight, JetBrains Mono, Playfair Display.
// Four requests to Google Fonts.
import '@kushagradhawan/kookie-ui/fonts.css';
```

```css
/* Or bring your own, from next/font, a self-hosted @font-face, anywhere. */
:root {
  --font-sans: 'Your Sans', system-ui, sans-serif;
  --font-mono: 'Your Mono', monospace;
  --font-serif: 'Your Serif', serif;
}
```

See [Typography](/foundations/typography) for the full font token model, including how to give headings their own typeface.

## Theme Provider

Wrap your application with the `Theme` component to enable theming and design tokens. The Theme provider should be placed at the root of your application.

```tsx
import { Theme } from '@kushagradhawan/kookie-ui';

<Theme accentColor="blue" grayColor="gray">
  {/* Your app */}
</Theme>
```

## Framework Setup

### Next.js App Router

For Next.js 15 or later with the App Router, import the CSS in your root layout and wrap your app with the Theme provider. Next.js 15 is the first version that supports React 19. `Theme` is already a Client Component, so the layout can stay a Server Component:

```tsx
import '@kushagradhawan/kookie-ui/styles.css';
import { Theme } from '@kushagradhawan/kookie-ui';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <Theme accentColor="blue" grayColor="gray">{children}</Theme>
      </body>
    </html>
  );
}
```

### Next.js Pages Router

For Next.js with the Pages Router, import the CSS in your `_app.tsx`:

```tsx
import '@kushagradhawan/kookie-ui/styles.css';
import { Theme } from '@kushagradhawan/kookie-ui';
import type { AppProps } from 'next/app';

export default function App({ Component, pageProps }: AppProps) {
  return (
    <Theme accentColor="blue" grayColor="gray">
      <Component {...pageProps} />
    </Theme>
  );
}
```

### Vite + React

For Vite projects, import the CSS in your main entry file:

```tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import '@kushagradhawan/kookie-ui/styles.css';
import { Theme } from '@kushagradhawan/kookie-ui';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <Theme accentColor="blue" grayColor="gray"><App /></Theme>
  </React.StrictMode>
);
```

### Remix

For Remix projects, import the CSS using the `links` export in your root component:

```tsx
import { Links, Meta, Outlet, Scripts } from '@remix-run/react';
import { LinksFunction } from '@remix-run/node';
import { Theme } from '@kushagradhawan/kookie-ui';
import styles from '@kushagradhawan/kookie-ui/styles.css';

export const links: LinksFunction = () => [
  { rel: 'stylesheet', href: styles },
];

export default function App() {
  return (
    <html>
      <head>
        <Meta />
        <Links />
      </head>
      <body>
        <Theme accentColor="blue" grayColor="gray"><Outlet /></Theme>
        <Scripts />
      </body>
    </html>
  );
}
```

### Gatsby

For Gatsby projects, import the CSS and wrap the root element in the Theme provider. Export the same `wrapRootElement` from `gatsby-ssr.js`, so the server and the browser render the same tree:

```tsx
// gatsby-browser.js and gatsby-ssr.js
import '@kushagradhawan/kookie-ui/styles.css';
import { Theme } from '@kushagradhawan/kookie-ui';

export const wrapRootElement = ({ element }) => (
  <Theme accentColor="blue" grayColor="gray">{element}</Theme>
);
```

## Usage

Import components and start building:

```tsx
import { Button, Flex, Text, Card, Heading } from '@kushagradhawan/kookie-ui';

export default function MyComponent() {
  return (
    <Card size="3" variant="soft">
      <Flex direction="column" gap="4" p="5">
        <Heading size="4">Welcome</Heading>
        <Text size="3" emphasis="medium">Start building with Womp UI components.</Text>
        <Button size="3" variant="solid">Get Started</Button>
      </Flex>
    </Card>
  );
}
```

## Blocks

For larger patterns, such as code blocks, documentation layouts and marketing sections, copy a [block](/docs/blocks) into your project. Blocks are source files built on Womp UI, not a package, so there is nothing else to install beyond the few dependencies each one lists.

## Troubleshooting

### CSS Not Loading

If styles aren't appearing, ensure the CSS import comes before any component imports:

```tsx
// ✅ Correct
import '@kushagradhawan/kookie-ui/styles.css';
import { Button } from '@kushagradhawan/kookie-ui';

// ❌ Incorrect
import { Button } from '@kushagradhawan/kookie-ui';
import '@kushagradhawan/kookie-ui/styles.css';
```

### TypeScript Errors

Ensure you have the React types installed:

```bash
npm install --save-dev @types/react @types/react-dom
```

### Theme Provider

Make sure the `Theme` component wraps your entire application at the root level. Check that you're using the correct import path and that the component is rendered before any Womp UI components.
