> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whop.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# Frosted UI

> Installér og brug Frosted UI, Whops React-komponentbibliotek og designsystem, til at bygge din apps brugerflade.

Frosted UI er Whops omfattende React-komponentbibliotek og designsystem. Det indeholder mere end 60 komponenter, der overholder standarder for tilgængelighed. Det indeholder også et avanceret farvesystem, en typografiskala og problemfri understøttelse af mørk tilstand – alt sammen bygget på Radix UI-primitiver og Tailwind CSS.

## Installation

**1. Installér pakken**

```bash pnpm theme={null}
pnpm add @whop/react
```

```bash npm theme={null}
npm install @whop/react
```

```bash yarn theme={null}
yarn add @whop/react
```

```bash bun theme={null}
bun install @whop/react
```

> [!NOTE]
>
> Pakken `@whop/react` indeholder Frosted UI og alle nødvendige afhængigheder.

**2. Opsæt WhopApp-provideren**

Omslut din applikation med `WhopApp`-komponenten i dit rodlayout. Det opsætter temaet og iframe-SDK'et.

```tsx theme={null}
// app/layout.tsx
import { WhopApp } from "@whop/react";

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

**3. Konfigurer Next.js (valgfrit)**

Brug `withWhopAppConfig`-wrapperen i din Next.js-konfiguration:

```typescript theme={null}
// next.config.ts
import type { NextConfig } from "next";
import { withWhopAppConfig } from "@whop/react/next.config";

const nextConfig: NextConfig = {
    // your config options
};

export default withWhopAppConfig(nextConfig);
```

> [!NOTE]
>
> Det konfigurerer server actions og optimerer Frosted UI-imports.

**4. Opsæt Tailwind (valgfrit)**

Hvis du bruger Tailwind CSS, skal du tilføje Frosted UI-pluginnet for at få adgang til design tokens:

```javascript theme={null}
// tailwind.config.js
import { frostedThemePlugin } from "@whop/react/tailwind";

export default {
    content: ["./src/**/*.{js,ts,jsx,tsx}"],
    plugins: [frostedThemePlugin()],
};
```

> [!TIP]
>
> Frosted UI er nu sat op og klar til brug.

***

## Typografi

Frosted UI har et omfattende typografisystem med to hovedkomponenter: `Heading` og `Text`.

### Typeskala

Begge komponenter bruger en størrelsesskala med 10 trin (0-9):

| Størrelse | Skriftstørrelse | Anvendelse |
| - | - | - |
| 0 | 10px | Mindste tekst |
| 1 | 12px | Små etiketter |
| 2 | 14px | Brødtekst (lille) |
| 3 | 16px | Brødtekst (standard) |
| 4 | 18px | Fremhævet tekst |
| 5 | 20px | Underoverskrifter |
| 6 | 24px | Overskrifter |
| 7 | 28px | Store overskrifter |
| 8 | 32px | Displaytekst |
| 9 | 40px | Hero-tekst |

### Text-komponenten

```tsx theme={null}
import { Text } from "@whop/react";

<Text size="3" weight="medium">
    This is body text
</Text>

<Text size="1" color="gray">
    Small muted text
</Text>

<Text as="label" size="2" weight="bold">
    Form Label
</Text>
```

**Props:**

* `size`: `"0"` through `"9"` (default: `"3"`)
* `weight`: `"light"` | `"regular"` | `"medium"` | `"bold"`
* `align`: `"left"` | `"center"` | `"right"`
* `color`: Enhver accentfarve eller `"gray"`
* `highContrast`: Øger kontrasten af hensyn til tilgængelighed
* `as`: `"span"` | `"div"` | `"p"` | `"label"`

### Heading-komponenten

```tsx theme={null}
import { Heading } from "@whop/react";

<Heading size="6" as="h1">
    Page Title
</Heading>

<Heading size="4" as="h2" weight="medium">
    Section Heading
</Heading>
```

**Props:**

* `size`: `"0"` through `"9"` (default: `"6"`)
* `weight`: `"light"` | `"regular"` | `"medium"` | `"bold"`
* `align`: `"left"` | `"center"` | `"right"`
* `as`: `"h1"` | `"h2"` | `"h3"` | `"h4"` | `"h5"` | `"h6"`
* `color`: Enhver accentfarve eller `"gray"`
* `highContrast`: Øger kontrasten af hensyn til tilgængelighed

### Andre typografikomponenter

```tsx theme={null}
import { Code, Strong, Em, Kbd } from "@whop/react";

<Code>const example = "code";</Code>
<Strong>Bold text</Strong>
<Em>Italic text</Em>
<Kbd>⌘ K</Kbd>
```

***

## Farver

Frosted UI bruger Radix-farveskalaer, som giver farvepaletter med 12 trin i både solide varianter og alpha-varianter.

### Accentfarver

Der er 27 tilgængelige accentfarver:

**Almindelige farver:** `tomato`, `red`, `ruby`, `crimson`, `pink`, `plum`, `purple`, `violet`, `iris`, `indigo`, `blue`, `cyan`, `teal`, `jade`, `green`, `grass`, `brown`, `orange`

**Klare farver:** `sky`, `mint`, `lime`, `yellow`, `amber`, `lemon`, `magenta`

**Metalliske farver:** `gold`, `bronze`

### Grå farver

6 gråskalaer med forskellige farvetemperaturer:

* `gray` - Ren neutral grå
* `mauve` - Let lillatonet
* `slate` - Kølig blåtonet
* `sage` - Diskret grøntonet
* `olive` - Varm olivental
* `sand` - Varm sandtonet
* `auto` - Matcher automatisk accentfarven

### Semantiske farver

Forudkonfigurerede farver til almindelige formål:

* **Fare:** `red` (standard), `tomato`, `ruby`
* **Advarsel:** `amber` (standard), `yellow`
* **Succes:** `green` (standard), `teal`, `jade`, `grass`
* **Info:** `sky` (standard), `blue`

### Brug af farver

```tsx theme={null}
import { Button, Badge, Text } from "@whop/react";

<Button color="blue">Primary Action</Button>
<Button color="red">Delete</Button>
<Badge color="green">Active</Badge>
<Text color="gray">Muted text</Text>
```

### Tailwind-farveklasser

Med Tailwind-pluginnet kan du bruge Frosted UI-farver direkte:

```tsx theme={null}
<div className="bg-blue-2 text-blue-11 border border-blue-6">
    Blue themed box
</div>

<div className="bg-red-a3 text-red-11">
    Red with alpha background
</div>
```

**Farveskala:**

* Trin 1-3: Baggrunde og diskrete udfyldninger
* Trin 4-6: Kanter og separatorer
* Trin 7-9: Interaktive elementer
* Trin 10-12: Tekst og elementer med høj kontrast

**Alpha-varianter:**

* Brug `{color}-a1` til `{color}-a12` til gennemsigtighed

> [!WARNING]
>
> Når `frostedUiPlugin()` er tilføjet til din Tailwind-konfiguration, virker
> Tailwinds standardfarver som `bg-blue-200` ikke. Brug i stedet `bg-blue-2`
> ifølge dokumentationen ovenfor.

***

## Mørk tilstand

Frosted UI har automatisk understøttelse af mørk tilstand, der respekterer systemindstillinger og brugerens valg.

### Sådan virker det

Styr mørk tilstand med tre visningstilstande:

* `"inherit"` (standard) - Respekterer systemindstillingen
* `"light"` - Gennemtvinger lys tilstand
* `"dark"` - Gennemtvinger mørk tilstand

Browseren gemmer temavalget i en cookie (`whop-frosted-theme`) og falder tilbage til systemindstillingen, når der ikke findes en.

### Konfiguration

Konfigurer udseendet i din `WhopApp`-komponent:

```tsx theme={null}
<WhopApp appearance="dark">{children}</WhopApp>
```

Eller opret indlejrede temaer med forskellige udseender:

```tsx theme={null}
import { Theme } from "@whop/react";

<Theme appearance="light">
    <div>This section is always light</div>
</Theme>

<Theme appearance="dark">
    <div>This section is always dark</div>
</Theme>
```

### Tailwind-klasser til mørk tilstand

Brug præfikset `dark:` til styles i mørk tilstand:

```tsx theme={null}
<div className="bg-white dark:bg-black text-black dark:text-white">
	Adapts to theme
</div>
```

***

## Breakpoints

Frosted UI bruger et mobile-first responsivt system med 5 breakpoints.

### Breakpoint-skala

| Navn | Min. bredde | Anvendelse |
| - | - | - |
| `initial` | 0px | Mobil (standard) |
| `xs` | 520px | Stor mobil |
| `sm` | 768px | Tablet |
| `md` | 1024px | Lille desktop |
| `lg` | 1280px | Desktop |
| `xl` | 1640px | Stor desktop |

### Responsive props

Mange komponenter understøtter responsive værdier med en objektsyntaks:

```tsx theme={null}
import { Text, Box } from "@whop/react";

<Text size={{ initial: "2", md: "4", lg: "6" }}>Responsive text size</Text>;
```

### Responsive Tailwind-klasser

```tsx theme={null}
<div className="p-2 md:p-4 lg:p-8">
    Responsive padding
</div>

<div className="text-2 sm:text-3 md:text-4">
    Responsive text
</div>
```

***

## Ikoner

Frosted UI har et ikonsystem via pakken `@frosted-ui/icons`.

### Brug af ikoner

```tsx theme={null}
import { IconButton } from "@whop/react";
import { MagnifyingGlassIcon, Cross2Icon } from "@frosted-ui/icons";

<IconButton>
    <MagnifyingGlassIcon />
</IconButton>

<IconButton color="red">
    <Cross2Icon />
</IconButton>
```

### Almindelige ikoner

Frosted UI bruger Radix Icons, som indeholder ikoner som:

* Navigation: `ChevronRightIcon`, `ChevronDownIcon`, `ArrowRightIcon`
* Handlinger: `Cross2Icon`, `CheckIcon`, `PlusIcon`, `MinusIcon`
* UI: `MagnifyingGlassIcon`, `GearIcon`, `PersonIcon`
* Flere ikoner er tilgængelige i biblioteket.

***

## Tailwind-plugin

Frosted UI's Tailwind-plugin stiller design tokens til rådighed som Tailwind-utilities.

### Hvad er inkluderet

**Typografi:**

```tsx theme={null}
<p className="text-3 leading-3 font-medium tracking-2">
	Styled with Frosted UI tokens
</p>
```

**Farver:**

```tsx theme={null}
<div className="bg-blue-2 text-blue-11 border-blue-6">Blue themed</div>
```

**Afstand og layout:**

```tsx theme={null}
<div className="p-4 md:p-6 lg:p-8">Responsive padding</div>
```

### Vigtige forskelle fra standard-Tailwind

1. **Skala for skriftstørrelse:** Bruger 0-9 i stedet for xs/sm/base/lg
2. **Skala for linjehøjde:** Matcher skalaen for skriftstørrelse (0-9)
3. **Farvesystem:** Radix-farveskalaer med 12 trin og alpha-varianter
4. **Semantiske farver:** Indbyggede farver til fare, advarsel, succes og info
5. **Design tokens:** Alle værdier bruger CSS-variabler for ensartede temaer

***

## Almindelige komponenter

### Button

```tsx theme={null}
import { Button } from "@whop/react";

<Button size="2" variant="solid" color="blue">
    Primary Action
</Button>

<Button size="2" variant="soft" color="gray">
    Secondary
</Button>

<Button size="2" variant="ghost" color="red">
    Danger
</Button>
```

**Props:**

* `size`: `"1"` | `"2"` | `"3"` | `"4"`
* `variant`: `"solid"` | `"soft"` | `"surface"` | `"ghost"` | `"classic"`
* `color`: Enhver accentfarve
* `highContrast`: Forøget kontrast
* `loading`: Viser en indlæsningsindikator
* `disabled`: Deaktiverer interaktion

### Input

```tsx theme={null}
import { TextInput, TextArea } from "@whop/react";

<TextInput
    size="2"
    placeholder="Enter text..."
    variant="surface"
/>

<TextArea
    size="2"
    placeholder="Enter multiple lines..."
    rows={4}
/>
```

### Card

```tsx theme={null}
import { Card } from "@whop/react";

<Card size="2" variant="surface">
	<Heading size="4">Card Title</Heading>
	<Text>Card content goes here</Text>
</Card>;
```

### Badge

```tsx theme={null}
import { Badge } from "@whop/react";

<Badge color="green" variant="soft">Active</Badge>
<Badge color="red" variant="solid">Error</Badge>
<Badge color="gray" variant="surface">Draft</Badge>
```

### Dialog

```tsx theme={null}
import { Dialog, Button } from "@whop/react";

<Dialog.Root>
	<Dialog.Trigger>
		<Button>Open Dialog</Button>
	</Dialog.Trigger>
	<Dialog.Content>
		<Dialog.Title>Dialog Title</Dialog.Title>
		<Dialog.Description>This is the dialog content</Dialog.Description>
		<Dialog.Close>
			<Button>Close</Button>
		</Dialog.Close>
	</Dialog.Content>
</Dialog.Root>;
```

### Select

```tsx theme={null}
import { Select } from "@whop/react";

<Select.Root defaultValue="1">
	<Select.Trigger />
	<Select.Content>
		<Select.Item value="1">Option 1</Select.Item>
		<Select.Item value="2">Option 2</Select.Item>
		<Select.Item value="3">Option 3</Select.Item>
	</Select.Content>
</Select.Root>;
```

### Checkbox og radio

```tsx theme={null}
import { Checkbox, RadioGroup } from "@whop/react";

<Checkbox size="2" color="blue">
    Accept terms
</Checkbox>

<RadioGroup.Root defaultValue="1">
    <RadioGroup.Item value="1">Option 1</RadioGroup.Item>
    <RadioGroup.Item value="2">Option 2</RadioGroup.Item>
</RadioGroup.Root>
```

***

## Avanceret brug

### Tilpasning af tema

Tilpas temaet med flere indstillinger:

```tsx theme={null}
<WhopApp
	appearance="dark"
	accentColor="violet"
	grayColor="mauve"
	dangerColor="ruby"
	warningColor="amber"
	successColor="jade"
	infoColor="sky"
>
	{children}
</WhopApp>
```

### Indlejrede temaer

Opret sektioner med forskellige temaer:

```tsx theme={null}
import { Theme } from "@whop/react";

<div>
	<Theme accentColor="blue">
		<Button>Blue button</Button>
	</Theme>

	<Theme accentColor="red" appearance="dark">
		<Button>Red button in dark mode</Button>
	</Theme>
</div>;
```

### Adgang til temakonteksten

```tsx theme={null}
import { useThemeContext } from "@whop/react";

function ThemedComponent() {
	const theme = useThemeContext();

	console.log(theme.appearance); // "light" | "dark"
	console.log(theme.accentColor); // "blue" | "red" | ...

	return <div>Current theme: {theme.appearance}</div>;
}
```

***

## Komponentbibliotek

Frosted UI indeholder over 60 komponenter organiseret efter kategori:

**Layout:** `Box`, `Flex`, `Grid`, `Container`, `Section`, `AspectRatio`, `Inset`

**Typografi:** `Heading`, `Text`, `Code`, `Strong`, `Em`, `Kbd`, `Quote`, `Blockquote`

**Formularer:** `TextInput`, `TextArea`, `Checkbox`, `RadioGroup`, `Select`, `Switch`, `Slider`, `DatePicker`, `OTPField`

**Knapper:** `Button`, `IconButton`

**Visning:** `Card`, `Avatar`, `AvatarGroup`, `Badge`, `Callout`, `Table`, `DataList`, `Skeleton`

**Navigation:** `Tabs`, `Breadcrumbs`, `Link`, `SegmentedControl`

**Overlejring:** `Dialog`, `AlertDialog`, `Drawer`, `Sheet`, `Popover`, `HoverCard`, `Tooltip`, `DropdownMenu`, `ContextMenu`

**Feedback:** `Progress`, `CircularProgress`, `Spinner`

**Værktøjer:** `ScrollArea`, `Separator`, `Portal`, `VisuallyHidden`, `AccessibleIcon`

> [!NOTE]
>
> Alle komponenter er bygget på Radix UI-primitiver og følger bedste praksis for
> tilgængelighed.

***

## Ressourcer

* [Radix UI-dokumentation](https://www.radix-ui.com/) - Komponentprimitiver
* [Radix Colors](https://www.radix-ui.com/colors) - Dokumentation af farvesystemet
* [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS-framework


## Related topics

- [Platformkort](https://docs.whop.com/da/developer/platform-map.md)
- [Byg Whop-apps med React Native](https://docs.whop.com/da/developer/guides/react-native.md)
- [ChatElement (forældet)](https://docs.whop.com/da/sdk/elements/chat-element.md)
