# Sosialoka Design System

> Tokens, components and patterns shared by Loka Musik, Cover Clearance, Lokasign and My Loka Link.

Tokens, components and patterns for Loka Musik, Cover Clearance, Lokasign and My Loka Link, in React, Vue and Flutter. Pick a product to see the whole site in its colors.

- [Browse components](https://design.sosialoka.tech/components/)
- [Set up a project](https://design.sosialoka.tech/web/)

- [Foundations](https://design.sosialoka.tech/foundations/color/): Color, type, icons, spacing, radius, elevation and motion, all as tokens.
- [Components](https://design.sosialoka.tech/components/): Controls and surfaces for React and Vue, with the Flutter code beside them.
- [Patterns](https://design.sosialoka.tech/patterns/login/): Whole screens: login, dashboard, lists, forms and the states between them.

## Most used components

- [Button](https://design.sosialoka.tech/components/button/): Starting an action.
- [Input](https://design.sosialoka.tech/components/input/): One line of text.
- [Select](https://design.sosialoka.tech/components/select/): Picking one value from a short list.
- [Switch](https://design.sosialoka.tech/components/switch/): A setting that applies right away.
- [Card](https://design.sosialoka.tech/components/card/): Grouping content on its own surface.
- [Table](https://design.sosialoka.tech/components/table/): Records in rows and columns, with pagination.
- [Dialog](https://design.sosialoka.tech/components/dialog/): A decision or a short form over the page.
- [Toast](https://design.sosialoka.tech/components/toast/): Confirming an action.

## Products

- **Loka Musik**: music distribution and royalties.
- **Cover Clearance**: licensing for cover songs.
- **Lokasign**: electronic signatures.
- **My Loka Link**: link pages for music artists.

Screens that belong to no product, such as internal tools or a partner's first prototype, use the [neutral theme](https://design.sosialoka.tech/add-a-product/#neutral-theme). A new product gets its own theme with [one command](https://design.sosialoka.tech/add-a-product/).

## Start building

Pick your platform. Each guide installs the theme for your product and points to the components.

| Platform | What you get |
| --- | --- |
| [Web](https://design.sosialoka.tech/web/) | React and Vue components from the Sosialoka registry, or the CSS tokens for any web app, with Tailwind v4 utilities. |
| [Flutter](https://design.sosialoka.tech/flutter/) | The `sosialoka_ui` package: themes for `shadcn_ui` and Material widgets. |
| [Use with AI agents](https://design.sosialoka.tech/ai-agents/) | The MCP server, llms.txt and an AGENTS.md snippet, so agents build with the system. |

## Use the patterns

[Patterns](https://design.sosialoka.tech/patterns/login/) show whole screens built from the components: login, the dashboard frame, list, detail and form pages, empty, loading and error states, and the My Loka Link artist page. Login and the dashboard frame install as blocks; the rest are guides with code to copy. [Content](https://design.sosialoka.tech/content/) sets how the copy on those screens reads.

## For AI agents

Every page is also available as Markdown: add `.md` to its address, or use the buttons under the page title. [/llms.txt](https://design.sosialoka.tech/llms.txt) lists every page with a one-line summary, and [/llms-full.txt](https://design.sosialoka.tech/llms-full.txt) holds the whole documentation in one file. The Indonesian versions live under `/id/`.


---

# Web

> Set up a React, Vue or plain web project with the Sosialoka theme, tokens and components.

Web projects get the Sosialoka look in one of two ways:

- **React or Vue with shadcn:** install your product's theme, then the components, from the Sosialoka registry. Most products start here.
- **Any other web app:** load the CSS tokens, with or without Tailwind, and build on the variables.

## Set up a shadcn project

React components are built on Base UI and installed with `shadcn`; Vue components are built on Reka UI and installed with `shadcn-vue`. Both copy the source into your project, so you own the code.

1. Start from a project where shadcn (React) or shadcn-vue (Vue) is already set up.
2. Install the theme for your product. It writes the Sosialoka colors for light and dark mode, the fonts and the radius into your global CSS:

```bash
# React
npx shadcn@latest add https://design.sosialoka.tech/r/react/theme-coverclearance.json
# Vue
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/theme-coverclearance.json
```

Swap `coverclearance` for `lokamusik`, `lokasign`, `mylokalink`, or `neutral` for a screen that belongs to no product. A fresh shadcn project imports the Geist font; remove that import, since the theme sets Plus Jakarta Sans for text and headings. Installed a theme before? Install it again to get newer tokens such as `overlay`, which dialogs and sheets use.

3. Install components from the Sosialoka registry, for example:

```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/button.json
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/button.json
```

4. Load Plus Jakarta Sans in your product. Turn on dark mode with the `.dark` class on the root element, as shadcn projects do; the theme writes its dark values under `.dark`.

Every component and its install command is listed in [Components](https://design.sosialoka.tech/components/). [Patterns](https://design.sosialoka.tech/patterns/login/) show whole screens built from them.

## Use the tokens without shadcn

Set the product and the mode on the root element. `data-brand` is required; `data-theme` takes `light` or `dark`, and the `.dark` class works too. Without a dark marker, the light values apply. Offer Light, Dark and Auto, with Auto (the device's setting) as the start; see the mode rule in [Dashboard](https://design.sosialoka.tech/patterns/dashboard/#rules).

```html
<html data-brand="coverclearance" data-theme="dark">
```

| File | Use it for |
| --- | --- |
| [/tokens/sosialoka.css](https://design.sosialoka.tech/tokens/sosialoka.css) | Any web app. CSS variables for every theme and the tenant accent presets. |
| [/tokens/tailwind.css](https://design.sosialoka.tech/tokens/tailwind.css) | Tailwind v4. Maps the variables to utilities such as `bg-primary`, `text-muted-foreground` and `rounded-md`. |
| [/tokens.json](https://design.sosialoka.tech/tokens.json) | Design tools and agents. Every token in the DTCG 2025.10 format. |
| [/tokens/lokasign-light.json](https://design.sosialoka.tech/tokens/lokasign-light.json) | Resolved values for one theme. Swap the file name for any other theme. |

In a Tailwind v4 project:

```css
@import "tailwindcss";
@import "./sosialoka.css";
@import "./tailwind.css";
```

Tokens name the fonts but don't ship them. Load Plus Jakarta Sans for the interface and JetBrains Mono for code in your product.

## Tenant accent

A page that takes a tenant's or an artist's color sets a preset on its own root element. Presets are `blue`, `orange`, `teal` and `red`.

```html
<main data-tenant-accent="orange">
```

Inside it, the `tenant-accent` tokens switch to the preset. Every other token keeps the product colors.


---

# Flutter

> The sosialoka_ui package gives Flutter apps the Sosialoka themes for shadcn_ui and Material.

The `sosialoka_ui` package gives a Flutter app the Sosialoka theme of its product, for `shadcn_ui` widgets and for Material widgets, in light and dark mode.

## Install

The package installs from the design system repository:

```yaml
dependencies:
  shadcn_ui: ^0.59.0
  sosialoka_ui:
    git:
      url: https://gitlab.com/sosialoka/design-system.git
      path: flutter
```

## Set the theme

Pick your product with `SosialokaBrand`, or `SosialokaBrand.neutral` for an app that belongs to no product. `SosialokaTheme.shad` builds the `shadcn_ui` theme, and `SosialokaTheme.material` builds a matching Material theme for screens that still use Material widgets.

```dart
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    const brand = SosialokaBrand.coverclearance;
    return ShadApp.custom(
      theme: SosialokaTheme.shad(brand, Brightness.light),
      darkTheme: SosialokaTheme.shad(brand, Brightness.dark),
      appBuilder: (context) => MaterialApp(
        theme: SosialokaTheme.material(brand, Brightness.light),
        darkTheme: SosialokaTheme.material(brand, Brightness.dark),
        builder: (context, child) => ShadAppBuilder(child: child!),
        home: const HomeScreen(),
      ),
    );
  }
}
```

Moving screens over one at a time works: Material screens and `shadcn_ui` screens share the same colors and radius.

## Extra colors

`shadcn_ui` has no field for the status colors, soft tints, tenant accents or brand colors. Read them from the theme with `context.sosialoka`:

```dart
ShadBadge(
  backgroundColor: context.sosialoka.successSoft,
  foregroundColor: context.sosialoka.success,
  child: const Text('Selesai'),
);
```

The raw values, radius, spacing and text sizes are also available as constants: `SosialokaColors`, `SosialokaRadius`, `SosialokaSpace` and `SosialokaText`. The same constants are in one file, [/tokens/sosialoka_tokens.dart](https://design.sosialoka.tech/tokens/sosialoka_tokens.dart), for an app without the package.

## Font

The themes set Plus Jakarta Sans through the `google_fonts` package, which downloads the font on first use. An app that must work offline should bundle the font files and declare them in its `pubspec.yaml`.

## Examples

Every component page shows its Flutter code in the Flutter tab. The same code runs in the gallery app in `flutter/example` of the repository, where `flutter analyze` and a render test under every brand and mode check it.


---

# Use with AI agents

> Connect Claude Code, Cursor, VS Code, Codex or Gemini CLI to the design system through its MCP server, llms.txt, the registry and an AGENTS.md snippet.

AI agents can read the whole design system in open formats, so any agent, Claude or not, builds UI with the same tokens, components and patterns as the docs.

## What agents can read

| Source | Use it for |
| --- | --- |
| Page URL + `.md`, such as [/components/button.md](https://design.sosialoka.tech/components/button.md) | One page as Markdown. Every page also has **Copy as Markdown** and **Download .md** buttons. |
| [/llms.txt](https://design.sosialoka.tech/llms.txt) and [/id/llms.txt](https://design.sosialoka.tech/id/llms.txt) | The index of every page with a one-sentence summary ([llmstxt.org](https://llmstxt.org)). |
| [/llms-full.txt](https://design.sosialoka.tech/llms-full.txt) and [/id/llms-full.txt](https://design.sosialoka.tech/id/llms-full.txt) | Every page in one file. |
| [/tokens.json](https://design.sosialoka.tech/tokens.json) and `/tokens/<theme>.json` | Every token in the DTCG format, and the resolved values of one theme. |
| [/r/react/registry.json](https://design.sosialoka.tech/r/react/registry.json) and [/r/vue/registry.json](https://design.sosialoka.tech/r/vue/registry.json) | The shadcn registries of the React and Vue components. |
| [/sosialoka-design-system-docs.zip](https://design.sosialoka.tech/sosialoka-design-system-docs.zip) | All of the above in one download. |
| `https://design.sosialoka.tech/mcp` | The MCP server: search, pages, components, patterns and tokens as tools. |

## Connect the MCP server

The server speaks MCP over Streamable HTTP at `https://design.sosialoka.tech/mcp`. It needs no login: everything it serves is public. Name it `sosialoka-design` so the AGENTS.md snippet below finds it.

### Claude Code

```bash
claude mcp add --transport http sosialoka-design https://design.sosialoka.tech/mcp
```

Add `--scope project` to write it to the repository's `.mcp.json`, so the whole team gets it.

### Cursor

In `.cursor/mcp.json` of the project, or `~/.cursor/mcp.json` for every project:

```json
{
  "mcpServers": {
    "sosialoka-design": { "url": "https://design.sosialoka.tech/mcp" }
  }
}
```

### VS Code

In `.vscode/mcp.json`:

```json
{
  "servers": {
    "sosialoka-design": { "type": "http", "url": "https://design.sosialoka.tech/mcp" }
  }
}
```

### Codex

In `~/.codex/config.toml`:

```toml
[mcp_servers.sosialoka-design]
url = "https://design.sosialoka.tech/mcp"
```

### Gemini CLI

In `~/.gemini/settings.json`, or `.gemini/settings.json` of the project:

```json
{
  "mcpServers": {
    "sosialoka-design": { "httpUrl": "https://design.sosialoka.tech/mcp" }
  }
}
```

## Tools

Every tool returns Markdown. Tools that take `locale` accept `en` (the default) or `id`.

| Tool | Arguments | Returns |
| --- | --- | --- |
| `search_docs` | `query`, `locale`, `limit` | The matching pages, with the path to pass to `get_page`. |
| `get_page` | `path`, `locale` | One page. The path can be `foundations/color`, `/id/content/` or a full page URL. |
| `list_components` | none | Every component with its frameworks, and every page pattern. |
| `get_component` | `name`, `platform`, `locale` | A component guide with its install commands and code. `platform` (`react`, `vue` or `flutter`) keeps one platform's code. |
| `get_tokens` | `theme` | The resolved values of one theme. Without `theme`, the theme list and the link to the full DTCG file. |
| `list_themes` | none | The themes and how to switch them. |
| `get_pattern` | `name`, `locale` | A page pattern, such as `login`, `dashboard`, `list` or `form`, with its code. |

## Install components through the shadcn MCP

The React registry also works with the official shadcn MCP server, so an agent can search the Sosialoka components and install them by name. Add the registry to `components.json`:

```json
{
  "registries": {
    "@sosialoka": "https://design.sosialoka.tech/r/react/{name}.json"
  }
}
```

Then set up the shadcn MCP server for your agent (`claude`, `cursor` or `vscode`):

```bash
npx shadcn@latest mcp init --client claude
```

`mcp init` cannot write the Codex config, so for Codex add this to `~/.codex/config.toml`:

```toml
[mcp_servers.shadcn]
command = "npx"
args = ["shadcn@latest", "mcp"]
```

Ask for an item by its registry name, such as "add @sosialoka/button". The shadcn MCP serves the React registry; in a Vue project, the agent takes the `shadcn-vue` install command from `get_component` or from the component page.

## Add the rules to your repo

Paste this into the `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` or `.cursor/rules` file of a product repository. It is also at [/AGENTS.md](https://design.sosialoka.tech/AGENTS.md).

````markdown
## Sosialoka Design System

This product uses the Sosialoka Design System (https://design.sosialoka.tech). Follow it for every UI change.

- **Read before you build.** Index: https://design.sosialoka.tech/llms.txt (Indonesian: https://design.sosialoka.tech/id/llms.txt). Every page is Markdown at its URL + `.md`.
- **Use the MCP server when it is connected** (`sosialoka-design`, https://design.sosialoka.tech/mcp): `search_docs`, `get_component` with `platform`, `get_pattern`, `get_tokens` with a theme.
- **Install components from the registry; don't rewrite them.**
  - React: `npx shadcn@latest add https://design.sosialoka.tech/r/react/<name>.json`
  - Vue: `npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/<name>.json`
  - Install your product's theme first: https://design.sosialoka.tech/web.md
  - Flutter: the `sosialoka_ui` package (https://design.sosialoka.tech/flutter.md).
- **Use tokens, never raw values:** `bg-primary`, `text-muted-foreground`, `border-input`, `rounded-md`. No hex colors, no pixel radius.
- **Set the theme on the root element:** `data-brand` = your product (`lokamusik`, `coverclearance`, `lokasign`, `mylokalink`), or `neutral` when the screen belongs to no product; `data-theme` = `light` or `dark`.
- **Icons:** Lucide. **UI font:** Plus Jakarta Sans.
- **Labels sit above inputs.** One primary action per screen.
- **Copy** (https://design.sosialoka.tech/content.md): Indonesian uses "kamu", never "Anda". Short, active sentences. Error messages come from the backend; the client only disables the button.
````

## Download everything

[sosialoka-design-system-docs.zip](https://design.sosialoka.tech/sosialoka-design-system-docs.zip) holds every page as Markdown in English and Indonesian, the `llms.txt` and `llms-full.txt` files, `tokens.json`, one `tokens/<theme>.json` file per theme and `AGENTS.md`. It is rebuilt with every release of the site.


---

# Add a product

> Give a new Sosialoka product its own light and dark theme from its logo color with one command, and use the neutral theme when a screen belongs to no product.

Every brand is listed once, in `tokens/brands.json`. The token build, the registry, the Flutter package and this site all read that list, so a new product takes one command, its logos and a few lines of docs.

## Before you start

- **The logo color,** as `#RRGGBB`. It becomes `primary` in light mode as it is: a product's primary is always its logo color.
- **The logo files,** one for light grounds and one for dark grounds, in SVG or PNG.
- **An id:** lowercase letters and digits, such as `lokaticket`. It becomes the `data-brand` value, the theme file names and the Flutter enum value, so pick it once.

## 1. Generate the themes

In the design system repository:

```bash
pnpm new-brand lokaticket --name "Loka Ticket" --logo "#B83A0B" --summary "Ticketing for music events."
```

The command writes `tokens/themes/lokaticket-light.tokens.json` and `lokaticket-dark.tokens.json`, adds the product to `tokens/brands.json`, and runs the contrast check on the two new themes.

| Option | Use it for |
| --- | --- |
| `--name` | The product name as people read it. Required. |
| `--logo` | The logo color. Required. |
| `--summary` | One line, in English, on what the product does. Required. |
| `--secondary` | A second logo color, for gradients and the login hero. |
| `--dark-primary` | `primary` in dark mode, when the derived one doesn't suit the logo. |
| `--font` | The display font for brand moments. Defaults to Plus Jakarta Sans. |
| `--fallback` | `sans-serif` or `serif`, after the display font. |
| `--sample` | A line set in the display font on the Brand page. Write it the way the login hero would say it. |

## How the colors are made

| Tokens | Light | Dark |
| --- | --- | --- |
| `primary` | The logo color | The logo color, lightened until dark text reads on it |
| `primary-foreground` | White or dark ink, whichever reads on the logo color and on its hover | Dark ink |
| `background`, `card`, `muted`, `border` | Near white, with a trace of the logo hue | Near black, with a trace of the logo hue |
| `foreground`, `muted-foreground`, `input` | Stepped until they reach 4.5:1, or 3:1 for `input` | Same |
| `primary-soft`, `primary-text` | A pale tint, and the logo color darkened until it reads as text | A deep tint, and a light version of the logo color |
| `chart-1` | The logo color, darkened only if it needs to reach 3:1 | The logo color, lightened only if needed |
| `brand-*` | The logo colors, the same in both modes | Same |

A gray logo gives gray neutrals, because the tint never carries more color than the logo has. The result is a starting point: open the theme files, tune what doesn't feel like the product, and run `pnpm check`, which holds every pair to the contrast it needs.

### When the check reports a pair

Some logo colors, such as a bright pink or orange, can't carry white or dark text at 4.5:1. The command keeps the logo color and lists those pairs. Don't swap in a different `primary` on your own: ask the design system owner. They either accept the pair as an exception in `packages/tokens/src/contrast.ts`, as they did for the Cover Clearance orange, or choose another primary.

## 2. Add the logos

Put the files in `site/public/brand/` and list them in the product's entry in `tokens/brands.json`:

```json
"logos": [
  { "variant": "light-ground", "file": "lokaticket.svg", "alt": "Loka Ticket logo, for light grounds" },
  { "variant": "dark-ground", "file": "lokaticket-white.svg", "alt": "Loka Ticket logo, white, for dark grounds" }
]
```

The Brand page shows them in its logo grid, and the font specimen picks up the display font and the sample line.

## 3. Load a new display font

If the display font isn't one the site already loads, add its `@fontsource-variable` package to `site/` and import it in `FontSpecimen.astro` and `block-preview.css`. Products load their own fonts.

## 4. Add the product to the docs

- On the [Brand](https://design.sosialoka.tech/brand/) page, a section with the product's brand tokens: `<TokenTable group="brand" theme="lokaticket-light" />`.
- On the home page, a line in the product list.
- In `site/public/AGENTS.md`, the id in the `data-brand` list.

Write each change in English and in Indonesian, under `id/`.

## 5. Check and commit

Run `pnpm check`. It rebuilds everything that reads the list:

- `sosialoka.css` with `[data-brand="lokaticket"]` for light and dark mode
- the registry themes `theme-lokaticket.json` for React and Vue
- the Flutter enum value `SosialokaBrand.lokaticket` in `tokens.g.dart`
- the brand selector on this site and the theme list of the MCP server

Commit the theme files, `tokens/brands.json`, the logos and `flutter/lib/src/generated/tokens.g.dart`. The product then installs its theme like any other:

```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/theme-lokaticket.json
```

```dart
ShadApp(theme: SosialokaTheme.shad(SosialokaBrand.lokaticket, Brightness.light));
```

## Neutral theme

`neutral` is a graphite theme: gray surfaces, a near-black `primary` in light mode and a light gray one in dark mode. It belongs to no product. Use it for:

- work a vendor or partner starts before the product's brand is set
- internal tools and prototypes
- screens that serve several products at once

A product with its own logo gets its own theme instead. The neutral theme installs and switches like the others:

```html
<html data-brand="neutral" data-theme="dark">
```

```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/theme-neutral.json
```

```dart
ShadApp(theme: SosialokaTheme.shad(SosialokaBrand.neutral, Brightness.light));
```


---

# Brand

> How Sosialoka products look like one family while each keeps its own name, logo and color.

Sosialoka products follow an endorsed brand model: each product keeps its own name, logo and color, and Sosialoka stands behind all of them. To bring in a new product, see [Add a product](https://design.sosialoka.tech/add-a-product/).

## Product line

Login screens and product footers carry the line **from [Sosialoka mark] Sosialoka**: the word "from", the Sosialoka mark, then the name. "from" says Sosialoka owns the product. Don't write "Powered by", which reads as a technology vendor.

## Logos

- Sosialoka mark: [sosialoka.png](https://design.sosialoka.tech/brand/sosialoka.png)
- Loka Musik logo, for light grounds: [lokamusik.svg](https://design.sosialoka.tech/brand/lokamusik.svg)
- Loka Musik logo, white text, for dark grounds: [lokamusik-white.svg](https://design.sosialoka.tech/brand/lokamusik-white.svg)
- Cover Clearance logo, color: [coverclearance.svg](https://design.sosialoka.tech/brand/coverclearance.svg)
- Cover Clearance logo, white, for dark grounds: [coverclearance-white.svg](https://design.sosialoka.tech/brand/coverclearance-white.svg)
- Lokasign logo, for light grounds: [lokasign.png](https://design.sosialoka.tech/brand/lokasign.png)
- Lokasign logo, for dark grounds: [lokasign-dark.png](https://design.sosialoka.tech/brand/lokasign-dark.png)
- My Loka Link lockup, for light grounds: [mylokalink.svg](https://design.sosialoka.tech/brand/mylokalink.svg)
- My Loka Link lockup, for dark grounds: [mylokalink-white.svg](https://design.sosialoka.tech/brand/mylokalink-white.svg)

- Use the files as they are. Don't redraw, recolor, stretch, rotate or add effects.
- Use the white or dark-ground version on dark backgrounds.
- The light and dark versions of a logo differ only in the color of the lettering; the mark keeps its colors.

## Brand colors

Each product's `primary` is its logo color. The `brand-*` tokens hold the logo colors themselves and stay the same in light and dark mode; use them only in brand moments such as the login hero.

### Loka Musik

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| brand-primary | `--brand-primary` | #660032 | Logo color, the same in both modes; brand moments only. |
| brand-secondary | `--brand-secondary` | #FF8FC6 | Second logo color, used in gradients and brand moments only. |
| brand-ground | `--brand-ground` | #660032 | Ground color of the login hero and other brand moments. |
| brand-ground-foreground | `--brand-ground-foreground` | #FFFFFF | Text on brand-ground, as in the login hero. |
| font-brand | `--font-brand` | Poppins, sans-serif | Display font for brand moments only, such as the login hero. |
| font-brand-weight | `--font-brand-weight` | 600 | Weight of the display font in brand moments. |
| font-brand-stretch | `--font-brand-stretch` | 100% | font-stretch of the display font in brand moments. |
| font-brand-tracking | `--font-brand-tracking` | -0.02em | letter-spacing of the display font in brand moments. |

### Cover Clearance

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| brand-primary | `--brand-primary` | #E48725 | Logo color, the same in both modes; brand moments only. |
| brand-secondary | `--brand-secondary` | #0576BB | Second logo color, used in gradients and brand moments only. |
| brand-ground | `--brand-ground` | #E48725 | Ground color of the login hero and other brand moments. |
| brand-ground-foreground | `--brand-ground-foreground` | #1A1F2E | Text on brand-ground, as in the login hero. |
| font-brand | `--font-brand` | "Rethink Sans Variable", "Rethink Sans", sans-serif | Display font for brand moments only, such as the login hero. |
| font-brand-weight | `--font-brand-weight` | 800 | Weight of the display font in brand moments. |
| font-brand-stretch | `--font-brand-stretch` | 100% | font-stretch of the display font in brand moments. |
| font-brand-tracking | `--font-brand-tracking` | -0.02em | letter-spacing of the display font in brand moments. |

### Lokasign

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| brand-primary | `--brand-primary` | #0060EF | Logo color, the same in both modes; brand moments only. |
| brand-secondary | `--brand-secondary` | #7DAEFF | Second logo color, used in gradients and brand moments only. |
| brand-ground | `--brand-ground` | #001D43 | Ground color of the login hero and other brand moments. |
| brand-ground-foreground | `--brand-ground-foreground` | #FFFFFF | Text on brand-ground, as in the login hero. |
| font-brand | `--font-brand` | "Newsreader Variable", Newsreader, Georgia, serif | Display font for brand moments only, such as the login hero. |
| font-brand-weight | `--font-brand-weight` | 500 | Weight of the display font in brand moments. |
| font-brand-stretch | `--font-brand-stretch` | 100% | font-stretch of the display font in brand moments. |
| font-brand-tracking | `--font-brand-tracking` | -0.01em | letter-spacing of the display font in brand moments. |

### My Loka Link

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| brand-primary | `--brand-primary` | #0A66C2 | Logo color, the same in both modes; brand moments only. |
| brand-secondary | `--brand-secondary` | #00B8C8 | Second logo color, used in gradients and brand moments only. |
| brand-ground | `--brand-ground` | #0A66C2 | Ground color of the login hero and other brand moments. |
| brand-ground-foreground | `--brand-ground-foreground` | #FFFFFF | Text on brand-ground, as in the login hero. |
| font-brand | `--font-brand` | "Plus Jakarta Sans Variable", "Plus Jakarta Sans", sans-serif | Display font for brand moments only, such as the login hero. |
| font-brand-weight | `--font-brand-weight` | 800 | Weight of the display font in brand moments. |
| font-brand-stretch | `--font-brand-stretch` | 100% | font-stretch of the display font in brand moments. |
| font-brand-tracking | `--font-brand-tracking` | -0.035em | letter-spacing of the display font in brand moments. |

## Three font layers

| Layer | Where | Font |
| --- | --- | --- |
| Logo | The logo only | Each product's own. Never retype a logo. |
| Display | [Brand moments](#brand-moments) only | One per product, shown below |
| UI | Everything else: tables, forms, buttons, text | Plus Jakarta Sans in every product |

| Product | Display font | Weight | Width | Sample |
| --- | --- | --- | --- | --- |
| Loka Musik | Poppins | 600 | 100% | Rilis musikmu ke semua platform. |
| Cover Clearance | Rethink Sans | 800 | 100% | Pilih lagu yang ingin kamu cover. |
| Lokasign | Newsreader | 500 | 100% | Tanda tangan sah, *dari mana saja.* |
| My Loka Link | Plus Jakarta Sans | 800 | 100% | Semua link musikmu di satu tempat. |

## Brand moments

A brand moment is a place where the product speaks in its own voice. There are three:

- **Login hero:** the left half of the login screen.
- **Welcome screens:** onboarding and the first screen of an empty account.
- **Top of the home screen:** the first screen after sign-in, on phones and on the web.

On the home screen, `font-brand` may set only:

- the greeting, such as "Halo, Bayu.";
- the title of the one featured card at the top;
- headline figures, such as total revenue or the count on a summary card.

The featured card may sit on `brand-ground`, the logo color. On it:

- text and icons use `brand-ground-foreground`;
- the main action is a `secondary` button, and other actions are `ghost` buttons in `brand-ground-foreground`;
- a badge is `outline`, with its text and border in `brand-ground-foreground`.

Only that one card goes on `brand-ground`; every other card on the home screen stays on `card`.

Section headings, lists, tables, forms, buttons, badges, the top bar and the navigation stay in `font-sans`, on the home screen too. Set `font-brand` with its weight and tracking tokens, at `text-2xl` or larger; smaller, it reads as body text in the wrong font.


---

# Color

> Semantic color tokens for every theme, each product and the neutral theme in light and dark mode.

Components ask for a role such as `primary` or `muted-foreground`, never a hex value, so the same component works in every theme.

## Roles

- `background`: the page ground behind cards.
- `foreground`: main text.
- `card` and `popover`: cards, menus and form surfaces.
- `muted` and `muted-foreground`: quiet surfaces and secondary text.
- `border` and `input`: dividers and control borders.
- `primary` and `primary-foreground`: the main action, in the product's logo color.
- `primary-soft` and `primary-text`: tinted surfaces and small primary-colored text such as links.
- `ring`: the keyboard focus ring.
- `sidebar-*`: the dashboard sidebar.

`secondary` and `accent` keep their shadcn meaning: a quiet button fill and a hover background. Neither one is a brand color.

## All themes

| Token | lokamusik-light | lokamusik-dark | coverclearance-light | coverclearance-dark | lokasign-light | lokasign-dark | mylokalink-light | mylokalink-dark | neutral-light | neutral-dark |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| background | #FDF9FA | #1C0F16 | #F9F8F6 | #0A0D14 | #F3F6FB | #001D43 | #FFFFFF | #0B1620 | #FAFAFD | #0E0E11 |
| foreground | #1C0F16 | #F5F5F5 | #181B1F | #DBDEE3 | #001D43 | #EEF3FB | #1C3B4E | #F2F6F8 | #1A1A1D | #E6E6EA |
| card | #FFFFFF | #26181F | #FFFFFF | #12161E | #FFFFFF | #0A2A57 | #FFFFFF | #13212B | #FFFFFF | #17171A |
| muted | #F5F5F5 | #2E2028 | #F2F0EC | #1B1F29 | #EAF0F8 | #0F3466 | #ECF6FC | #1A2B36 | #F2F2F6 | #1F1F22 |
| muted-foreground | #4A3A42 | #B4A7AA | #625D56 | #A0A5AE | #4A5B78 | #A9BAD6 | #657078 | #87939B | #636366 | #AAAAAE |
| border | #ECE4E6 | #3A2B33 | #ECE9E3 | #262B36 | #D5DEEC | #1D4478 | #DCE8F1 | #23343F | #E6E6EA | #2B2B2E |
| input | #998D90 | #7A6871 | #908F8D | #5F646D | #7D8FA9 | #5376A6 | #8A969E | #606B72 | #909093 | #68686C |
| primary | #660032 | #FF8FC6 | #E48725 | #E87F34 | #0060EF | #7DAEFF | #0A66C2 | #65A7F9 | #27272A | #E4E4E7 |
| primary-foreground | #FFFFFF | #660032 | #FFFFFF | #180600 | #FFFFFF | #001D43 | #FFFFFF | #0B1620 | #FFFFFF | #0D0D10 |
| primary-soft | #FFEEF6 | #3D001E | #FFEEE1 | #371C0B | #E6EFFE | #0F3466 | #ECF4FF | #162C47 | #F3F3F4 | #29292A |
| primary-text | #660032 | #FF8FC6 | #A8530A | #EF9F67 | #0050C8 | #7DAEFF | #0A66C2 | #72A7EB | #27272A | #E4E4E7 |
| ring | #660032 | #FF8FC6 | #A8530A | #E87F34 | #0060EF | #7DAEFF | #0A66C2 | #65A7F9 | #27272A | #E4E4E7 |
| card-foreground | #1C0F16 | #F5F5F5 | #181B1F | #DBDEE3 | #001D43 | #EEF3FB | #1C3B4E | #F2F6F8 | #1A1A1D | #E6E6EA |
| popover | #FFFFFF | #26181F | #FFFFFF | #12161E | #FFFFFF | #0A2A57 | #FFFFFF | #13212B | #FFFFFF | #17171A |
| popover-foreground | #1C0F16 | #F5F5F5 | #181B1F | #DBDEE3 | #001D43 | #EEF3FB | #1C3B4E | #F2F6F8 | #1A1A1D | #E6E6EA |
| secondary | #F5F5F5 | #2E2028 | #F2F0EC | #1B1F29 | #EAF0F8 | #0F3466 | #ECF6FC | #1A2B36 | #F2F2F6 | #1F1F22 |
| secondary-foreground | #1C0F16 | #F5F5F5 | #181B1F | #DBDEE3 | #001D43 | #EEF3FB | #1C3B4E | #F2F6F8 | #1A1A1D | #E6E6EA |
| accent | #F5F5F5 | #2E2028 | #F2F0EC | #1B1F29 | #EAF0F8 | #0F3466 | #ECF6FC | #1A2B36 | #F2F2F6 | #1F1F22 |
| accent-foreground | #1C0F16 | #F5F5F5 | #181B1F | #DBDEE3 | #001D43 | #EEF3FB | #1C3B4E | #F2F6F8 | #1A1A1D | #E6E6EA |
| sidebar | #FFFFFF | #26181F | #FFFFFF | #12161E | #FFFFFF | #0A2A57 | #FFFFFF | #13212B | #FFFFFF | #17171A |
| sidebar-foreground | #1C0F16 | #F5F5F5 | #181B1F | #DBDEE3 | #001D43 | #EEF3FB | #1C3B4E | #F2F6F8 | #1A1A1D | #E6E6EA |
| sidebar-border | #ECE4E6 | #3A2B33 | #ECE9E3 | #262B36 | #D5DEEC | #1D4478 | #DCE8F1 | #23343F | #E6E6EA | #2B2B2E |
| sidebar-accent | #FFEEF6 | #3D001E | #FFEEE1 | #371C0B | #E6EFFE | #0F3466 | #ECF4FF | #162C47 | #F3F3F4 | #29292A |
| sidebar-accent-foreground | #660032 | #FF8FC6 | #A8530A | #EF9F67 | #0050C8 | #7DAEFF | #0A66C2 | #72A7EB | #27272A | #E4E4E7 |
| sidebar-primary | #660032 | #FF8FC6 | #E48725 | #E87F34 | #0060EF | #7DAEFF | #0A66C2 | #65A7F9 | #27272A | #E4E4E7 |
| sidebar-primary-foreground | #FFFFFF | #660032 | #FFFFFF | #180600 | #FFFFFF | #001D43 | #FFFFFF | #0B1620 | #FFFFFF | #0D0D10 |
| sidebar-ring | #660032 | #FF8FC6 | #A8530A | #E87F34 | #0060EF | #7DAEFF | #0A66C2 | #65A7F9 | #27272A | #E4E4E7 |
| tenant-accent | #660032 | #FF8FC6 | #E48725 | #E87F34 | #0060EF | #7DAEFF | #0A66C2 | #65A7F9 | #27272A | #E4E4E7 |
| tenant-accent-foreground | #FFFFFF | #660032 | #FFFFFF | #180600 | #FFFFFF | #001D43 | #FFFFFF | #0B1620 | #FFFFFF | #0D0D10 |
| tenant-accent-soft | #FFEEF6 | #3D001E | #FFEEE1 | #371C0B | #E6EFFE | #0F3466 | #ECF4FF | #162C47 | #F3F3F4 | #29292A |
| tenant-accent-text | #660032 | #FF8FC6 | #A8530A | #EF9F67 | #0050C8 | #7DAEFF | #0A66C2 | #72A7EB | #27272A | #E4E4E7 |

## Status

Status colors are the same in every product. `success`, `warning` and `destructive` carry color; `info` is a neutral slate, so it never looks like the blue actions of Lokasign or My Loka Link. Color alone never carries a status: always pair it with a word or an icon.

### Light

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| success | `--success` | #0B6B5E | Status color for done, approved, published; text and icons on background, card and success-soft. |
| success-foreground | `--success-foreground` | #FFFFFF | Text on a solid success fill. |
| success-soft | `--success-soft` | #DDF3EF | Background of success badges and banners; text on it uses success. |
| warning | `--warning` | #8A4B00 | Status color for pending, waiting for review; text and icons on background, card and warning-soft. |
| warning-foreground | `--warning-foreground` | #FFFFFF | Text on a solid warning fill. |
| warning-soft | `--warning-soft` | #FFF1D6 | Background of warning badges and banners; text on it uses warning. |
| destructive | `--destructive` | #B42318 | Status color for errors, rejected, delete actions; text and icons on background, card and destructive-soft. |
| destructive-foreground | `--destructive-foreground` | #FFFFFF | Text on a solid destructive fill. |
| destructive-soft | `--destructive-soft` | #FDE7E4 | Background of destructive badges and banners; text on it uses destructive. |
| info | `--info` | #475467 | Neutral status for information and tips; slate so it never reads as a brand action. Text and icons on background, card and info-soft. |
| info-foreground | `--info-foreground` | #FFFFFF | Text on a solid info fill. |
| info-soft | `--info-soft` | #EEF1F5 | Background of info badges and banners; text on it uses info. |

### Dark

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| success | `--success` | #4FD1B5 | Status color for done, approved, published; text and icons on background, card and success-soft. |
| success-foreground | `--success-foreground` | #0B1620 | Text on a solid success fill. |
| success-soft | `--success-soft` | #12302B | Background of success badges and banners; text on it uses success. |
| warning | `--warning` | #F5B544 | Status color for pending, waiting for review; text and icons on background, card and warning-soft. |
| warning-foreground | `--warning-foreground` | #0B1620 | Text on a solid warning fill. |
| warning-soft | `--warning-soft` | #3A2C0F | Background of warning badges and banners; text on it uses warning. |
| destructive | `--destructive` | #FF8A75 | Status color for errors, rejected, delete actions; text and icons on background, card and destructive-soft. |
| destructive-foreground | `--destructive-foreground` | #0B1620 | Text on a solid destructive fill. |
| destructive-soft | `--destructive-soft` | #3A1A16 | Background of destructive badges and banners; text on it uses destructive. |
| info | `--info` | #B4BFCC | Neutral status for information and tips; slate so it never reads as a brand action. Text and icons on background, card and info-soft. |
| info-foreground | `--info-foreground` | #0B1620 | Text on a solid info fill. |
| info-soft | `--info-soft` | #1E2733 | Background of info badges and banners; text on it uses info. |

## Chart palette

Charts use five series colors, `chart-1` to `chart-5`, in that order. `chart-1` is the product's own hue; `chart-2` to `chart-5` (magenta, teal, olive, indigo) are the same in every product and never reuse a status color. Every series reaches 3:1 on `background` and `card`, and the order passes the color-blind checks for neighboring series. Cover Clearance light steps its orange down to `#C2620E` for `chart-1`, because `#E48725` stays under 3:1 on its background. More than five series fold into "Lainnya". See [Chart](https://design.sosialoka.tech/components/chart/).

### Light

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| chart-2 | `--chart-2` | #C2185B | Second chart series (magenta); the same in every product, never a status color. |
| chart-3 | `--chart-3` | #0087A3 | Third chart series (teal); the same in every product, never a status color. |
| chart-4 | `--chart-4` | #6B7A00 | Fourth chart series (olive); the same in every product, never a status color. |
| chart-5 | `--chart-5` | #5B4FCF | Fifth chart series (indigo); the same in every product, never a status color. |
| chart-1 | `--chart-1` | #C2620E | First chart series: the brand hue, stepped where needed to reach 3:1 on background and card. |

### Dark

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| chart-2 | `--chart-2` | #D94E85 | Second chart series (magenta); the same in every product, never a status color. |
| chart-3 | `--chart-3` | #14A3B8 | Third chart series (teal); the same in every product, never a status color. |
| chart-4 | `--chart-4` | #8C9A17 | Fourth chart series (olive); the same in every product, never a status color. |
| chart-5 | `--chart-5` | #7B6FE0 | Fifth chart series (indigo); the same in every product, never a status color. |
| chart-1 | `--chart-1` | #C9701F | First chart series: the brand hue, stepped where needed to reach 3:1 on background and card. |

## Tenant accent presets

My Loka Link artist pages and Ruang Loka Musik tenants take their own accent color. Set `data-tenant-accent` on the page root to one of the presets below; the four `tenant-accent` tokens switch, and nothing else changes. Without a preset, the tenant tokens follow `primary`.

### Light

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| blue · tenant-accent | `--tenant-accent` | #0A66C2 | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "blue", light mode. |
| blue · tenant-accent-foreground | `--tenant-accent-foreground` | #FFFFFF | Text on tenant-accent. Preset "blue", light mode. |
| blue · tenant-accent-soft | `--tenant-accent-soft` | #ECF4FF | Tinted surface in the tenant accent. Preset "blue", light mode. |
| blue · tenant-accent-text | `--tenant-accent-text` | #0A66C2 | Text in the tenant accent on background, card and tenant-accent-soft. Preset "blue", light mode. |
| orange · tenant-accent | `--tenant-accent` | #C4530F | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "orange", light mode. |
| orange · tenant-accent-foreground | `--tenant-accent-foreground` | #FFFFFF | Text on tenant-accent. Preset "orange", light mode. |
| orange · tenant-accent-soft | `--tenant-accent-soft` | #FFEDE0 | Tinted surface in the tenant accent. Preset "orange", light mode. |
| orange · tenant-accent-text | `--tenant-accent-text` | #AB4400 | Text in the tenant accent on background, card and tenant-accent-soft. Preset "orange", light mode. |
| teal · tenant-accent | `--tenant-accent` | #007B76 | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "teal", light mode. |
| teal · tenant-accent-foreground | `--tenant-accent-foreground` | #FFFFFF | Text on tenant-accent. Preset "teal", light mode. |
| teal · tenant-accent-soft | `--tenant-accent-soft` | #DCF9F6 | Tinted surface in the tenant accent. Preset "teal", light mode. |
| teal · tenant-accent-text | `--tenant-accent-text` | #006D69 | Text in the tenant accent on background, card and tenant-accent-soft. Preset "teal", light mode. |
| red · tenant-accent | `--tenant-accent` | #BE222A | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "red", light mode. |
| red · tenant-accent-foreground | `--tenant-accent-foreground` | #FFFFFF | Text on tenant-accent. Preset "red", light mode. |
| red · tenant-accent-soft | `--tenant-accent-soft` | #FFECEB | Tinted surface in the tenant accent. Preset "red", light mode. |
| red · tenant-accent-text | `--tenant-accent-text` | #B32228 | Text in the tenant accent on background, card and tenant-accent-soft. Preset "red", light mode. |

### Dark

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| blue · tenant-accent | `--tenant-accent` | #65A7F9 | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "blue", dark mode. |
| blue · tenant-accent-foreground | `--tenant-accent-foreground` | #1C3B4E | Text on tenant-accent. Preset "blue", dark mode. |
| blue · tenant-accent-soft | `--tenant-accent-soft` | #162C47 | Tinted surface in the tenant accent. Preset "blue", dark mode. |
| blue · tenant-accent-text | `--tenant-accent-text` | #72A7EB | Text in the tenant accent on background, card and tenant-accent-soft. Preset "blue", dark mode. |
| orange · tenant-accent | `--tenant-accent` | #F49752 | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "orange", dark mode. |
| orange · tenant-accent-foreground | `--tenant-accent-foreground` | #241005 | Text on tenant-accent. Preset "orange", dark mode. |
| orange · tenant-accent-soft | `--tenant-accent-soft` | #3A1E0E | Tinted surface in the tenant accent. Preset "orange", dark mode. |
| orange · tenant-accent-text | `--tenant-accent-text` | #F9A870 | Text in the tenant accent on background, card and tenant-accent-soft. Preset "orange", dark mode. |
| teal · tenant-accent | `--tenant-accent` | #55CEC0 | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "teal", dark mode. |
| teal · tenant-accent-foreground | `--tenant-accent-foreground` | #001C1A | Text on tenant-accent. Preset "teal", dark mode. |
| teal · tenant-accent-soft | `--tenant-accent-soft` | #092D2B | Tinted surface in the tenant accent. Preset "teal", dark mode. |
| teal · tenant-accent-text | `--tenant-accent-text` | #69D3C6 | Text in the tenant accent on background, card and tenant-accent-soft. Preset "teal", dark mode. |
| red · tenant-accent | `--tenant-accent` | #F68482 | Tenant or artist accent fill; defaults to primary until a preset applies. Preset "red", dark mode. |
| red · tenant-accent-foreground | `--tenant-accent-foreground` | #250E0D | Text on tenant-accent. Preset "red", dark mode. |
| red · tenant-accent-soft | `--tenant-accent-soft` | #3B1C1B | Tinted surface in the tenant accent. Preset "red", dark mode. |
| red · tenant-accent-text | `--tenant-accent-text` | #F99E9B | Text in the tenant accent on background, card and tenant-accent-soft. Preset "red", dark mode. |

## Contrast

- Text reaches at least 4.5:1 against the surface it sits on, in every theme and every tenant preset.
- Focus rings and the borders of inputs, selects and checkboxes (`input`) reach at least 3:1.
- A test checks every pair on each build, so a token change that breaks contrast fails the build.

One pair is a known exception: white text on Cover Clearance orange in light mode reaches 2.7:1. Cover Clearance keeps its logo color as the primary fill by owner decision. Keep labels on that fill short and bold.


---

# Typography

> Three font layers and the UI type scale.

Every product sets its interface in Plus Jakarta Sans; display fonts appear only in brand moments, and logos keep their own lettering.

## Fonts

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| font-sans | `--font-sans` | "Plus Jakarta Sans Variable", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif | Shared UI font for every product: tables, forms, buttons and text. |
| font-mono | `--font-mono` | "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace | Code, IDs, timestamps and tabular data. |

- Use `font-sans` for all interface text.
- Use `font-mono` for codes, IDs, timestamps and data that must line up.
- Use `font-brand` only in brand moments: the login hero, welcome screens and the top of the home screen. See [Brand moments](https://design.sosialoka.tech/brand/#brand-moments).

## Scale



| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| text-xs | `--text-xs` | 0.75rem | Font size for captions, badges and table meta. |
| text-xs--line-height | `--text-xs--line-height` | 1rem | Line height paired with text-xs. |
| text-sm | `--text-sm` | 0.875rem | Font size for default UI text: table cells, inputs, buttons. |
| text-sm--line-height | `--text-sm--line-height` | 1.25rem | Line height paired with text-sm. |
| text-base | `--text-base` | 1rem | Font size for body copy and form text on wide layouts. |
| text-base--line-height | `--text-base--line-height` | 1.5rem | Line height paired with text-base. |
| text-lg | `--text-lg` | 1.125rem | Font size for lead paragraphs and card titles. |
| text-lg--line-height | `--text-lg--line-height` | 1.75rem | Line height paired with text-lg. |
| text-xl | `--text-xl` | 1.25rem | Font size for section headings inside a page. |
| text-xl--line-height | `--text-xl--line-height` | 1.75rem | Line height paired with text-xl. |
| text-2xl | `--text-2xl` | 1.5rem | Font size for page titles in the dashboard. |
| text-2xl--line-height | `--text-2xl--line-height` | 2rem | Line height paired with text-2xl. |
| text-3xl | `--text-3xl` | 1.875rem | Font size for large page titles and empty-state headlines. |
| text-3xl--line-height | `--text-3xl--line-height` | 2.25rem | Line height paired with text-3xl. |
| text-4xl | `--text-4xl` | 2.25rem | Font size for hero numbers and marketing headlines. |
| text-4xl--line-height | `--text-4xl--line-height` | 2.5rem | Line height paired with text-4xl. |

- Use sentence case for titles, buttons and labels.
- Use `font-variant-numeric: tabular-nums` wherever numbers line up in columns.


---

# Icons

> One icon set for every product, with fixed sizes, stroke and an action dictionary.

Every product uses [Lucide](https://lucide.dev). Cover Clearance and Lokasign still use Tabler on some screens; those icons move to Lucide when each screen moves to this design system.

| Package | Import |
| --- | --- |
| React | `import { Trash2Icon } from "lucide-react"` |
| Vue | `import { Trash2 } from "@lucide/vue"` |
| Flutter | `Icon(LucideIcons.trash2)`, from `shadcn_ui` |

## Size

- **16px** (`size-4`) inside controls and next to text: buttons, inputs, badges, menu items.
- **20px** (`size-5`) in navigation: the sidebar, the bottom nav and the top bar.
- **24px** (`size-6`) in empty states.

## Stroke and color

- The stroke stays at Lucide's default of 2 in every product. Do not thin or thicken it per brand.
- Icons take `currentColor`, so they follow the text color of their control. Color an icon by coloring its text, never with a fill.

## Accessibility

- A decorative icon next to a label gets `aria-hidden="true"`.
- A button that shows only an icon needs an `aria-label` and a [Tooltip](https://design.sosialoka.tech/components/tooltip/) with the same words.
- Status icons (success, warning, error) always come with text. The icon never carries the meaning alone.

## Icon dictionary

Use the same icon for the same action in every product. If an action is not listed, pick from Lucide and add it here.

| Action | Lucide | React | Vue | Flutter |
| --- | --- | --- | --- | --- |
| Add | plus | PlusIcon | Plus | LucideIcons.plus |
| Edit | pencil | PencilIcon | Pencil | LucideIcons.pencil |
| Delete | trash-2 | Trash2Icon | Trash2 | LucideIcons.trash2 |
| Search | search | SearchIcon | Search | LucideIcons.search |
| Filter | list-filter | ListFilterIcon | ListFilter | LucideIcons.listFilter |
| Sort | arrow-up-down | ArrowUpDownIcon | ArrowUpDown | LucideIcons.arrowUpDown |
| Download | download | DownloadIcon | Download | LucideIcons.download |
| Upload | upload | UploadIcon | Upload | LucideIcons.upload |
| Notifications | bell | BellIcon | Bell | LucideIcons.bell |
| Settings | settings | SettingsIcon | Settings | LucideIcons.settings |
| Account | user | UserIcon | User | LucideIcons.user |
| Sign out | log-out | LogOutIcon | LogOut | LucideIcons.logOut |
| Release | disc | DiscIcon | Disc | LucideIcons.disc |
| Royalties | chart-column | ChartColumnIcon | ChartColumn | LucideIcons.chartColumn |
| Document | file-text | FileTextIcon | FileText | LucideIcons.fileText |
| Song | music | MusicIcon | Music | LucideIcons.music |
| Artist | mic-vocal | MicVocalIcon | MicVocal | LucideIcons.micVocal |
| Link | link | LinkIcon | Link | LucideIcons.link |
| Copy | copy | CopyIcon | Copy | LucideIcons.copy |
| Close | x | XIcon | X | LucideIcons.x |
| Back | chevron-left | ChevronLeftIcon | ChevronLeft | LucideIcons.chevronLeft |
| Info | info | InfoIcon | Info | LucideIcons.info |
| Success | circle-check | CircleCheckIcon | CircleCheck | LucideIcons.circleCheck |
| Warning | triangle-alert | TriangleAlertIcon | TriangleAlert | LucideIcons.triangleAlert |
| Error | circle-alert | CircleAlertIcon | CircleAlert | LucideIcons.circleAlert |


---

# Spacing

> A 4px spacing scale for padding, gaps and page layout.

All spacing comes from one 4px scale, so padding and gaps line up across products.



| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| space-1 | `--space-1` | 4px | Gap between an icon and its label. |
| space-2 | `--space-2` | 8px | Padding inside small controls; gap between related items. |
| space-3 | `--space-3` | 12px | Gap between form fields in a row. |
| space-4 | `--space-4` | 16px | Card padding on mobile; gap between form fields. |
| space-5 | `--space-5` | 20px | Page gutter on mobile. |
| space-6 | `--space-6` | 24px | Card padding on desktop. |
| space-8 | `--space-8` | 32px | Gap between page sections. |
| space-10 | `--space-10` | 40px | Gap between large dashboard sections. |
| space-12 | `--space-12` | 48px | Top spacing of a page header. |
| space-16 | `--space-16` | 64px | Spacing around hero blocks. |

In Tailwind v4 the base unit is `--spacing: 4px`, so `p-4` is 16px, the same as `space-4`.


---

# Radius

> Corner radius for controls, cards and dialogs.

Corners grow with the size of the surface: controls are the tightest, dialogs the softest.



| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| radius | `--radius` | 12px | shadcn base radius; equals radius-lg. |
| radius-sm | `--radius-sm` | 6px | Badges, checkboxes and small chips. |
| radius-md | `--radius-md` | 8px | Inputs and buttons. |
| radius-lg | `--radius-lg` | 12px | Cards, including the floating search card. |
| radius-xl | `--radius-xl` | 16px | Dialogs and sheets. |
| radius-full | `--radius-full` | 9999px | Controls that are round by nature: avatars, switches, radios, progress bars, stepper circles, carousel dots and the drawer handle. Buttons are never pills, except the dashboard language selector. |

- Inputs and buttons: `radius-md`.
- Cards, including the dashboard's floating header card: `radius-lg`.
- Dialogs and sheets: `radius-xl`.
- Buttons follow the input radius and are never pills. `radius-full` is for controls that are round by nature (avatars, switches, radios, progress, carousel dots) and for the language pill in the dashboard header.


---

# Elevation

> Three shadow levels; borders separate cards first.

Cards are set apart by a border first; a shadow marks something that floats above the page.



## Light

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| elevation-sm | `--elevation-sm` | 0 1px 2px 0 #1018280D | Selected tabs and slightly raised controls. |
| elevation-md | `--elevation-md` | 0 1px 2px 0 #1018280A, 0 12px 32px -8px #10182814 | Cards that float, such as the dashboard search card. |
| elevation-lg | `--elevation-lg` | 0 12px 30px -6px #10182838 | Menus, popovers, toasts and dialogs. |

## Dark

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| elevation-sm | `--elevation-sm` | 0 1px 3px 0 #00000059 | Selected tabs and slightly raised controls. |
| elevation-md | `--elevation-md` | 0 1px 3px 0 #00000059, 0 12px 32px -8px #00000080 | Cards that float, such as the dashboard search card. |
| elevation-lg | `--elevation-lg` | 0 12px 32px -4px #000000CC | Menus, popovers, toasts and dialogs. |

## Overlay

Dialogs and sheets dim the page behind them with the `overlay` token, a translucent layer that is lighter in light mode and deeper in dark mode.

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| overlay | `--overlay` | #10182866 | Translucent layer behind dialogs and sheets. |

| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| overlay | `--overlay` | #000000A3 | Translucent layer behind dialogs and sheets. |

## Use

- The floating header card of the dashboard uses `elevation-md`.
- Menus, popovers, toasts and dialogs use `elevation-lg`.
- In Tailwind v4 the levels map to `shadow-sm`, `shadow-md` and `shadow-lg`.


---

# Motion

> Durations, easing curves and the login hero animation.

Motion is quiet in the interface and saved for one orchestrated moment: the login hero.



| Token | CSS variable | Value | Use |
| --- | --- | --- | --- |
| duration-fast | `--duration-fast` | 160ms | Hover and press feedback. |
| duration-base | `--duration-base` | 300ms | Fades, color changes and small reveals. |
| duration-slow | `--duration-slow` | 700ms | Lead text entering in the login hero. |
| duration-sheet | `--duration-sheet` | 1050ms | Login hero sheet-in and sheet-out between chapters. |
| duration-chapter | `--duration-chapter` | 7000ms | Time each login hero chapter stays on screen. |
| ease-standard | `--ease-standard` | cubic-bezier(0.22, 1, 0.36, 1) | Default easing for entering elements. |
| ease-expo | `--ease-expo` | cubic-bezier(0.16, 1, 0.3, 1) | Word-up and art-settle in the login hero. |
| ease-in-out | `--ease-in-out` | cubic-bezier(0.76, 0, 0.24, 1) | Sheet transitions between login hero chapters. |

## Login hero

The left half of every login screen is a brand moment that cycles through chapters.

- Each chapter stays for `duration-chapter` (7 seconds).
- A new chapter's sheet rises in over `duration-sheet` (1050ms) with `ease-in-out`.
- Headline words rise one by one in 900ms with `ease-expo`, starting at 420ms with 40ms between words.
- The illustration settles in 1300ms with `ease-expo`.
- Progress bars show the current chapter, and a pause button stops the cycle.
- The cycle pauses on hover, on keyboard focus and when the tab is hidden.
- With `prefers-reduced-motion: reduce`, chapters switch without movement.
- Below the `lg` breakpoint the hero is hidden and the form fills the screen.


---

# Components

> Sosialoka components for React and Vue, installed from the Sosialoka registry with the shadcn CLI.

Sosialoka components are shadcn components with the Sosialoka tokens, radius and status colors built in, for React and Vue.

React components are built on Base UI and installed with `shadcn`; Vue components are built on Reka UI and installed with `shadcn-vue`. Both copy the source into your project, so you own the code.

## Set up a project

Install your product's theme first, then the components you need. The steps for React and Vue are on [Web](https://design.sosialoka.tech/web/#set-up-a-shadcn-project); a single component installs like this:

```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/button.json
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/button.json
```

For Flutter, set up the `sosialoka_ui` package on [Flutter](https://design.sosialoka.tech/flutter/) and copy the code from each component's Flutter tab.

## Components

### Actions

| Component | Use it for |
| --- | --- |
| [Button](https://design.sosialoka.tech/components/button/) | Starting an action. |
| [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/) | Actions behind one button. |
| [Command](https://design.sosialoka.tech/components/command/) | Searching from the keyboard, and the header search card. |

### Forms

| Component | Use it for |
| --- | --- |
| [Input](https://design.sosialoka.tech/components/input/) | One line of text. |
| [Input Group](https://design.sosialoka.tech/components/input-group/) | An input with an icon, text or a button attached, such as search or a password. |
| [Textarea](https://design.sosialoka.tech/components/textarea/) | Several lines of text. |
| [Label](https://design.sosialoka.tech/components/label/) | Naming a form control. |
| [Field](https://design.sosialoka.tech/components/field/) | A label, a hint and the backend's error around one control. |
| [Checkbox](https://design.sosialoka.tech/components/checkbox/) | Turning one option on or off. |
| [Radio Group](https://design.sosialoka.tech/components/radio-group/) | Picking one of a few visible options. |
| [Switch](https://design.sosialoka.tech/components/switch/) | A setting that applies right away. |
| [Slider](https://design.sosialoka.tech/components/slider/) | Picking a value or a range on a track, such as a preview to cut. |
| [Toggle Group](https://design.sosialoka.tech/components/toggle-group/) | Filter chips above a list, such as statuses. |
| [Select](https://design.sosialoka.tech/components/select/) | Picking one value from a short list. |
| [Combobox](https://design.sosialoka.tech/components/combobox/) | Picking from a long list by typing. |
| [Calendar](https://design.sosialoka.tech/components/calendar/) | A month to pick a day from, on the page. |
| [Date Picker](https://design.sosialoka.tech/components/date-picker/) | A date field that opens a calendar. |
| [Input OTP](https://design.sosialoka.tech/components/input-otp/) | A one-time code in six boxes. |
| [File Upload](https://design.sosialoka.tech/components/file-upload/) | Dropping or choosing files, with size and progress. |

### Display

| Component | Use it for |
| --- | --- |
| [Badge](https://design.sosialoka.tech/components/badge/) | Showing a status or a short label. |
| [Alert](https://design.sosialoka.tech/components/alert/) | A message that stays on the page, in a status color. |
| [Card](https://design.sosialoka.tech/components/card/) | Grouping content on its own surface. |
| [Carousel](https://design.sosialoka.tech/components/carousel/) | A row of cards to slide through, such as the latest releases. |
| [Item](https://design.sosialoka.tech/components/item/) | A list row on phones and in panels. |
| [Accordion](https://design.sosialoka.tech/components/accordion/) | Sections that open one at a time. |
| [Separator](https://design.sosialoka.tech/components/separator/) | A thin line between groups. |
| [Avatar](https://design.sosialoka.tech/components/avatar/) | A person or artist as a picture or initials. |
| [Timeline](https://design.sosialoka.tech/components/timeline/) | What happened to a record, newest first. |

### Navigation

| Component | Use it for |
| --- | --- |
| [Tabs](https://design.sosialoka.tech/components/tabs/) | Switching between views of the same content. |
| [Breadcrumb](https://design.sosialoka.tech/components/breadcrumb/) | The path back from a deep page. |
| [Stepper](https://design.sosialoka.tech/components/stepper/) | The steps of a flow and where you are. |
| [Sidebar](https://design.sosialoka.tech/components/sidebar/) | The main navigation of a dashboard. |

### Data

| Component | Use it for |
| --- | --- |
| [Table](https://design.sosialoka.tech/components/table/) | Records in rows and columns, with pagination. |
| [Chart](https://design.sosialoka.tech/components/chart/) | Numbers over time or across categories, with a table of the same numbers. |

### Overlays

| Component | Use it for |
| --- | --- |
| [Dialog](https://design.sosialoka.tech/components/dialog/) | A decision or a short form over the page. |
| [Alert Dialog](https://design.sosialoka.tech/components/alert-dialog/) | Confirming an action that can't be undone. |
| [Sheet](https://design.sosialoka.tech/components/sheet/) | Filters or details in a panel from the edge. |
| [Drawer](https://design.sosialoka.tech/components/drawer/) | A bottom sheet on phones. |
| [Popover](https://design.sosialoka.tech/components/popover/) | Extra content or a short task beside its trigger. |
| [Tooltip](https://design.sosialoka.tech/components/tooltip/) | Naming an icon-only control. |

### Feedback

| Component | Use it for |
| --- | --- |
| [Toast](https://design.sosialoka.tech/components/toast/) | Confirming an action. |
| [Progress](https://design.sosialoka.tech/components/progress/) | How far an upload or import has come. |
| [Spinner](https://design.sosialoka.tech/components/spinner/) | A short wait, or a button that is saving. |
| [Skeleton](https://design.sosialoka.tech/components/skeleton/) | Placeholders while content loads. |

## Supporting items

Some components install smaller Sosialoka items with them: `toggle` comes with Toggle Group, `pagination` with Table, `native-select` with the Vue Calendar (for its month and year pickers), and React components use the `use-mobile` hook. They follow the same tokens, so you can also use them on their own.


---

# Button

> Starts an action, such as saving a form or opening a dialog.

A button starts an action on the current page; use a link when the action takes the person somewhere else.

## When to use

- Use one `default` button for the main action of a form, card or dialog.
- Use `secondary` or `outline` for the other actions next to it.
- Use `ghost` in toolbars and dense rows, and `link` inside running text.
- Use `destructive` only for actions that delete or cancel something.
- Don't use a button to navigate to another page; use a link.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/button/_

### Do and don't

- **Do:** Use one default button for the main action; the others are outline or secondary.
- **Don't:** Don't give two actions the same weight; people can't tell which one moves them forward.

## Anatomy

1. Container, on the control radius
2. Label
3. Outline variant for a second action

A button is a label, with an optional icon before or after it. It sits on the control radius (`radius-md`, 8px) and is never a pill.

## Variants

| Variant | Looks | Use it for |
| --- | --- | --- |
| `default` | `primary` fill, `primary-foreground` text | The main action. One per area. |
| `secondary` | `secondary` fill | A second action with less weight. |
| `outline` | `border` outline on `background` | Neutral actions next to the main one. |
| `ghost` | No fill until hover | Toolbars, table rows, icon buttons. |
| `destructive` | `destructive` text on a soft destructive fill | Delete, reject or cancel. |
| `link` | `primary` text, underlined on hover | Actions inside a sentence. |

Sizes: `xs`, `sm`, `default`, `lg`, and square `icon`, `icon-xs`, `icon-sm`, `icon-lg` for icon-only buttons.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `variant` | `variant` | named constructor (`ShadButton.outline`) | see Variants | `default` | Visual weight. |
| `size` | `size` | `size` (`ShadButtonSize`) | see Variants | `default` | Height and padding. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks the action. |
| `onClick` | `@click` | `onPressed` | function | none | Runs the action. |

## Code

**React**
```tsx
import { Button } from "@/components/ui/button"

export default function ButtonDemo() {
  return (
    <div className="flex flex-wrap items-center gap-2">
      <Button>Simpan</Button>
      <Button variant="secondary">Simpan draf</Button>
      <Button variant="outline">Lihat detail</Button>
      <Button variant="ghost">Batal</Button>
      <Button variant="destructive">Hapus</Button>
      <Button variant="link">Pelajari lebih lanjut</Button>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Button } from "@/components/ui/button"
</script>

<template>
  <div class="flex flex-wrap items-center gap-2">
    <Button>Simpan</Button>
    <Button variant="secondary">Simpan draf</Button>
    <Button variant="outline">Lihat detail</Button>
    <Button variant="ghost">Batal</Button>
    <Button variant="destructive">Hapus</Button>
    <Button variant="link">Pelajari lebih lanjut</Button>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class ButtonDemo extends StatelessWidget {
  const ButtonDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Wrap(
      spacing: 8,
      runSpacing: 8,
      children: [
        ShadButton(onPressed: () {}, child: const Text('Simpan')),
        ShadButton.secondary(onPressed: () {}, child: const Text('Simpan draf')),
        ShadButton.outline(onPressed: () {}, child: const Text('Lihat detail')),
        ShadButton.ghost(onPressed: () {}, child: const Text('Batal')),
        ShadButton.destructive(onPressed: () {}, child: const Text('Hapus')),
        ShadButton.link(onPressed: () {}, child: const Text('Pelajari lebih lanjut')),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/button.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/button.json
```

## Accessibility

- Renders a native `button`, so Enter and Space trigger it.
- Every icon-only button needs an `aria-label`.
- The focus ring uses `ring` and shows only for keyboard focus.
- Keep the label to the action itself: "Simpan", not "Klik di sini".


---

# Input

> A single-line text field.

An input takes one line of text, such as a name, an email address or a search term.

## When to use

- Use it for short, free text.
- Use [Select](https://design.sosialoka.tech/components/select/) when the answer comes from a short list.
- Always pair it with a [Label](https://design.sosialoka.tech/components/label/); a placeholder is not a label.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/input/_

### Do and don't

- **Do:** Put the label above the field, where it stays while people type.
- **Don't:** Don't use the placeholder as the label; it disappears as soon as people type.

## Anatomy

1. Label above the field
2. Field with an input border
3. Value
4. Caret

Label above the field, the field itself, then an optional hint below it. The field uses `input` for its border, `radius-md` for its corners and `ring` for focus.

## Variants

There is one style. Invalid fields set `aria-invalid`, which turns the border and the focus ring `destructive`.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value` / `defaultValue` | `v-model` / `default-value` | `controller` / `initialValue` | string | none | The text. |
| `type` | `type` | `keyboardType` | string | `text` | Keyboard and validation hints. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks typing. |
| `aria-invalid` | `aria-invalid` | `validator` | boolean | `false` | Marks the value as wrong. |

## Code

**React**
```tsx
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

export default function InputDemo() {
  return (
    <div className="grid w-full max-w-sm gap-2">
      <Label htmlFor="input-demo-email">Email</Label>
      <Input id="input-demo-email" type="email" aria-describedby="input-demo-hint" />
      <p id="input-demo-hint" className="text-sm text-muted-foreground">
        Ke sini kami kirim kabar penting untukmu.
      </p>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
</script>

<template>
  <div class="grid w-full max-w-sm gap-2">
    <Label for="input-demo-email-vue">Email</Label>
    <Input id="input-demo-email-vue" type="email" aria-describedby="input-demo-hint-vue" />
    <p id="input-demo-hint-vue" class="text-sm text-muted-foreground">
      Ke sini kami kirim kabar penting untukmu.
    </p>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class InputDemo extends StatelessWidget {
  const InputDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: ShadInputFormField(
        id: 'email',
        label: const Text('Email'),
        keyboardType: TextInputType.emailAddress,
        description: const Text('Ke sini kami kirim kabar penting untukmu.'),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/input.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/input.json
```

## Accessibility

- Link the label with `htmlFor` (React) or `for` (Vue) and the field's `id`.
- Link the hint with `aria-describedby` so screen readers read it.
- Error text comes from the backend; show it below the field and set `aria-invalid`.


---

# Input Group

> An input with buttons, icons or text attached.

An input group attaches an icon, text or a small button to an input, inside one border.

## When to use

- **Search:** a search icon before the input.
- **Password:** a button after the input that shows or hides the password. This is the Sosialoka password field; there is no separate password component.
- **Units and prefixes:** text such as `Rp` or `.id` before or after the value.
- Don't put the main action of a form inside the group; it goes in the form footer.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/input-group/_

## Anatomy

1. Leading icon
2. Input
3. Attached button

1. **Group** (`InputGroup`): one `input` border on `radius-md`, `h-9` tall. Focus on the input rings the whole group.
2. **Addon** (`InputGroupAddon`): an icon, text or button, at `inline-start` (before) or `inline-end` (after).
3. **Control** (`InputGroupInput` or `InputGroupTextarea`): the field itself, without its own border.

## Variants

| Addon position | Use it for |
| --- | --- |
| `inline-start` | A search icon, a currency such as `Rp`. |
| `inline-end` | The show-password button, a unit, a clear button. |
| `block-start` / `block-end` | A label or actions above or below an `InputGroupTextarea`. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `InputGroupAddon align` | `InputGroupAddon align` | `leading` / `trailing` on `ShadInput` | `inline-start`, `inline-end`, `block-start`, `block-end` | `inline-start` | Where the addon sits. |
| `InputGroupButton size` | `InputGroupButton size` | `ShadIconButton` in `trailing` | `xs`, `sm`, `icon-xs`, `icon-sm` | `xs` | A small button inside the group. |
| `type` on `InputGroupInput` | `type` on `InputGroupInput` | `obscureText` | text | `text` | `password` hides the text; `search` makes a search field. |

## Code

**React**
```tsx
import { useId, useState } from "react"
import { EyeIcon, EyeOffIcon, SearchIcon } from "lucide-react"
import { Field, FieldLabel } from "@/components/ui/field"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group"

export default function InputGroupDemo() {
  const id = useId()
  const [visible, setVisible] = useState(false)
  return (
    <div className="grid w-full max-w-sm gap-6">
      <InputGroup>
        <InputGroupAddon>
          <SearchIcon />
        </InputGroupAddon>
        <InputGroupInput type="search" placeholder="Cari rilis" aria-label="Cari rilis" />
      </InputGroup>
      <Field>
        <FieldLabel htmlFor={`${id}-password`}>Kata sandi</FieldLabel>
        <InputGroup>
          <InputGroupInput id={`${id}-password`} type={visible ? "text" : "password"} autoComplete="current-password" />
          <InputGroupAddon align="inline-end">
            <InputGroupButton
              size="icon-xs"
              aria-label={visible ? "Sembunyikan kata sandi" : "Tampilkan kata sandi"}
              aria-pressed={visible}
              onClick={() => setVisible((v) => !v)}
            >
              {visible ? <EyeOffIcon /> : <EyeIcon />}
            </InputGroupButton>
          </InputGroupAddon>
        </InputGroup>
      </Field>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref, useId } from "vue"
import { EyeIcon, EyeOffIcon, SearchIcon } from "@lucide/vue"
import { Field, FieldLabel } from "@/components/ui/field"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group"

const id = useId()
const visible = ref(false)
</script>

<template>
  <div class="grid w-full max-w-sm gap-6">
    <InputGroup>
      <InputGroupAddon>
        <SearchIcon />
      </InputGroupAddon>
      <InputGroupInput type="search" placeholder="Cari rilis" aria-label="Cari rilis" />
    </InputGroup>
    <Field>
      <FieldLabel :for="`${id}-password`">Kata sandi</FieldLabel>
      <InputGroup>
        <InputGroupInput :id="`${id}-password`" :type="visible ? 'text' : 'password'" autocomplete="current-password" />
        <InputGroupAddon align="inline-end">
          <InputGroupButton
            size="icon-xs"
            :aria-label="visible ? 'Sembunyikan kata sandi' : 'Tampilkan kata sandi'"
            :aria-pressed="visible"
            @click="visible = !visible"
          >
            <EyeOffIcon v-if="visible" />
            <EyeIcon v-else />
          </InputGroupButton>
        </InputGroupAddon>
      </InputGroup>
    </Field>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class InputGroupDemo extends StatefulWidget {
  const InputGroupDemo({super.key});

  @override
  State<InputGroupDemo> createState() => _InputGroupDemoState();
}

class _InputGroupDemoState extends State<InputGroupDemo> {
  bool visible = false;

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        spacing: 24,
        children: [
          const ShadInput(
            placeholder: Text('Cari rilis'),
            leading: Icon(LucideIcons.search, size: 16),
          ),
          ShadInputFormField(
            id: 'password',
            label: const Text('Kata sandi'),
            obscureText: !visible,
            trailing: Semantics(
              label: visible ? 'Sembunyikan kata sandi' : 'Tampilkan kata sandi',
              toggled: visible,
              child: ShadIconButton.ghost(
                width: 24,
                height: 24,
                icon: Icon(visible ? LucideIcons.eyeOff : LucideIcons.eye, size: 16),
                onPressed: () => setState(() => visible = !visible),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/input-group.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/input-group.json
```

## Accessibility

- The input keeps its own label: a visible label in a Field, or an `aria-label` such as "Cari rilis" for a search field with only an icon.
- The show-password button says what it does: `aria-label` "Tampilkan kata sandi" / "Sembunyikan kata sandi", with `aria-pressed` while the password shows.
- Icons in addons are decorative and need no label.


---

# Textarea

> A multi-line text field.

A textarea takes text that runs over several lines, such as notes or a description, and grows with its content.

## When to use

- Use it for notes, descriptions and messages.
- Use an Input for one line, such as a name or a title.
- Put it in a Field, with a hint that says the limit, such as "Paling banyak 500 karakter."

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/textarea/_

## Anatomy

1. Label
2. Field that grows with its text
3. Resize handle

A box on `radius-md` with an `input` border, at least `min-h-16` tall, that grows with its content (`field-sizing-content`). Focus shows the `ring`; an invalid value turns the border `destructive`.

## Variants

There is one style.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value` / `defaultValue` | `v-model` / `default-value` | `controller` / `initialValue` | text | none | The text. |
| `maxLength` | `maxlength` | `maxLength` | number | none | The longest text allowed. Say it in the hint too. |
| `rows` | `rows` | `minHeight` | number | grows with content | The starting height. |
| `aria-invalid` | `aria-invalid` | `forceErrorText` on `ShadTextareaFormField` | boolean | `false` | Marks a refused value. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks typing. |

## Code

**React**
```tsx
import { useId } from "react"
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Textarea } from "@/components/ui/textarea"

export default function TextareaDemo() {
  const id = useId()
  return (
    <Field className="w-full max-w-sm">
      <FieldLabel htmlFor={`${id}-notes`}>Catatan untuk tim</FieldLabel>
      <Textarea id={`${id}-notes`} maxLength={500} aria-describedby={`${id}-notes-hint`} />
      <FieldDescription id={`${id}-notes-hint`}>Paling banyak 500 karakter.</FieldDescription>
    </Field>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Textarea } from "@/components/ui/textarea"

const id = useId()
</script>

<template>
  <Field class="w-full max-w-sm">
    <FieldLabel :for="`${id}-notes`">Catatan untuk tim</FieldLabel>
    <Textarea :id="`${id}-notes`" :maxlength="500" :aria-describedby="`${id}-notes-hint`" />
    <FieldDescription :id="`${id}-notes-hint`">Paling banyak 500 karakter.</FieldDescription>
  </Field>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class TextareaDemo extends StatelessWidget {
  const TextareaDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    // ShadTextareaFormField does not pass maxLength on, so the label and hint sit around a ShadTextarea.
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        spacing: 8,
        children: [
          Text('Catatan untuk tim', style: theme.textTheme.small),
          const ShadTextarea(maxLength: 500),
          Text('Paling banyak 500 karakter.', style: theme.textTheme.muted),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/textarea.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/textarea.json
```

## Accessibility

- Give it a visible label in a Field.
- Tie the hint and any error to it with `aria-describedby`.
- It keeps the native `textarea` keyboard behavior: Enter adds a line, Tab moves on.


---

# Label

> Names a form control and focuses it when clicked.

A label names a form control, and clicking it moves focus to that control.

## When to use

- Give every input, select and checkbox a visible label.
- Put labels above inputs and selects, and beside checkboxes.
- Keep labels short; put guidance in a hint below the field.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/label/_

## Anatomy

1. Label text
2. Required mark
3. The control it names

One line of `text-sm` medium text in `foreground`. A disabled control dims its label too.

## Variants

There is one style.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `htmlFor` | `for` | `label` on the field | string | none | The `id` of the control it names. |

## Code

**React**
```tsx
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

export default function LabelDemo() {
  return (
    <div className="grid w-full max-w-sm gap-2">
      <Label htmlFor="label-demo-name">Nama lengkap</Label>
      <Input id="label-demo-name" />
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
</script>

<template>
  <div class="grid w-full max-w-sm gap-2">
    <Label for="label-demo-name-vue">Nama lengkap</Label>
    <Input id="label-demo-name-vue" />
  </div>
</template>
```

**Flutter**
```dart
// Flutter has no separate label widget: form fields take a `label`.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class LabelDemo extends StatelessWidget {
  const LabelDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: ShadInputFormField(
        id: 'name',
        label: const Text('Nama lengkap'),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/label.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/label.json
```

## Accessibility

- Renders a native `label`, so clicking it focuses the control.
- Flutter has no separate label widget; pass `label` to the form field.


---

# Field

> Puts a label, a hint and an error message around one form control.

A field puts a label above a form control, a one-sentence hint below it and, when the backend refuses the value, the backend's error message.

## When to use

- Wrap every form control that people fill in: Input, Textarea, Select, Combobox, Input OTP.
- Use `FieldSet` with a `FieldLegend` to group controls that answer one question, such as a Radio Group.
- Use the `horizontal` orientation only for a Switch or a Checkbox, with the control before its label.
- Don't write error messages in the client. The backend validates every field and returns the message; the client only disables the submit button until the required fields have a value.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/field/_

## Anatomy

1. Label
2. Control, red border while invalid
3. Hint
4. The backend's error message

1. **Label** (`FieldLabel`): above the control, in `foreground`. It turns `destructive` when the field is invalid.
2. **Control**: the input, textarea or other control, with `aria-invalid` while its value is refused.
3. **Hint** (`FieldDescription`): one practical sentence in `muted-foreground`.
4. **Error** (`FieldError`): the backend's message in `destructive`, with `role="alert"`.

Point the control at the hint and the error with `aria-describedby`, so screen readers read both. The field does not add the ids for you.

## Variants

| Orientation | Use it for |
| --- | --- |
| `vertical` (default) | Every text control: label above, hint and error below. |
| `horizontal` | A Switch or a Checkbox: the control on the left, the label and hint on the right. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `orientation` on `Field` | `orientation` on `Field` | separate widgets (`ShadSwitch` has its own `label`) | `vertical` / `horizontal` | `vertical` | Places the label above or beside the control. |
| `data-invalid` on `Field` | `data-invalid="true"` on `Field` (a bare `data-invalid` renders empty and does not match) | `forceErrorText` | boolean / text | none | Marks the field as refused. |
| `FieldLabel htmlFor` | `FieldLabel for` | `label` | text | none | Names the control. |
| `FieldDescription` | `FieldDescription` | `description` | text | none | The one-sentence hint. |
| `FieldError` | `FieldError` | `forceErrorText` | text | none | The backend's error message. |
| `FieldSet`, `FieldLegend` | `FieldSet`, `FieldLegend` | a `Text` heading over the group | none | none | Groups controls that answer one question. |

## Code

**React**
```tsx
import { useId } from "react"
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { Textarea } from "@/components/ui/textarea"

export default function FieldDemo() {
  const id = useId()
  return (
    <FieldGroup className="w-full max-w-sm">
      {/* The error comes from the backend; the client only shows it. */}
      <Field data-invalid>
        <FieldLabel htmlFor={`${id}-title`}>Judul lagu</FieldLabel>
        <Input
          id={`${id}-title`}
          aria-invalid
          aria-describedby={`${id}-title-hint ${id}-title-error`}
        />
        <FieldDescription id={`${id}-title-hint`}>Tulis sesuai sampul rilis.</FieldDescription>
        <FieldError id={`${id}-title-error`}>Judul lagunya belum diisi.</FieldError>
      </Field>
      <Field>
        <FieldLabel htmlFor={`${id}-notes`}>Catatan</FieldLabel>
        <Textarea id={`${id}-notes`} aria-describedby={`${id}-notes-hint`} />
        <FieldDescription id={`${id}-notes-hint`}>Opsional, untuk tim rilis.</FieldDescription>
      </Field>
    </FieldGroup>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { Textarea } from "@/components/ui/textarea"

const id = useId()
</script>

<template>
  <FieldGroup class="w-full max-w-sm">
    <!-- The error comes from the backend; the client only shows it. -->
    <Field data-invalid="true">
      <FieldLabel :for="`${id}-title`">Judul lagu</FieldLabel>
      <Input :id="`${id}-title`" aria-invalid="true" :aria-describedby="`${id}-title-hint ${id}-title-error`" />
      <FieldDescription :id="`${id}-title-hint`">Tulis sesuai sampul rilis.</FieldDescription>
      <FieldError :id="`${id}-title-error`">Judul lagunya belum diisi.</FieldError>
    </Field>
    <Field>
      <FieldLabel :for="`${id}-notes`">Catatan</FieldLabel>
      <Textarea :id="`${id}-notes`" :aria-describedby="`${id}-notes-hint`" />
      <FieldDescription :id="`${id}-notes-hint`">Opsional, untuk tim rilis.</FieldDescription>
    </Field>
  </FieldGroup>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class FieldDemo extends StatelessWidget {
  const FieldDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        spacing: 24,
        children: [
          // The error comes from the backend; the field only shows it.
          ShadInputFormField(
            id: 'title',
            label: const Text('Judul lagu'),
            description: const Text('Tulis sesuai sampul rilis.'),
            forceErrorText: 'Judul lagunya belum diisi.',
          ),
          ShadTextareaFormField(
            id: 'notes',
            label: const Text('Catatan'),
            description: const Text('Opsional, untuk tim rilis.'),
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/field.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/field.json
```

## Accessibility

- Every control has a visible label tied to it with `htmlFor` / `for`.
- An invalid control has `aria-invalid="true"` and an `aria-describedby` that lists the hint id and the error id.
- The error has `role="alert"`, so it is announced when it appears.
- A `FieldSet` names its group with its `FieldLegend`.


---

# Checkbox

> Turns one option on or off.

A checkbox turns one option on or off, or picks several options from a list.

## When to use

- Use it for agreements and for choosing several items.
- Use a radio group or a [Select](https://design.sosialoka.tech/components/select/) when only one choice is allowed.
- Don't use it for settings that apply at once; use a switch.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/checkbox/_

## Anatomy

1. Checked box on primary
2. Unchecked box
3. Label, also clickable

A 16px box on `radius-sm` (6px) with a check icon, and a label beside it. Checked boxes fill with `primary`.

## Variants

There is one style. A checkbox can be checked, unchecked or indeterminate.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `checked` / `defaultChecked` | `v-model` / `default-value` | `value` | boolean | `false` | The state. |
| `onCheckedChange` | `@update:model-value` | `onChanged` | function | none | Runs when the state changes. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks changes. |
| `id` | `id` | `label` | string | none | Links the label. |

## Code

**React**
```tsx
import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"

export default function CheckboxDemo() {
  return (
    <div className="flex items-center gap-2">
      <Checkbox id="checkbox-demo-terms" />
      <Label htmlFor="checkbox-demo-terms">Saya setuju dengan syarat penggunaan</Label>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"
</script>

<template>
  <div class="flex items-center gap-2">
    <Checkbox id="checkbox-demo-terms-vue" />
    <Label for="checkbox-demo-terms-vue">Saya setuju dengan syarat penggunaan</Label>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class CheckboxDemo extends StatefulWidget {
  const CheckboxDemo({super.key});

  @override
  State<CheckboxDemo> createState() => _CheckboxDemoState();
}

class _CheckboxDemoState extends State<CheckboxDemo> {
  bool agreed = false;

  @override
  Widget build(BuildContext context) {
    return ShadCheckbox(
      value: agreed,
      onChanged: (value) => setState(() => agreed = value),
      label: const Text('Saya setuju dengan syarat penggunaan'),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/checkbox.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/checkbox.json
```

## Accessibility

- Renders `role="checkbox"` with `aria-checked`; Space toggles it.
- Every checkbox needs a label, linked by `id`.


---

# Radio Group

> Picks one option from a few that are all visible.

A radio group shows two to five options at once and lets people pick exactly one.

## When to use

- Use it for 2 to 5 options that people should compare before picking, such as the type of a release.
- Use a [Select](https://design.sosialoka.tech/components/select/) for more options, and a [Switch](https://design.sosialoka.tech/components/switch/) or [Checkbox](https://design.sosialoka.tech/components/checkbox/) for one yes-or-no setting.
- Always pick a sensible default.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/radio-group/_

## Anatomy

1. Option
2. Selected option
3. Label

A `FieldSet` with a `FieldLegend` that asks the question, and one row per option: a round item on an `input` border that fills with `primary` when chosen, its label and an optional one-sentence description.

## Variants

There is one style.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value` / `defaultValue` | `v-model` / `default-value` | `initialValue` | text | none | The chosen option. |
| `onValueChange` | `@update:model-value` | `onChanged` | function | none | Runs when the choice changes. |
| `RadioGroupItem value` | `RadioGroupItem value` | `ShadRadio value` | text | none | One option. |
| label in `FieldLabel` | label in `FieldLabel` | `label`, `sublabel` | text | none | Names the option. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks the group or one item. |

## Code

**React**
```tsx
import { useId } from "react"
import { Field, FieldContent, FieldDescription, FieldLabel, FieldLegend, FieldSet } from "@/components/ui/field"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

const types = [
  { value: "single", label: "Single", hint: "Satu sampai tiga lagu." },
  { value: "ep", label: "EP", hint: "Empat sampai enam lagu." },
  { value: "album", label: "Album", hint: "Tujuh lagu atau lebih." },
]

export default function RadioGroupDemo() {
  const id = useId()
  return (
    <FieldSet className="w-full max-w-sm">
      <FieldLegend id={`${id}-legend`}>Jenis rilis</FieldLegend>
      <RadioGroup defaultValue="single" aria-labelledby={`${id}-legend`}>
        {types.map((t) => (
          <Field key={t.value} orientation="horizontal">
            <RadioGroupItem value={t.value} id={`${id}-${t.value}`} aria-describedby={`${id}-${t.value}-hint`} />
            <FieldContent>
              <FieldLabel htmlFor={`${id}-${t.value}`}>{t.label}</FieldLabel>
              <FieldDescription id={`${id}-${t.value}-hint`}>{t.hint}</FieldDescription>
            </FieldContent>
          </Field>
        ))}
      </RadioGroup>
    </FieldSet>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Field, FieldContent, FieldDescription, FieldLabel, FieldLegend, FieldSet } from "@/components/ui/field"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

const types = [
  { value: "single", label: "Single", hint: "Satu sampai tiga lagu." },
  { value: "ep", label: "EP", hint: "Empat sampai enam lagu." },
  { value: "album", label: "Album", hint: "Tujuh lagu atau lebih." },
]
const id = useId()
</script>

<template>
  <FieldSet class="w-full max-w-sm">
    <FieldLegend :id="`${id}-legend`">Jenis rilis</FieldLegend>
    <RadioGroup default-value="single" :aria-labelledby="`${id}-legend`">
      <Field v-for="t in types" :key="t.value" orientation="horizontal">
        <RadioGroupItem :id="`${id}-${t.value}`" :value="t.value" :aria-describedby="`${id}-${t.value}-hint`" />
        <FieldContent>
          <FieldLabel :for="`${id}-${t.value}`">{{ t.label }}</FieldLabel>
          <FieldDescription :id="`${id}-${t.value}-hint`">{{ t.hint }}</FieldDescription>
        </FieldContent>
      </Field>
    </RadioGroup>
  </FieldSet>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const releaseTypes = {
  'single': ('Single', 'Satu sampai tiga lagu.'),
  'ep': ('EP', 'Empat sampai enam lagu.'),
  'album': ('Album', 'Tujuh lagu atau lebih.'),
};

class RadioGroupDemo extends StatelessWidget {
  const RadioGroupDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Semantics(
      label: 'Jenis rilis',
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        spacing: 12,
        children: [
          Text('Jenis rilis', style: ShadTheme.of(context).textTheme.small),
          ShadRadioGroup<String>(
            initialValue: 'single',
            items: [
              for (final MapEntry(key: value, value: (label, hint)) in releaseTypes.entries)
                ShadRadio(value: value, label: Text(label), sublabel: Text(hint)),
            ],
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/radio-group.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/radio-group.json
```

## Accessibility

- The group has `role="radiogroup"`, named by its legend; each option has `role="radio"`.
- Tab moves into the group to the chosen option; the arrow keys move the choice.
- Tie each description to its option with `aria-describedby`.


---

# Switch

> Turns a setting on or off right away.

A switch turns one setting on or off, and the change applies right away, without a save button.

## When to use

- Use it for settings that apply at once, such as email notifications.
- Use a [Checkbox](https://design.sosialoka.tech/components/checkbox/) for a choice that is saved with a form, or for agreeing to terms.
- Write the label as the setting, not as a question: "Kirim notifikasi email".

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/switch/_

### Do and don't

- **Do:** Use a switch for a setting that applies the moment it changes.
- **Don't:** Don't put switches in a form that waits for a save button; use checkboxes there.

## Anatomy

1. Track, primary when on
2. Thumb
3. Label
4. Off state

A pill track that is `input` when off and `primary` when on, with a `background` thumb. It sits before its label and a one-sentence description, in a Field with the `horizontal` orientation.

## Variants

Two sizes: `default` and `sm`.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `checked` / `defaultChecked` | `v-model` / `default-value` | `value` | boolean | `false` | On or off. |
| `onCheckedChange` | `@update:model-value` | `onChanged` | function | none | Runs when it changes. |
| `size` | `size` | `width` / `height` | `default`, `sm` | `default` | The size. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks changes. |
| label in `FieldLabel` | label in `FieldLabel` | `label`, `sublabel` | text | none | Names the setting. |

## Code

**React**
```tsx
import { useId } from "react"
import { Field, FieldContent, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Switch } from "@/components/ui/switch"

export default function SwitchDemo() {
  const id = useId()
  return (
    <Field orientation="horizontal" className="w-full max-w-sm">
      <Switch id={`${id}-email`} aria-describedby={`${id}-email-hint`} />
      <FieldContent>
        <FieldLabel htmlFor={`${id}-email`}>Kirim notifikasi email</FieldLabel>
        <FieldDescription id={`${id}-email-hint`}>Kabar rilis dan royalti masuk ke inbox kamu.</FieldDescription>
      </FieldContent>
    </Field>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Field, FieldContent, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Switch } from "@/components/ui/switch"

const id = useId()
</script>

<template>
  <Field orientation="horizontal" class="w-full max-w-sm">
    <Switch :id="`${id}-email`" :aria-describedby="`${id}-email-hint`" />
    <FieldContent>
      <FieldLabel :for="`${id}-email`">Kirim notifikasi email</FieldLabel>
      <FieldDescription :id="`${id}-email-hint`">Kabar rilis dan royalti masuk ke inbox kamu.</FieldDescription>
    </FieldContent>
  </Field>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class SwitchDemo extends StatefulWidget {
  const SwitchDemo({super.key});

  @override
  State<SwitchDemo> createState() => _SwitchDemoState();
}

class _SwitchDemoState extends State<SwitchDemo> {
  bool email = false;

  @override
  Widget build(BuildContext context) {
    return ShadSwitch(
      value: email,
      onChanged: (value) => setState(() => email = value),
      label: const Text('Kirim notifikasi email'),
      sublabel: const Text('Kabar rilis dan royalti masuk ke inbox kamu.'),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/switch.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/switch.json
```

## Accessibility

- It has `role="switch"` and `aria-checked`.
- Space toggles it; clicking the label toggles it too.
- Tie the description to it with `aria-describedby`.


---

# Slider

> Picks a value or a range on a track, such as where a preview starts and ends.

A slider picks a value, or a range with two thumbs, by dragging along a track, such as the part of a song to use as a preview.

## When to use

- Use it when the rough position matters more than the exact number: a preview window, a volume.
- Always show the value as text next to it, such as "0:30–1:00 dari 3:20".
- When the number has to be exact, such as a price or a percentage in a contract, use an [Input](https://design.sosialoka.tech/components/input/).

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/slider/_

## Anatomy

1. Track
2. Selected range
3. Thumb
4. Value

| Part | Style |
| --- | --- |
| Track | 6px (`h-1.5`), `rounded-full`, `bg-muted` |
| Range | `bg-primary` |
| Thumb | 16px (`size-4`), `rounded-full`, a `primary` border on `background` |

With two thumbs, they never pass each other.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value`, `onValueChange` | `v-model` | `ShadSlider initialValue`, `onChanged` | number[] / number | none | The value, or the start and end of a range. |
| `min`, `max`, `step` | same | `min`, `max`, `divisions` | number | 0, 100, 1 | The range and the step. |
| `getAriaLabel` | `get-aria-label` | `Semantics label` | function | none | Names each thumb, such as "Awal" and "Akhir". |
| `getAriaValueText` | `get-aria-value-text` | `semanticFormatterCallback` | function | the number | What screen readers say, such as "1:05". |

`shadcn_ui` has one thumb; for a range in Flutter, use Material's `RangeSlider` inside `SosialokaTheme.material`.

## Code

**React**
```tsx
import { useState } from "react"
import { Slider } from "@/components/ui/slider"

const time = (seconds: number) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`

export default function SliderDemo() {
  const [range, setRange] = useState([30, 60])
  return (
    <div className="flex w-full max-w-sm flex-col gap-3">
      <div className="flex items-baseline justify-between text-sm">
        <p id="preview-label" className="font-medium">
          Potong preview
        </p>
        <p className="text-muted-foreground tabular-nums">
          {time(range[0])}–{time(range[1])} dari 3:20
        </p>
      </div>
      <Slider
        aria-labelledby="preview-label"
        value={range}
        onValueChange={(value) => setRange(value as number[])}
        max={200}
        getAriaLabel={(index) => (index === 0 ? "Awal" : "Akhir")}
        getAriaValueText={(_, value) => time(value)}
      />
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref } from "vue"
import { Slider } from "@/components/ui/slider"

const range = ref([30, 60])
const time = (seconds: number) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`
</script>

<template>
  <div class="flex w-full max-w-sm flex-col gap-3">
    <div class="flex items-baseline justify-between text-sm">
      <p id="preview-label" class="font-medium">
        Potong preview
      </p>
      <p class="text-muted-foreground tabular-nums">
        {{ time(range[0]) }}–{{ time(range[1]) }} dari 3:20
      </p>
    </div>
    <Slider
      v-model="range"
      aria-labelledby="preview-label"
      :max="200"
      :get-aria-label="(index) => (index === 0 ? 'Awal' : 'Akhir')"
      :get-aria-value-text="(value) => time(value)"
    />
  </div>
</template>
```

**Flutter**
```dart
// ShadSlider has one thumb. For a range (start and end of a preview), use Material's RangeSlider inside
// SosialokaTheme.material, whose slider colors come from the same tokens.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

String _time(double seconds) => '${seconds ~/ 60}:${(seconds % 60).toInt().toString().padLeft(2, '0')}';

class SliderDemo extends StatefulWidget {
  const SliderDemo({super.key});

  @override
  State<SliderDemo> createState() => _SliderDemoState();
}

class _SliderDemoState extends State<SliderDemo> {
  double start = 30;

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Row(
            children: [
              const Expanded(child: Text('Awal preview', style: TextStyle(fontWeight: FontWeight.w500))),
              Text('${_time(start)} dari 3:20', style: theme.textTheme.muted),
            ],
          ),
          const SizedBox(height: 12),
          ShadSlider(
            initialValue: start,
            max: 200,
            divisions: 200,
            semanticFormatterCallback: _time,
            onChanged: (value) => setState(() => start = value),
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/slider.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/slider.json
```

## Accessibility

- Each thumb is a `slider` with a name and a spoken value, such as "Awal, 0:30".
- Arrow keys move one step, Page Up and Page Down ten, Home and End to the ends.
- The value also shows as text, so nobody has to drag to read it.


---

# Toggle Group

> Chips that filter or switch a view; one or several can be on.

A toggle group is a row of chips that filter the content on the page, such as release statuses, or switch how it shows.

## When to use

- Use it for quick filters above a list, with the count in each chip: "Terbit 12".
- A status filter **always has one value**: "Semua" by default, and clicking the active chip keeps it on.
- Use [Tabs](https://design.sosialoka.tech/components/tabs/) when each option shows different content, and a [Select](https://design.sosialoka.tech/components/select/) for more than five options.
- Use several-on mode for filters that combine, such as genres.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/toggle-group/_

## Anatomy

1. Selected chip
2. Chip
3. Group, one value at a time

Chips `h-8` on `radius-md` with a `border`, 8px apart, never pill-shaped. An active chip is `primary-soft` with `primary-text` and a `primary`-tinted border. An optional count sits after the label in `muted-foreground`.

## Variants

| Mode | Use it for |
| --- | --- |
| One on | Status filters, view switches. |
| Several on (`multiple`) | Filters that combine. |

The single **Toggle** (one button that stays pressed) installs with the group and has no page of its own.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `multiple` | `type="single"` / `"multiple"` | `ShadToggleGroup` / `ShadToggleGroup.multiple` | mode | one on | How many chips can be on. |
| `value` (array) / `onValueChange` | `v-model` | `initialValue` / `onChanged` | value | none | The chips that are on. |
| keep one on: ignore an empty value | keep one on: ignore an empty value | `allowDeselection: false` | boolean | can be emptied | Keeps a status filter from going empty. |
| `variant="outline"` | `variant="outline"` | `ShadToggleVariant.outline` | text | `default` | The chip look. |
| `spacing` | `spacing` | `spacing` | number | `2` (React), `0` (Vue) | The gap between chips; `0` joins them. Use `2`. |

## Code

**React**
```tsx
import { useState } from "react"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

const statuses = [
  { value: "all", label: "Semua", count: 24 },
  { value: "published", label: "Terbit", count: 12 },
  { value: "pending", label: "Menunggu", count: 8 },
  { value: "rejected", label: "Ditolak", count: 4 },
]

export default function ToggleGroupDemo() {
  const [status, setStatus] = useState("all")
  return (
    <ToggleGroup
      variant="outline"
      spacing={2}
      aria-label="Filter status"
      value={[status]}
      // A status filter always has one value: clicking the active chip keeps it on.
      onValueChange={(value) => value.length > 0 && setStatus(value[value.length - 1])}
    >
      {statuses.map((s) => (
        <ToggleGroupItem key={s.value} value={s.value}>
          {s.label}
          <span className="tabular-nums text-muted-foreground">{s.count}</span>
        </ToggleGroupItem>
      ))}
    </ToggleGroup>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref } from "vue"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

const statuses = [
  { value: "all", label: "Semua", count: 24 },
  { value: "published", label: "Terbit", count: 12 },
  { value: "pending", label: "Menunggu", count: 8 },
  { value: "rejected", label: "Ditolak", count: 4 },
]
const status = ref("all")

// A status filter always has one value: clicking the active chip keeps it on.
function pick(value: unknown) {
  if (typeof value === "string" && value) status.value = value
}
</script>

<template>
  <ToggleGroup type="single" variant="outline" :spacing="2" aria-label="Filter status" :model-value="status" @update:model-value="pick">
    <ToggleGroupItem v-for="s in statuses" :key="s.value" :value="s.value">
      {{ s.label }}
      <span class="tabular-nums text-muted-foreground">{{ s.count }}</span>
    </ToggleGroupItem>
  </ToggleGroup>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const releaseStatuses = [('all', 'Semua', 24), ('published', 'Terbit', 12), ('pending', 'Menunggu', 8), ('rejected', 'Ditolak', 4)];

class ToggleGroupDemo extends StatelessWidget {
  const ToggleGroupDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    // A status filter always has one value: allowDeselection keeps the active chip on.
    return ShadToggleGroup<String>(
      initialValue: 'all',
      allowDeselection: false,
      variant: ShadToggleVariant.outline,
      spacing: 8,
      items: [
        for (final (value, label, count) in releaseStatuses)
          ShadToggleGroupItem(
            value: value,
            child: Row(
              mainAxisSize: MainAxisSize.min,
              spacing: 6,
              children: [Text(label), Text('$count', style: theme.textTheme.muted)],
            ),
          ),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/toggle-group.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/toggle-group.json
```

## Accessibility

- Name the group with `aria-label`, such as "Filter status".
- Each chip says whether it is on with `aria-pressed`.
- Arrow keys move between chips; Space and Enter turn one on.
- Put the count inside the chip, so it is read with the label.


---

# Select

> Picks one value from a short list.

A select picks one value from a short list that opens in a popup.

## When to use

- Use it for 4 to 15 options.
- Use radio buttons for 2 or 3 options, so all are visible at once.
- Use a [Combobox](https://design.sosialoka.tech/components/combobox/) when the list is long or people search it.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/select/_

## Anatomy

1. Trigger showing the value
2. Chevron
3. List of options
4. Selected option with a check

A trigger on `radius-md` showing the chosen value or a placeholder, and a popup on `popover` with `radius-lg` and `elevation` from `shadow-md`. The popup renders outside the page flow, so it is never clipped by a card.

## Variants

There is one style, in two trigger sizes: `default` and `sm`.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `items` | children (`SelectItem`) | `options` | list | none | The options. In React, Base UI needs `items` on the root. |
| `value` / `defaultValue` | `v-model` / `default-value` | `initialValue` | string | none | The chosen value. |
| `onValueChange` | `@update:model-value` | `onChanged` | function | none | Runs when the value changes. |
| placeholder item (`value: null`) | `placeholder` on `SelectValue` | `placeholder` | text | none | Shown before a choice. |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Blocks opening. |

## Code

**React**
```tsx
import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"

const products = [
  { label: "Pilih produk", value: null },
  { label: "Loka Musik", value: "lokamusik" },
  { label: "Cover Clearance", value: "coverclearance" },
  { label: "Lokasign", value: "lokasign" },
  { label: "My Loka Link", value: "mylokalink" },
]

export default function SelectDemo() {
  return (
    <Select items={products}>
      <SelectTrigger className="w-56" aria-label="Produk">
        <SelectValue />
      </SelectTrigger>
      <SelectContent>
        <SelectGroup>
          {products
            .filter((p) => p.value !== null)
            .map((p) => (
              <SelectItem key={p.value} value={p.value}>
                {p.label}
              </SelectItem>
            ))}
        </SelectGroup>
      </SelectContent>
    </Select>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"

const products = [
  { label: "Loka Musik", value: "lokamusik" },
  { label: "Cover Clearance", value: "coverclearance" },
  { label: "Lokasign", value: "lokasign" },
  { label: "My Loka Link", value: "mylokalink" },
]
</script>

<template>
  <Select>
    <SelectTrigger class="w-56" aria-label="Produk">
      <SelectValue placeholder="Pilih produk" />
    </SelectTrigger>
    <SelectContent>
      <SelectGroup>
        <SelectItem v-for="p in products" :key="p.value" :value="p.value">
          {{ p.label }}
        </SelectItem>
      </SelectGroup>
    </SelectContent>
  </Select>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const products = {
  'lokamusik': 'Loka Musik',
  'coverclearance': 'Cover Clearance',
  'lokasign': 'Lokasign',
  'mylokalink': 'My Loka Link',
};

class SelectDemo extends StatelessWidget {
  const SelectDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(minWidth: 224),
      child: ShadSelect<String>(
        placeholder: const Text('Pilih produk'),
        options: products.entries
            .map((e) => ShadOption(value: e.key, child: Text(e.value)))
            .toList(),
        selectedOptionBuilder: (context, value) => Text(products[value]!),
        onChanged: (value) {},
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/select.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/select.json
```

## Accessibility

- The trigger has `role="combobox"` and opens with Enter, Space or the arrow keys.
- Arrow keys move through options; typing jumps to a matching option; Escape closes.
- Give the trigger a label, or an `aria-label` when no visible label fits.


---

# Combobox

> Picks one value from a long list by typing to search it.

A combobox is a text field with a list: people type to narrow the list, then pick one value with the mouse or the keyboard.

## When to use

- Use it for more than 15 options, or whenever people know what they look for, such as an artist, a song or a company.
- Use a [Select](https://design.sosialoka.tech/components/select/) for 4 to 15 options, and a [Radio Group](https://design.sosialoka.tech/components/radio-group/) for 2 or 3.
- Write the empty text for the list, such as "Artis tidak ditemukan.", so people know the search worked.

**Searching on the server.** When the list lives in the backend, search as people type: wait about 300ms after the last key, keep the previous results while the next ones load, and show a [Spinner](https://design.sosialoka.tech/components/spinner/) in the list. The backend decides what matches.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/combobox/_

## Anatomy

1. Input to type in
2. Typed text and caret
3. Matching option
4. List

1. **Input**: a text field on `radius-md` with an `input` border, `h-9` tall.
2. **List**: a popup on `popover` with a `border`, `radius-lg` and `shadow-lg`, as wide as the input.
3. **Item**: `radius-md`; the highlighted item is `accent` and the chosen one has a check icon.
4. **Empty text**: shown when nothing matches.

## Variants

There is one style. React also has chips (`ComboboxChips`) for picking several values.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `items` on `Combobox` | `ComboboxItem` children | `options` on `ShadSelect.withSearch` | list | none | The options. |
| `value` / `defaultValue` | `v-model` | `initialValue` | value | none | The chosen value. |
| `onValueChange` | `@update:model-value` | `onChanged` | function | none | Runs when a value is picked. |
| `placeholder` on `ComboboxInput` | `placeholder` on `ComboboxInput` | `placeholder` | text | none | Shown before a choice. |
| `ComboboxEmpty` | `ComboboxEmpty` | an empty row in `options` | text | none | Says nothing matched. |
| `onInputValueChange` | `@update:model-value` on `ComboboxInput` | `onSearchChanged` | function | none | Runs as people type, for server search. |

## Code

**React**
```tsx
import { useId } from "react"
import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList,
} from "@/components/ui/combobox"
import { Field, FieldLabel } from "@/components/ui/field"

const artists = ["Rara Senandika", "Bima Laras", "Nada Kirana", "Arka Wening", "Sinta Maharani", "Raka Pratama"]

export default function ComboboxDemo() {
  const id = useId()
  return (
    <Field className="w-full max-w-xs">
      <FieldLabel htmlFor={`${id}-artist`}>Artis</FieldLabel>
      <Combobox items={artists}>
        <ComboboxInput id={`${id}-artist`} placeholder="Pilih artis" />
        <ComboboxContent>
          <ComboboxEmpty>Artis tidak ditemukan.</ComboboxEmpty>
          <ComboboxList>
            {(artist: string) => (
              <ComboboxItem key={artist} value={artist}>
                {artist}
              </ComboboxItem>
            )}
          </ComboboxList>
        </ComboboxContent>
      </Combobox>
    </Field>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref, useId } from "vue"
import { CheckIcon } from "@lucide/vue"
import {
  Combobox,
  ComboboxAnchor,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxItemIndicator,
  ComboboxList,
} from "@/components/ui/combobox"
import { Field, FieldLabel } from "@/components/ui/field"

const artists = ["Rara Senandika", "Bima Laras", "Nada Kirana", "Arka Wening", "Sinta Maharani", "Raka Pratama"]
const id = useId()
const artist = ref<string>()
</script>

<template>
  <Field class="w-full max-w-xs">
    <FieldLabel :for="`${id}-artist`">Artis</FieldLabel>
    <Combobox v-model="artist">
      <ComboboxAnchor>
        <ComboboxInput :id="`${id}-artist`" placeholder="Pilih artis" :display-value="(value: string) => value ?? ''" />
      </ComboboxAnchor>
      <ComboboxList>
        <ComboboxEmpty>Artis tidak ditemukan.</ComboboxEmpty>
        <ComboboxItem v-for="name in artists" :key="name" :value="name">
          {{ name }}
          <ComboboxItemIndicator>
            <CheckIcon />
          </ComboboxItemIndicator>
        </ComboboxItem>
      </ComboboxList>
    </Combobox>
  </Field>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const artists = ['Rara Senandika', 'Bima Laras', 'Nada Kirana', 'Arka Wening', 'Sinta Maharani', 'Raka Pratama'];

class ComboboxDemo extends StatefulWidget {
  const ComboboxDemo({super.key});

  @override
  State<ComboboxDemo> createState() => _ComboboxDemoState();
}

class _ComboboxDemoState extends State<ComboboxDemo> {
  String search = '';

  @override
  Widget build(BuildContext context) {
    final matches = artists.where((a) => a.toLowerCase().contains(search.toLowerCase())).toList();
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      spacing: 8,
      children: [
        Text('Artis', style: ShadTheme.of(context).textTheme.small),
        ShadSelect<String>.withSearch(
          minWidth: 280,
          placeholder: const Text('Pilih artis'),
          searchPlaceholder: const Text('Cari artis'),
          onSearchChanged: (value) => setState(() => search = value),
          options: [
            if (matches.isEmpty)
              const Padding(padding: EdgeInsets.symmetric(vertical: 24), child: Text('Artis tidak ditemukan.')),
            for (final artist in matches) ShadOption(value: artist, child: Text(artist)),
          ],
          selectedOptionBuilder: (context, value) => Text(value),
        ),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/combobox.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/combobox.json
```

## Accessibility

- The input has `role="combobox"` and a visible label; the list has `role="listbox"` and its items `role="option"`.
- Typing filters the list. Arrow keys move through the items, Enter picks one, and Escape closes the list without changing the value.
- The empty text is read when nothing matches.


---

# Calendar

> A month of days to pick a date from.

A calendar shows a month on the page to pick a day from, such as a release date when the date is the main task of the screen. In a form, use the [Date Picker](https://design.sosialoka.tech/components/date-picker/), which opens this calendar in a popover.

## When to use

- Use it inline when picking the date is the task, such as scheduling a release.
- In forms, use the Date Picker instead, so the calendar only takes space when it is open.
- For dates far in the past, such as a birth date, use the month and year pickers (`captionLayout="dropdown"` in React, `layout="month-and-year"` in Vue).

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/calendar/_

## Anatomy

1. Month heading
2. Weekdays, starting Monday
3. Selected day
4. Today

A heading with the month and year, previous and next buttons, a row of short weekday names and the days.

| Day | Style |
| --- | --- |
| Any day | 36px (`size-9`), `rounded-md` |
| Today | A `ring` |
| Selected | `bg-primary`, `text-primary-foreground` |
| Outside the month | `muted-foreground` |

It speaks English by default (en-GB): "November 2026", "Mo Tu We Th Fr Sa Su", and weeks start on Monday. For Indonesian, pass `id` from `react-day-picker/locale` in React or `locale="id-ID"` in Vue, as the example does; Flutter follows the app's locale.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `mode="single"` | single by default | `ShadCalendar` | | single | Pick one day, a range or several days. |
| `selected`, `onSelect` | `v-model` | `selected`, `onChanged` | `Date` / `DateValue` / `DateTime` | none | The chosen day. |
| `locale` | `locale` | the app's `locale` | locale | English (en-GB) | Month and day names, and the first day of the week. |
| `defaultMonth` | `default-placeholder` | `initialMonth` | date | today | The month shown first. |
| `captionLayout` | `layout` | `captionLayout` | text | label | Month and year pickers instead of the heading. |

## Code

**React**
```tsx
import { useState } from "react"
import { id } from "react-day-picker/locale"
import { Calendar } from "@/components/ui/calendar"

export default function CalendarDemo() {
  const [date, setDate] = useState<Date | undefined>(new Date(2026, 10, 14))
  return <Calendar locale={id} mode="single" selected={date} onSelect={setDate} defaultMonth={date} className="rounded-lg border border-border" />
}
```

**Vue**
```vue
<script setup lang="ts">
import type { DateValue } from "@internationalized/date"
import { CalendarDate } from "@internationalized/date"
import { shallowRef } from "vue"
import { Calendar } from "@/components/ui/calendar"

const date = shallowRef<DateValue>(new CalendarDate(2026, 11, 14))
</script>

<template>
  <Calendar v-model="date" locale="id-ID" :default-placeholder="date" class="rounded-lg border border-border" />
</template>
```

**Flutter**
```dart
// ShadCalendar reads month and weekday names from the app locale: run the app with
// locale: Locale('id') and GlobalMaterialLocalizations.delegates (flutter_localizations).
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class CalendarDemo extends StatelessWidget {
  const CalendarDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadCalendar(
      selected: DateTime(2026, 11, 14),
      initialMonth: DateTime(2026, 11),
      weekStartsOn: 1,
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/calendar.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/calendar.json
```

## Accessibility

- Arrow keys move between days, Page Up and Page Down between months, and Enter or Space picks the day.
- Each day button says its full date, such as "Sabtu, 14 November 2026", and whether it is today or chosen.
- The previous and next buttons are named "Ke bulan sebelumnya" and "Ke bulan berikutnya".


---

# Date Picker

> A button that opens a calendar and shows the chosen date.

A date picker is a form field that opens a [Calendar](https://design.sosialoka.tech/components/calendar/) in a popover and shows the chosen date, such as a release date.

## When to use

- Use it for one date in a form, near today: a release date, a deadline.
- In long forms where people know the exact date, such as a birth date or a contract date years ago, a native date input (`<input type="date">`) is faster to type.
- Show the date as `14 Nov 2026`. Send it to the backend as ISO `2026-11-14`, never as the displayed text.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/date-picker/_

## Anatomy

1. Trigger showing the date
2. Calendar icon
3. Calendar in a popover
4. Selected day

An `outline` [Button](https://design.sosialoka.tech/components/button/) with a calendar icon and the date, or the placeholder "Pilih tanggal" in `muted-foreground`. Clicking it opens the calendar in a [Popover](https://design.sosialoka.tech/components/popover/); picking a day closes it.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value`, `onValueChange` | `v-model` | `ShadDatePicker onChanged` | `Date` / `DateValue` / `DateTime` | none | The chosen date. |
| `placeholder` | `placeholder` | `placeholder` | text | `Pick a date` | Shown before a date is picked, such as "Pilih tanggal". |
| `disabled` | `disabled` | `enabled: false` | boolean | `false` | Turns the field off. |
| `locale` | `locale` | the app's `locale` | locale | English (en-GB) | Month names, and how the date reads. For Indonesian, `id` from `react-day-picker/locale` or `"id-ID"`. |
| `dateFormat` | | `formatDate` | text / function | the locale's short date (`14 Aug 2026`) | A date-fns pattern, when the date needs another shape. |

## Code

**React**
```tsx
import { useState } from "react"
import { id } from "react-day-picker/locale"
import { DatePicker } from "@/components/ui/date-picker"

export default function DatePickerDemo() {
  const [date, setDate] = useState<Date>()
  return <DatePicker locale={id} value={date} onValueChange={setDate} placeholder="Pilih tanggal" className="w-56" />
}
```

**Vue**
```vue
<script setup lang="ts">
import type { DateValue } from "@internationalized/date"
import { shallowRef } from "vue"
import { DatePicker } from "@/components/ui/date-picker"

const date = shallowRef<DateValue>()
</script>

<template>
  <DatePicker v-model="date" locale="id-ID" placeholder="Pilih tanggal" class="w-56" />
</template>
```

**Flutter**
```dart
// A date field that opens a calendar. Dates read "15 Nov 2026"; the app runs with locale: Locale('id').
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class DatePickerDemo extends StatelessWidget {
  const DatePickerDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadDatePicker(
      width: 256,
      placeholder: const Text('Pilih tanggal'),
      initialMonth: DateTime(2026, 11),
      weekStartsOn: 1,
      formatDate: (date) => DateFormat('d MMM yyyy', 'id').format(date),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/date-picker.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/date-picker.json
```

## Accessibility

- Opening the picker puts focus on the chosen day, or today, so the arrow keys work straight away.
- Enter picks the day and closes the popover; Escape closes it. Either way, focus goes back to the button.
- Give the field a visible label with [Field](https://design.sosialoka.tech/components/field/), such as "Tanggal rilis".


---

# Input OTP

> Enters a one-time code in six boxes.

An OTP input takes a one-time code, such as an email verification or a sign-in code, in six separate boxes.

## When to use

Use it for every one-time code in every Sosialoka product, with these rules:

- **Six separate boxes**, never one text field.
- **Digits only.** Pasting the whole code from the email fills every box.
- **Send it when it is complete.** When the sixth digit is in, submit the code without a click. Keep the submit button too, disabled until the code is complete, and guard the submit so it runs once.
- **Clear it when the backend refuses the code**, so the caret goes back to the first box; show the backend's message below it.
- **Focus the first box** when the screen or step appears.
- Put the label above the boxes as a `p` element, centered with its hint.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/input-otp/_

## Anatomy

1. Filled box
2. Focused box
3. Empty box

Six 48px boxes (`size-12`) on `radius-md` with an `input` border, 8px apart, in `text-lg`. The active box shows the `ring`; a refused code turns every border `destructive`. One real input sits behind the boxes, which is what makes typing, deleting and pasting work.

## Variants

There is one style, for six digits.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `maxLength` | `maxlength` | `maxLength` | number | none | The number of digits: `6`. |
| `pattern={REGEXP_ONLY_DIGITS}` | `:pattern="REGEXP_ONLY_DIGITS"` | `FilteringTextInputFormatter.digitsOnly` | pattern | any character | Accepts digits only. |
| `value` / `onChange` | `v-model` | `onChanged` | text | `""` | The code typed so far. |
| `onComplete` | `@complete` | check the length in `onChanged` | function | none | Runs when the last box is filled: submit here. |
| `aria-invalid` | `aria-invalid` | an error below | boolean | `false` | Marks a refused code. |

## Code

**React**
```tsx
import { useId } from "react"
import { REGEXP_ONLY_DIGITS } from "input-otp"
import { InputOTP, InputOTPGroup, InputOTPSlot } from "@/components/ui/input-otp"

export default function InputOtpDemo() {
  const id = useId()
  return (
    <div className="grid justify-items-center gap-2 text-center">
      {/* One real input sits behind the six boxes, so the label points at it through aria-labelledby. */}
      <p id={`${id}-label`} className="text-sm font-medium">Kode verifikasi</p>
      <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS} autoFocus aria-labelledby={`${id}-label`} aria-describedby={`${id}-hint`}>
        <InputOTPGroup>
          {[0, 1, 2, 3, 4, 5].map((index) => (
            <InputOTPSlot key={index} index={index} />
          ))}
        </InputOTPGroup>
      </InputOTP>
      <p id={`${id}-hint`} className="text-sm text-muted-foreground">Kami kirim kodenya ke email kamu.</p>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { REGEXP_ONLY_DIGITS } from "vue-input-otp"
import { InputOTP, InputOTPGroup, InputOTPSlot } from "@/components/ui/input-otp"

const id = useId()
</script>

<template>
  <div class="grid justify-items-center gap-2 text-center">
    <!-- One real input sits behind the six boxes, so the label points at it through aria-labelledby. -->
    <p :id="`${id}-label`" class="text-sm font-medium">Kode verifikasi</p>
    <InputOTP :maxlength="6" :pattern="REGEXP_ONLY_DIGITS" autofocus :aria-labelledby="`${id}-label`" :aria-describedby="`${id}-hint`">
      <InputOTPGroup>
        <InputOTPSlot v-for="index in 6" :key="index" :index="index - 1" />
      </InputOTPGroup>
    </InputOTP>
    <p :id="`${id}-hint`" class="text-sm text-muted-foreground">Kami kirim kodenya ke email kamu.</p>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class InputOtpDemo extends StatelessWidget {
  const InputOtpDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return Column(
      mainAxisSize: MainAxisSize.min,
      spacing: 8,
      children: [
        Text('Kode verifikasi', style: theme.textTheme.small),
        // Six separate 48px boxes: one slot per group, 8px apart.
        ShadInputOTP(
          maxLength: 6,
          gap: 8,
          keyboardType: TextInputType.number,
          inputFormatters: [FilteringTextInputFormatter.digitsOnly],
          onChanged: (code) {},
          children: [
            for (var i = 0; i < 6; i++)
              const ShadInputOTPGroup(children: [ShadInputOTPSlot(width: 48, height: 48)]),
          ],
        ),
        Text('Kami kirim kodenya ke email kamu.', style: theme.textTheme.muted),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/input-otp.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/input-otp.json
```

## Accessibility

- The real input behind the boxes is named by the label with `aria-labelledby` and tied to the hint with `aria-describedby`.
- It uses `autocomplete="one-time-code"`, so phones can offer the code from a message.
- Backspace clears the previous box; the arrow keys move between boxes.


---

# File Upload

> Drops or picks files, then lists them with their size and upload progress.

A file upload takes files by drag and drop or from the file picker, then lists each file with its size, its progress and any error, such as a master audio file.

## When to use

- Use it when a form needs a file: a master, a cover letter, a contract.
- Write the allowed types and the size limit in the hint: "WAV atau FLAC, maks. 200 MB."
- The client only narrows the picker with `accept`. The backend checks what is inside the file, and its message shows under that file.
- On phones there is nothing to drag: the area works as a button that opens the picker.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/file-upload/_

## Anatomy

1. Drop zone, also a button
2. Upload icon
3. File row
4. Upload progress

| Part | Style |
| --- | --- |
| Drop area | `rounded-lg`, a dashed `input` border, `bg-muted/30`, 24px padding, centered. On hover and while dragging, `border-primary` and `bg-primary-soft`. |
| Text | "Tarik file ke sini atau pilih file", then the hint in `text-xs muted-foreground`. |
| File row | One row per file on `card` with a `border`: name, size, a [Progress](https://design.sosialoka.tech/components/progress/) bar while it uploads, and a remove button. |
| Error | The backend's message under the file in `destructive`; the row border turns `destructive`. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `accept` | `accept` | `file_picker` `allowedExtensions` | text | any | Narrows the picker, such as `.wav,.flac`. |
| `multiple` | `multiple` | `allowMultiple` | boolean | `false` | Lets people add several files. |
| `files`, `onFilesChange` | `v-model:files` | your list | `{ file, progress?, error? }[]` | `[]` | The files, with progress (0–100) and the backend's error. |
| `onRemove` | `@remove` | your handler | function | none | Runs after a file is removed, for example to cancel its upload. |
| `hint`, `error` | `hint`, `error` | `Text` | text | none | The limits, and a backend message about the whole upload. |
| `label`, `buttonLabel` | `label`, `button-label` | `Text` | text | English | The area's text: `label` from `sm` up, `buttonLabel` on phones, such as "Pilih file". |
| `removeLabel`, `uploadingLabel` | same | `Semantics` | function | English | Names the buttons and bars, such as "Hapus master.wav". |
| `locale` | `locale` | `NumberFormat` locale | text | `en-GB` | How file sizes read, such as `"id-ID"` for `4,1 MB`. |

Flutter has no upload widget; the snippet draws the area from the theme, and products open the picker with the `file_picker` package.

## Code

**React**
```tsx
import { useEffect, useState } from "react"
import { FileUpload, type FileUploadItem } from "@/components/ui/file-upload"

/** A file the backend already turned down, so the demo shows the error state. */
const rejected = new File(["demo"], "demo-lama.mp3", { type: "audio/mpeg" })
Object.defineProperty(rejected, "size", { value: 4_300_000 })

export default function FileUploadDemo() {
  const [files, setFiles] = useState<FileUploadItem[]>([{ file: rejected, error: "Format file-nya belum pas." }])

  // Pretend to upload: new files fill their progress bar, then settle.
  useEffect(() => {
    if (!files.some((f) => f.progress !== undefined)) return
    const timer = setTimeout(
      () =>
        setFiles((list) =>
          list.map((f) => (f.progress === undefined ? f : f.progress >= 100 ? { file: f.file } : { ...f, progress: f.progress + 25 }))
        ),
      400
    )
    return () => clearTimeout(timer)
  }, [files])

  return (
    <FileUpload
      className="max-w-md"
      accept=".wav,.flac"
      multiple
      label="Tarik file ke sini atau pilih file"
      buttonLabel="Pilih file"
      locale="id-ID"
      hint="WAV atau FLAC, maks. 200 MB."
      removeLabel={(name) => `Hapus ${name}`}
      uploadingLabel={(name) => `Mengunggah ${name}`}
      files={files}
      onFilesChange={(next) => setFiles(next.map((f) => (files.includes(f) ? f : { file: f.file, progress: 0 })))}
    />
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import type { FileUploadItem } from "@/components/ui/file-upload"
import { onBeforeUnmount, ref, watch } from "vue"
import { FileUpload } from "@/components/ui/file-upload"

/** A file the backend already turned down, so the demo shows the error state. */
const rejected = new File(["demo"], "demo-lama.mp3", { type: "audio/mpeg" })
Object.defineProperty(rejected, "size", { value: 4_300_000 })

const files = ref<FileUploadItem[]>([{ file: rejected, error: "Format file-nya belum pas." }])

/** New files start uploading. */
function update(next: FileUploadItem[]) {
  files.value = next.map(f => (files.value.includes(f) ? f : { file: f.file, progress: 0 }))
}

// Pretend to upload: new files fill their progress bar, then settle.
let timer: ReturnType<typeof setTimeout> | undefined
watch(files, (list) => {
  clearTimeout(timer)
  if (!list.some(f => f.progress !== undefined)) return
  timer = setTimeout(() => {
    files.value = files.value.map(f => (f.progress === undefined ? f : f.progress >= 100 ? { file: f.file } : { ...f, progress: f.progress + 25 }))
  }, 400)
})
onBeforeUnmount(() => clearTimeout(timer))
</script>

<template>
  <FileUpload
    class="max-w-md"
    accept=".wav,.flac"
    multiple
    label="Tarik file ke sini atau pilih file"
    button-label="Pilih file"
    locale="id-ID"
    hint="WAV atau FLAC, maks. 200 MB."
    :remove-label="(name) => `Hapus ${name}`"
    :uploading-label="(name) => `Mengunggah ${name}`"
    :files="files"
    @update:files="update"
  />
</template>
```

**Flutter**
```dart
// shadcn_ui has no upload widget: a card with an input-colored border, a "Pilih file" button and the file list.
// In a product, open the system picker with the file_picker package (not installed in this example).
// Error text per file comes from the backend.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class FileUploadDemo extends StatelessWidget {
  const FileUploadDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 448),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          Container(
            padding: const EdgeInsets.all(24),
            decoration: BoxDecoration(
              border: Border.all(color: theme.colorScheme.input),
              borderRadius: BorderRadius.circular(12),
            ),
            child: Column(
              children: [
                Icon(LucideIcons.upload, color: theme.colorScheme.mutedForeground),
                const SizedBox(height: 8),
                // Phones have nothing to drag from: the area only offers the picker.
                const Text('Pilih file dari perangkatmu.'),
                const SizedBox(height: 4),
                Text('WAV atau FLAC, maks. 200 MB.', style: theme.textTheme.muted),
                const SizedBox(height: 12),
                ShadButton.outline(onPressed: () {}, child: const Text('Pilih file')),
              ],
            ),
          ),
          const SizedBox(height: 12),
          Container(
            padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
            decoration: BoxDecoration(
              border: Border.all(color: c.destructive),
              borderRadius: BorderRadius.circular(8),
            ),
            child: Row(
              children: [
                Icon(LucideIcons.fileAudio, size: 16, color: theme.colorScheme.mutedForeground),
                const SizedBox(width: 8),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      const Text('demo-lama.mp3 · 4,3 MB'),
                      Text('Format file-nya belum pas.', style: theme.textTheme.small.copyWith(color: c.destructive)),
                    ],
                  ),
                ),
                Semantics(
                  label: 'Hapus demo-lama.mp3',
                  child: ShadIconButton.ghost(icon: const Icon(LucideIcons.x, size: 16), onPressed: () {}),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/file-upload.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/file-upload.json
```

## Accessibility

- The drop area is a button: Enter and Space open the file picker.
- The hint and the backend's error about the whole upload are linked to the area with `aria-describedby`.
- Each remove button is named after its file, such as "Hapus master.wav", and a file's error is linked to it.
- Each progress bar is named, such as "Mengunggah master.wav".


---

# Badge

> Shows a status or a short label.

A badge shows the status of an item, such as a release or a document, or a short label such as "Baru".

## When to use

- Use the status variants for the state of a record: `success`, `warning`, `info`, `destructive`.
- Always put the status in words; color alone never carries a status.
- Use `default` or `outline` for labels that are not a status.
- Don't use a badge as a button.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/badge/_

### Do and don't

- **Do:** Name the status in words, with its color as a second signal.
- **Don't:** Don't show a status by color alone; not everyone can tell the colors apart.

## Anatomy

1. Status color text
2. Soft background
3. Outline variant

Short text, `text-xs` medium, on `radius-sm` (6px). Badges are never pills. Status badges use the soft fill of their status with the status color as text.

## Variants

| Variant | Looks | Use it for |
| --- | --- | --- |
| `success` | `success` text on `success-soft` | Done, approved, published. |
| `warning` | `warning` text on `warning-soft` | Pending, waiting for review. |
| `info` | `info` text on `info-soft` | Neutral information. |
| `destructive` | `destructive` text on `destructive-soft` | Rejected, failed, cancelled. |
| `default` | `primary` fill | A label in the product color, such as "Baru". |
| `secondary` | `secondary` fill | A quiet label. |
| `outline` | `border` outline | A label that should stay in the background, such as "Draf". |
| `ghost` | No fill until hover | A quiet label inside a link or a menu. |
| `link` | `primary-text`, underlined on hover | A badge that is itself a link. |

The `default` badge on Cover Clearance orange uses the same contrast exception as the primary button. Keep its label short.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `variant` | `variant` | named constructor, or `backgroundColor` + `foregroundColor` for status | see Variants | `default` | Meaning and weight. |
| `render` | `as` / `as-child` | `child` | element | `span` | Renders the badge as another element, such as a link. |

## Code

**React**
```tsx
import { Badge } from "@/components/ui/badge"

export default function BadgeDemo() {
  return (
    <div className="flex flex-wrap items-center gap-2">
      <Badge variant="success">Selesai</Badge>
      <Badge variant="warning">Menunggu</Badge>
      <Badge variant="info">Info</Badge>
      <Badge variant="destructive">Ditolak</Badge>
      <Badge>Baru</Badge>
      <Badge variant="outline">Draf</Badge>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Badge } from "@/components/ui/badge"
</script>

<template>
  <div class="flex flex-wrap items-center gap-2">
    <Badge variant="success">Selesai</Badge>
    <Badge variant="warning">Menunggu</Badge>
    <Badge variant="info">Info</Badge>
    <Badge variant="destructive">Ditolak</Badge>
    <Badge>Baru</Badge>
    <Badge variant="outline">Draf</Badge>
  </div>
</template>
```

**Flutter**
```dart
// Status colors come from the Sosialoka theme: context.sosialoka.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class BadgeDemo extends StatelessWidget {
  const BadgeDemo({super.key});

  ShadBadge status(Color text, Color soft, String label) =>
      ShadBadge(backgroundColor: soft, foregroundColor: text, child: Text(label));

  @override
  Widget build(BuildContext context) {
    final c = context.sosialoka;
    return Wrap(
      spacing: 8,
      runSpacing: 8,
      children: [
        status(c.success, c.successSoft, 'Selesai'),
        status(c.warning, c.warningSoft, 'Menunggu'),
        status(c.info, c.infoSoft, 'Info'),
        status(c.destructive, c.destructiveSoft, 'Ditolak'),
        const ShadBadge(child: Text('Baru')),
        const ShadBadge.outline(child: Text('Draf')),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/badge.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/badge.json
```

## Accessibility

- Badge text is read as normal text; keep it meaningful on its own.
- Status colors pass 4.5:1 on their soft fill in every theme.


---

# Alert

> Shows a message that stays on the page, in a status color.

An alert shows a message that stays on the page until its cause is gone, such as a rejected release or a subscription about to end.

## When to use

- Use it for a state of the page or the account that people need to see while they work.
- Use a [Toast](https://design.sosialoka.tech/components/toast/) to confirm an action that just happened; a toast goes away by itself.
- Show validation errors under their field with a [Field](https://design.sosialoka.tech/components/field/), not in an alert. A form may add one `destructive` alert at the top when the backend refuses the whole form.
- Write a short title and one sentence that says what to do.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/alert/_

## Anatomy

1. Container in a soft status color
2. Icon
3. Title
4. Description

An icon on the left, a title and a description, on `radius-lg` with `px-4 py-3`. The status variants sit on the soft status surface with the icon and title in the status color and the description in `foreground`; `default` sits on `card` with a `border`.

## Variants

| Variant | Use it for |
| --- | --- |
| `default` | Neutral news, such as a report that is ready. |
| `info` | Something to know, such as a scheduled release. |
| `success` | A state that turned out well, such as a delivered release. |
| `warning` | Something that needs attention soon, such as a subscription about to end. |
| `destructive` | Something that failed or was refused, such as a rejected release. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `variant` | `variant` | `ShadAlert` / `ShadAlert.destructive`, status colors from `context.sosialoka` | text | `default` | The status. |
| `AlertTitle` | `AlertTitle` | `title` | text | none | The short title. |
| `AlertDescription` | `AlertDescription` | `description` | text | none | One sentence on what to do. |
| icon as the first child | icon as the first child | `icon` | element | none | A Lucide icon for the status. |

## Code

**React**
```tsx
import { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, type LucideIcon } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

const alerts: { variant: "default" | "info" | "success" | "warning" | "destructive"; icon: LucideIcon; title: string; description: string }[] = [
  { variant: "default", icon: InfoIcon, title: "Laporan bulan ini sudah siap", description: "Kamu bisa mengunduhnya dari menu Royalti." },
  { variant: "info", icon: InfoIcon, title: "Rilis dijadwalkan", description: "\"Senja di Kota\" tayang 1 Des 2026 pukul 00.00 WIB." },
  { variant: "success", icon: CircleCheckIcon, title: "Rilis terkirim", description: "Semua toko musik sudah menerima \"Kaset Pertama\"." },
  { variant: "warning", icon: TriangleAlertIcon, title: "Langgananmu hampir habis", description: "Masa langgananmu habis 3 hari lagi." },
  { variant: "destructive", icon: CircleAlertIcon, title: "Rilis ditolak", description: "Sampulnya belum sesuai aturan toko musik." },
]

export default function AlertDemo() {
  return (
    <div className="grid w-full max-w-md gap-3">
      {alerts.map(({ variant, icon: Icon, title, description }) => (
        <Alert key={variant} variant={variant}>
          <Icon />
          <AlertTitle>{title}</AlertTitle>
          <AlertDescription>{description}</AlertDescription>
        </Alert>
      ))}
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from "@lucide/vue"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

const alerts = [
  { variant: "default", icon: InfoIcon, title: "Laporan bulan ini sudah siap", description: "Kamu bisa mengunduhnya dari menu Royalti." },
  { variant: "info", icon: InfoIcon, title: "Rilis dijadwalkan", description: "\"Senja di Kota\" tayang 1 Des 2026 pukul 00.00 WIB." },
  { variant: "success", icon: CircleCheckIcon, title: "Rilis terkirim", description: "Semua toko musik sudah menerima \"Kaset Pertama\"." },
  { variant: "warning", icon: TriangleAlertIcon, title: "Langgananmu hampir habis", description: "Masa langgananmu habis 3 hari lagi." },
  { variant: "destructive", icon: CircleAlertIcon, title: "Rilis ditolak", description: "Sampulnya belum sesuai aturan toko musik." },
] as const
</script>

<template>
  <div class="grid w-full max-w-md gap-3">
    <Alert v-for="a in alerts" :key="a.variant" :variant="a.variant">
      <component :is="a.icon" />
      <AlertTitle>{{ a.title }}</AlertTitle>
      <AlertDescription>{{ a.description }}</AlertDescription>
    </Alert>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class AlertDemo extends StatelessWidget {
  const AlertDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final c = context.sosialoka;
    final theme = ShadTheme.of(context);
    // Status alerts: the soft status surface, the icon and title in the status color.
    ShadAlert status(Color color, Color soft, IconData icon, String title, String description) => ShadAlert(
          icon: Icon(icon),
          iconColor: color,
          title: Text(title),
          titleStyle: theme.textTheme.p.copyWith(color: color, fontWeight: FontWeight.w500),
          description: Text(description),
          decoration: ShadDecoration(color: soft, border: ShadBorder.none),
        );
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 448),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        spacing: 12,
        children: [
          const ShadAlert(
            icon: Icon(LucideIcons.info),
            title: Text('Laporan bulan ini sudah siap'),
            description: Text('Kamu bisa mengunduhnya dari menu Royalti.'),
          ),
          status(c.info, c.infoSoft, LucideIcons.info, 'Rilis dijadwalkan', '"Senja di Kota" tayang 1 Des 2026 pukul 00.00 WIB.'),
          status(c.success, c.successSoft, LucideIcons.circleCheck, 'Rilis terkirim', 'Semua toko musik sudah menerima "Kaset Pertama".'),
          status(c.warning, c.warningSoft, LucideIcons.triangleAlert, 'Langgananmu hampir habis', 'Masa langgananmu habis 3 hari lagi.'),
          status(c.destructive, c.destructiveSoft, LucideIcons.circleAlert, 'Rilis ditolak', 'Sampulnya belum sesuai aturan toko musik.'),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/alert.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/alert.json
```

## Accessibility

- It has `role="alert"`, so screen readers announce it when it appears. Render alerts that are there from the start with the page, so they are not announced again on every change.
- The status is in the title too, not only in the color.
- The icon is decorative.


---

# Card

> Groups related content on its own surface.

A card groups related content, such as one release or one document, on its own surface.

## When to use

- Use it for a self-contained item with a title and, often, actions.
- Use plain sections, not cards, to split one long form or page.
- Don't nest cards inside cards.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/card/_

### Do and don't

- **Do:** Separate cards from the page with a border.
- **Don't:** Don't lift every card with a shadow; save shadows for what floats over the page.

## Anatomy

1. Header: title and description
2. Content
3. Footer with actions

Header (title, description, optional action), content, then footer with actions. The card sits on `card` with a `border` and `radius-lg` (12px). It has no shadow by default: a border separates it from the page. Add `shadow-md` only for a card that floats, such as the header card of the dashboard.

## Variants

There is one style. Pass `shadow-md` for a floating card.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `CardHeader`, `CardTitle`, `CardDescription` | same names | `title`, `description` | element | none | The heading area. |
| `CardContent` | `CardContent` | `child` | element | none | The body. |
| `CardFooter` | `CardFooter` | `footer` | element | none | Actions. |
| `className` | `class` | `width`, `padding` | string | none | Size and floating shadow. |

## Code

**React**
```tsx
import { Button } from "@/components/ui/button"
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"

export default function CardDemo() {
  return (
    <Card className="w-full max-w-sm">
      <CardHeader>
        <CardTitle>Rilis baru</CardTitle>
        <CardDescription>Single "Senja di Kota" siap dikirim ke semua platform.</CardDescription>
      </CardHeader>
      <CardContent>
        <p className="text-sm text-muted-foreground">Periksa metadata dan artwork sebelum kamu kirim.</p>
      </CardContent>
      <CardFooter className="gap-2">
        <Button>Kirim</Button>
        <Button variant="outline">Periksa dulu</Button>
      </CardFooter>
    </Card>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Button } from "@/components/ui/button"
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
</script>

<template>
  <Card class="w-full max-w-sm">
    <CardHeader>
      <CardTitle>Rilis baru</CardTitle>
      <CardDescription>Single "Senja di Kota" siap dikirim ke semua platform.</CardDescription>
    </CardHeader>
    <CardContent>
      <p class="text-sm text-muted-foreground">Periksa metadata dan artwork sebelum kamu kirim.</p>
    </CardContent>
    <CardFooter class="gap-2">
      <Button>Kirim</Button>
      <Button variant="outline">Periksa dulu</Button>
    </CardFooter>
  </Card>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class CardDemo extends StatelessWidget {
  const CardDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ShadCard(
      width: 384,
      title: Text('Rilis baru', style: theme.textTheme.h4),
      description: const Text('Single "Senja di Kota" siap dikirim ke semua platform.'),
      footer: Row(
        children: [
          ShadButton(onPressed: () {}, child: const Text('Kirim')),
          const SizedBox(width: 8),
          ShadButton.outline(onPressed: () {}, child: const Text('Periksa dulu')),
        ],
      ),
      child: const Padding(
        padding: EdgeInsets.symmetric(vertical: 16),
        child: Text('Periksa metadata dan artwork sebelum kamu kirim.'),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/card.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/card.json
```

## Accessibility

- A card is a plain container; give its title a real heading level in your page when it starts a section.
- Keep one main action per card, so the footer reads clearly.


---

# Carousel

> Slides through a row of cards, such as the latest releases.

A carousel shows a row of cards that people slide through, such as the latest releases or highlights on a home screen.

## When to use

- Use it for content that people may skip, such as releases or highlights.
- Never put required information in it: what sits off screen may never be seen.
- Never autoplay.
- Show the edge of the next card, so people can tell there is more.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/carousel/_

## Anatomy

1. Current slide
2. Next slide, partly shown
3. Position dots

Cards in a row, 16px apart, with square `outline` previous and next buttons (not pills) that turn off at the ends. On phones the buttons hide and people swipe; the page never scrolls sideways.

On phones, `CarouselDots` under the row may show where people are, since they swipe and see no buttons:

- One dot per stop: 6px, `radius-full`, 4px apart, centered 12px under the cards.
- The current slide's dot is 20px wide in `primary`; the others are `input`.
- Use dots for up to 5 slides. With more, leave them out.
- Dots only show the position. They are not buttons, and screen readers skip them.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `opts` | `:opts` | `PageController(viewportFraction: 0.85)` | Embla options | none | Such as `{ align: "start" }`. |
| `CarouselItem aria-label` | same | `Semantics label` | text | none | The slide's position, such as "1 dari 5". |
| `CarouselPrevious label`, `CarouselNext label` | same | `Semantics label` | text | `Previous slide`, `Next slide` | The buttons' names, such as "Sebelumnya". |
| `CarouselDots max` | `CarouselDots :max` | dots row (see the Flutter code) | number | `5` | Position dots for phones; with more stops than this they don't show. |
| `setApi` | `@init-api` | the controller | function | none | Reads or moves the carousel from outside. |

## Code

**React**
```tsx
import { MusicIcon } from "lucide-react"
import { Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika" },
  { title: "Kaset Pertama", artist: "Bima Laras" },
  { title: "Pulang Sore", artist: "Nada Kirana" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening" },
  { title: "Lampu Kota", artist: "Sinta Maharani" },
]

export default function CarouselDemo() {
  return (
    <Carousel aria-label="Rilis terbaru" opts={{ align: "start" }} className="w-full max-w-md sm:mx-12">
      <CarouselContent>
        {releases.map((r, i) => (
          <CarouselItem key={r.title} aria-label={`${i + 1} dari ${releases.length}`} className="basis-2/3 sm:basis-1/2">
            <div className="flex flex-col gap-2">
              <div className="flex aspect-square items-center justify-center rounded-lg bg-muted">
                <MusicIcon aria-hidden="true" className="size-6 text-muted-foreground" />
              </div>
              <div className="text-sm">
                <p className="truncate font-medium">{r.title}</p>
                <p className="truncate text-muted-foreground">{r.artist}</p>
              </div>
            </div>
          </CarouselItem>
        ))}
      </CarouselContent>
      <CarouselPrevious label="Sebelumnya" />
      <CarouselNext label="Berikutnya" />
      <CarouselDots />
    </Carousel>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Music } from "@lucide/vue"
import { Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika" },
  { title: "Kaset Pertama", artist: "Bima Laras" },
  { title: "Pulang Sore", artist: "Nada Kirana" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening" },
  { title: "Lampu Kota", artist: "Sinta Maharani" },
]
</script>

<template>
  <Carousel aria-label="Rilis terbaru" :opts="{ align: 'start' }" class="w-full max-w-md sm:mx-12">
    <CarouselContent>
      <CarouselItem v-for="(r, i) in releases" :key="r.title" :aria-label="`${i + 1} dari ${releases.length}`" class="basis-2/3 sm:basis-1/2">
        <div class="flex flex-col gap-2">
          <div class="flex aspect-square items-center justify-center rounded-lg bg-muted">
            <Music aria-hidden="true" class="size-6 text-muted-foreground" />
          </div>
          <div class="text-sm">
            <p class="truncate font-medium">
              {{ r.title }}
            </p>
            <p class="truncate text-muted-foreground">
              {{ r.artist }}
            </p>
          </div>
        </div>
      </CarouselItem>
    </CarouselContent>
    <CarouselPrevious label="Sebelumnya" />
    <CarouselNext label="Berikutnya" />
    <CarouselDots />
  </Carousel>
</template>
```

**Flutter**
```dart
// A PageView that shows a peek of the next card. Wide screens get previous and next buttons with a "2 dari 5"
// count; phones, where people swipe, get position dots instead (hidden from screen readers, as each slide says
// its own position).
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const _releases = [
  (title: 'Senja di Kota', artist: 'Rara Senandika'),
  (title: 'Kaset Pertama', artist: 'Bima Laras'),
  (title: 'Pulang Sore', artist: 'Nada Kirana'),
  (title: 'Hujan Bulan Juni', artist: 'Arka Wening'),
  (title: 'Lampu Kota', artist: 'Sinta Maharani'),
];

class CarouselDemo extends StatefulWidget {
  const CarouselDemo({super.key});

  @override
  State<CarouselDemo> createState() => _CarouselDemoState();
}

class _CarouselDemoState extends State<CarouselDemo> {
  final controller = PageController(viewportFraction: 0.85);
  int page = 0;

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  void go(int to) =>
      controller.animateToPage(to, duration: const Duration(milliseconds: 300), curve: Curves.easeOutCubic);

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final phone = MediaQuery.sizeOf(context).width < 640;
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 448),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SizedBox(
            height: 240,
            child: PageView.builder(
              controller: controller,
              itemCount: _releases.length,
              onPageChanged: (value) => setState(() => page = value),
              itemBuilder: (context, i) => Semantics(
                container: true,
                label: '${i + 1} dari ${_releases.length}',
                child: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 6),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Expanded(
                        child: Container(
                          decoration: BoxDecoration(
                            color: theme.colorScheme.muted,
                            borderRadius: BorderRadius.circular(8),
                          ),
                          alignment: Alignment.center,
                          child: Icon(LucideIcons.music, color: theme.colorScheme.mutedForeground),
                        ),
                      ),
                      const SizedBox(height: 8),
                      Text(_releases[i].title, style: const TextStyle(fontWeight: FontWeight.w500)),
                      Text(_releases[i].artist, style: theme.textTheme.muted),
                    ],
                  ),
                ),
              ),
            ),
          ),
          const SizedBox(height: 12),
          if (phone)
            ExcludeSemantics(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                spacing: 4,
                children: [
                  for (var i = 0; i < _releases.length; i++)
                    AnimatedContainer(
                      key: ValueKey('dot-$i'),
                      duration: const Duration(milliseconds: 200),
                      width: i == page ? 20 : 6,
                      height: 6,
                      decoration: BoxDecoration(
                        color: i == page ? theme.colorScheme.primary : theme.colorScheme.input,
                        borderRadius: BorderRadius.circular(3),
                      ),
                    ),
                ],
              ),
            )
          else
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Semantics(
                label: 'Sebelumnya',
                button: true,
                // excludeSemantics hides the button's own state, so say here whether it is on.
                enabled: page > 0,
                excludeSemantics: true,
                child: ShadIconButton.outline(
                  icon: const Icon(LucideIcons.chevronLeft, size: 16),
                  onPressed: page == 0 ? null : () => go(page - 1),
                ),
              ),
              const SizedBox(width: 12),
              Text('${page + 1} dari ${_releases.length}', style: theme.textTheme.muted),
              const SizedBox(width: 12),
              Semantics(
                label: 'Berikutnya',
                button: true,
                enabled: page < _releases.length - 1,
                excludeSemantics: true,
                child: ShadIconButton.outline(
                  icon: const Icon(LucideIcons.chevronRight, size: 16),
                  onPressed: page == _releases.length - 1 ? null : () => go(page + 1),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/carousel.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/carousel.json
```

## Accessibility

- The carousel is a region with `aria-roledescription="carousel"`; give it a name, such as "Rilis terbaru".
- Each slide is a group with `aria-roledescription="slide"` and a label such as "1 dari 5".
- The previous and next buttons are named and turn off at the ends.
- Dots are `aria-hidden`; the slide labels, such as "1 dari 3", carry the position.
- Left and right arrow keys move between slides while focus is inside.


---

# Item

> A list row with media, a title, a description and actions.

An item is a row in a list: a picture or icon, a title, one line of description and an action, such as an artist in a list or a setting in a menu.

## When to use

- Use it for lists on phones and in panels: artists, releases, account menus, settings.
- Use a [Table](https://design.sosialoka.tech/components/table/) for records with many columns that people compare.
- Make the whole row a link when it opens a page; keep a separate button when the row has its own action.
- Item is the row of the [Mobile app](https://design.sosialoka.tech/patterns/mobile-app/) pattern.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/item/_

## Anatomy

1. Leading avatar or icon
2. Title and meta
3. Trailing chevron
4. Divider

A row on `radius-lg` with `p-3` and a 12px gap: media on the left (an Avatar or a 40px icon), the title (`text-sm font-medium`) and description (`text-sm text-muted-foreground`), then actions on the right. As a link, it turns `accent` on hover.

## Variants

| Variant | Use it for |
| --- | --- |
| `default` | Rows in a menu or a list with separators. |
| `outline` | Rows that stand on their own, such as cards in a list. |
| `muted` | A row that needs a quiet surface, such as a summary. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `variant` | `variant` | `ShadItem` / `.outline` / `.muted` | text | `default` | The look. |
| `size` | `size` | `size` | `default`, `sm`, `xs` (React only) | `default` | The padding. |
| `render={<a href />}` | `as-child` with a link | `onPressed` | element | `div` | Makes the whole row a link. |
| `ItemMedia`, `ItemTitle`, `ItemDescription`, `ItemActions` | same | `media`, `title`, `description`, `actions` | element | none | The parts of the row. |

## Code

**React**
```tsx
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from "@/components/ui/item"

const artists = [
  { name: "Rara Senandika", initials: "RS", detail: "3 rilis · Pop" },
  { name: "Bima Laras", initials: "BL", detail: "5 rilis · Folk" },
  { name: "Nada Kirana", initials: "NK", detail: "2 rilis · R&B" },
]

export default function ItemDemo() {
  return (
    <ItemGroup className="w-full max-w-md gap-2">
      {artists.map((artist) => (
        <Item key={artist.name} variant="outline">
          <ItemMedia>
            <Avatar>
              <AvatarFallback>{artist.initials}</AvatarFallback>
            </Avatar>
          </ItemMedia>
          <ItemContent>
            <ItemTitle>{artist.name}</ItemTitle>
            <ItemDescription>{artist.detail}</ItemDescription>
          </ItemContent>
          <ItemActions>
            <Button variant="outline" size="sm" aria-label={`Lihat ${artist.name}`}>
              Lihat
            </Button>
          </ItemActions>
        </Item>
      ))}
    </ItemGroup>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from "@/components/ui/item"

const artists = [
  { name: "Rara Senandika", initials: "RS", detail: "3 rilis · Pop" },
  { name: "Bima Laras", initials: "BL", detail: "5 rilis · Folk" },
  { name: "Nada Kirana", initials: "NK", detail: "2 rilis · R&B" },
]
</script>

<template>
  <ItemGroup class="w-full max-w-md gap-2">
    <Item v-for="artist in artists" :key="artist.name" variant="outline">
      <ItemMedia>
        <Avatar>
          <AvatarFallback>{{ artist.initials }}</AvatarFallback>
        </Avatar>
      </ItemMedia>
      <ItemContent>
        <ItemTitle>{{ artist.name }}</ItemTitle>
        <ItemDescription>{{ artist.detail }}</ItemDescription>
      </ItemContent>
      <ItemActions>
        <Button variant="outline" size="sm" :aria-label="`Lihat ${artist.name}`">Lihat</Button>
      </ItemActions>
    </Item>
  </ItemGroup>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const itemArtists = [('Rara Senandika', 'RS', '3 rilis · Pop'), ('Bima Laras', 'BL', '5 rilis · Folk'), ('Nada Kirana', 'NK', '2 rilis · R&B')];

class ItemDemo extends StatelessWidget {
  const ItemDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 448),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        spacing: 8,
        children: [
          for (final (name, initials, detail) in itemArtists)
            ShadItem.outline(
              media: ShadAvatar(null, placeholder: Text(initials)),
              title: Text(name),
              description: Text(detail),
              actions: Semantics(
                label: 'Lihat $name',
                button: true,
                child: ExcludeSemantics(child: ShadButton.outline(size: ShadButtonSize.sm, onPressed: () {}, child: const Text('Lihat'))),
              ),
            ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/item.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/item.json
```

## Accessibility

- Name each action with what it acts on: "Lihat Rara Senandika", not only "Lihat".
- When the whole row is a link, don't nest another button inside it.
- Put items in a list (`ItemGroup`) so screen readers announce how many there are.


---

# Accordion

> Shows and hides sections of content one at a time.

An accordion stacks sections under their titles and opens them one at a time, so a long page stays short.

## When to use

- Use it for questions and answers, settings groups, and details that only some people need.
- Use [Tabs](https://design.sosialoka.tech/components/tabs/) to switch between views of the same thing, and a page when every section matters.
- Don't hide required information in a closed section: people may never open it.
- On phones, an accordion also turns table rows into sections; see the [Responsive table](https://design.sosialoka.tech/patterns/responsive-table/) pattern.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/accordion/_

## Anatomy

1. Open section header
2. Content
3. Closed section
4. Chevron

Items separated by a `border-b` on `border`. Each item has a trigger (`py-4 text-sm font-medium`, with a chevron that turns 180° when open) and its content (`pb-4 text-sm`).

## Variants

| Mode | Use it for |
| --- | --- |
| One open at a time (default) | Questions and answers, where one answer is enough to read. |
| Several open (`multiple`) | Settings groups that people compare. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `multiple` | `type="single"` / `"multiple"` | `ShadAccordion` / `ShadAccordion.multiple` | mode | one open | How many sections can be open. |
| always closable | `collapsible` | always closable | boolean | `false` in Vue | Lets the open section close again. |
| `value` / `defaultValue` | `v-model` / `default-value` | `initialValue` | value | none | The open section. |
| `AccordionItem value` | `AccordionItem value` | `ShadAccordionItem value` | value | none | Names a section. |

## Code

**React**
```tsx
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"

const questions = [
  { q: "Berapa lama clearance selesai?", a: "Biasanya 5–7 hari kerja setelah dokumenmu lengkap. Kamu dapat kabar di setiap langkah." },
  { q: "Lagu apa saja yang bisa kamu cover?", a: "Lagu yang ada di katalog kami. Cari judulnya di menu Katalog." },
  { q: "Kapan royalti dibayar?", a: "Setiap bulan, paling lambat tanggal 25, ke rekening yang terdaftar di akunmu." },
]

export default function AccordionDemo() {
  return (
    <Accordion className="w-full max-w-md">
      {questions.map(({ q, a }) => (
        <AccordionItem key={q} value={q}>
          <AccordionTrigger>{q}</AccordionTrigger>
          <AccordionContent>{a}</AccordionContent>
        </AccordionItem>
      ))}
    </Accordion>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"

const questions = [
  { q: "Berapa lama clearance selesai?", a: "Biasanya 5–7 hari kerja setelah dokumenmu lengkap. Kamu dapat kabar di setiap langkah." },
  { q: "Lagu apa saja yang bisa kamu cover?", a: "Lagu yang ada di katalog kami. Cari judulnya di menu Katalog." },
  { q: "Kapan royalti dibayar?", a: "Setiap bulan, paling lambat tanggal 25, ke rekening yang terdaftar di akunmu." },
]
</script>

<template>
  <Accordion type="single" collapsible class="w-full max-w-md">
    <AccordionItem v-for="item in questions" :key="item.q" :value="item.q">
      <AccordionTrigger>{{ item.q }}</AccordionTrigger>
      <AccordionContent>{{ item.a }}</AccordionContent>
    </AccordionItem>
  </Accordion>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const questions = [
  ('Berapa lama clearance selesai?', 'Biasanya 5–7 hari kerja setelah dokumenmu lengkap. Kamu dapat kabar di setiap langkah.'),
  ('Lagu apa saja yang bisa kamu cover?', 'Lagu yang ada di katalog kami. Cari judulnya di menu Katalog.'),
  ('Kapan royalti dibayar?', 'Setiap bulan, paling lambat tanggal 25, ke rekening yang terdaftar di akunmu.'),
];

class AccordionDemo extends StatelessWidget {
  const AccordionDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 448),
      child: ShadAccordion<int>(
        children: [
          for (var i = 0; i < questions.length; i++)
            ShadAccordionItem(value: i, title: Text(questions[i].$1), child: Text(questions[i].$2)),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/accordion.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/accordion.json
```

## Accessibility

- Each trigger is a button with `aria-expanded` and `aria-controls` pointing at its content.
- Enter and Space open and close a section; Tab moves between triggers.
- Keep the trigger text a full question or title, so it makes sense on its own.


---

# Separator

> A thin line between groups.

A separator draws a thin line between groups of content, such as the sections of a card or a menu.

## When to use

- Use it between groups that belong together but read separately, such as the profile and the stats of an artist card.
- Prefer spacing first; add a line only when spacing alone doesn't show the groups.
- Use `vertical` between items in a row, such as toolbar buttons.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/separator/_

## Anatomy

1. Horizontal separator
2. Vertical separator

A 1px line on `border`, horizontal by default.

## Variants

| Orientation | Use it for |
| --- | --- |
| `horizontal` (default) | Between stacked groups. |
| `vertical` | Between items in a row. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `orientation` | `orientation` | `ShadSeparator.horizontal` / `.vertical` | text | `horizontal` | The direction of the line. |
| always `role="separator"` | `decorative` | not announced | boolean | `true` in Vue | Whether screen readers hear it. |

## Code

**React**
```tsx
import { Separator } from "@/components/ui/separator"

export default function SeparatorDemo() {
  return (
    <div className="w-full max-w-xs rounded-lg border border-border bg-card p-4 text-sm">
      <p className="font-medium">Rara Senandika</p>
      <p className="text-muted-foreground">Penyanyi pop, Bandung</p>
      <Separator className="my-3" />
      <p className="text-muted-foreground">3 rilis · 12.480 pendengar bulanan</p>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Separator } from "@/components/ui/separator"
</script>

<template>
  <div class="w-full max-w-xs rounded-lg border border-border bg-card p-4 text-sm">
    <p class="font-medium">Rara Senandika</p>
    <p class="text-muted-foreground">Penyanyi pop, Bandung</p>
    <Separator :decorative="false" class="my-3" />
    <p class="text-muted-foreground">3 rilis · 12.480 pendengar bulanan</p>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class SeparatorDemo extends StatelessWidget {
  const SeparatorDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return SizedBox(
      width: 320,
      child: ShadCard(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text('Rara Senandika', style: theme.textTheme.small),
            Text('Penyanyi pop, Bandung', style: theme.textTheme.muted),
            const ShadSeparator.horizontal(margin: EdgeInsets.symmetric(vertical: 12)),
            Text('3 rilis · 12.480 pendengar bulanan', style: theme.textTheme.muted),
          ],
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/separator.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/separator.json
```

## Accessibility

- A separator between real sections has `role="separator"`; a line that is only decoration is hidden from screen readers (`decorative` in Vue).
- It never takes the focus.


---

# Tabs

> Switches between views of the same content.

Tabs switch between views of the same content, such as the summary, releases and royalties of one artist.

## When to use

- Use tabs for 2 to 6 views that sit at the same level.
- Keep the content of every tab related; use separate pages for unrelated content.
- Don't use tabs as steps of a process; use a stepper.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/tabs/_

## Anatomy

1. Active tab
2. Indicator on primary
3. Tab
4. Panel

A row of labels over a `border` line, and the content of the active tab below it. The active tab has `foreground` text and a 2px `primary` line under it; the others use `muted-foreground`. Tabs are 36px tall and never sit on a pill.

## Variants

There is one style, horizontal or vertical (`orientation="vertical"`). In vertical tabs the line moves to the right edge.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `defaultValue` / `value` | `default-value` / `v-model` | `value` | string | none | The active tab. |
| `onValueChange` | `@update:model-value` | `onChanged` | function | none | Runs when the tab changes. |
| `orientation` | `orientation` | none | `horizontal` \| `vertical` | `horizontal` | Direction of the tab list. |

## Code

**React**
```tsx
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export default function TabsDemo() {
  return (
    <Tabs defaultValue="ringkasan" className="w-full max-w-md">
      <TabsList>
        <TabsTrigger value="ringkasan">Ringkasan</TabsTrigger>
        <TabsTrigger value="rilis">Rilis</TabsTrigger>
        <TabsTrigger value="royalti">Royalti</TabsTrigger>
      </TabsList>
      <TabsContent value="ringkasan" className="pt-3 text-muted-foreground">12 rilis aktif bulan ini.</TabsContent>
      <TabsContent value="rilis" className="pt-3 text-muted-foreground">3 rilis menunggu dikirim.</TabsContent>
      <TabsContent value="royalti" className="pt-3 text-muted-foreground">Laporan Oktober sudah masuk.</TabsContent>
    </Tabs>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
</script>

<template>
  <Tabs default-value="ringkasan" class="w-full max-w-md">
    <TabsList>
      <TabsTrigger value="ringkasan">Ringkasan</TabsTrigger>
      <TabsTrigger value="rilis">Rilis</TabsTrigger>
      <TabsTrigger value="royalti">Royalti</TabsTrigger>
    </TabsList>
    <TabsContent value="ringkasan" class="pt-3 text-muted-foreground">12 rilis aktif bulan ini.</TabsContent>
    <TabsContent value="rilis" class="pt-3 text-muted-foreground">3 rilis menunggu dikirim.</TabsContent>
    <TabsContent value="royalti" class="pt-3 text-muted-foreground">Laporan Oktober sudah masuk.</TabsContent>
  </Tabs>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class TabsDemo extends StatelessWidget {
  const TabsDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadTabs<String>(
      value: 'ringkasan',
      // Tabs share the bar width equally; leave room for the longest label.
      tabBarConstraints: const BoxConstraints(maxWidth: 520),
      tabs: const [
        ShadTab(value: 'ringkasan', content: Text('12 rilis aktif bulan ini.'), child: Text('Ringkasan')),
        ShadTab(value: 'rilis', content: Text('3 rilis menunggu dikirim.'), child: Text('Rilis')),
        ShadTab(value: 'royalti', content: Text('Laporan Oktober sudah masuk.'), child: Text('Royalti')),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/tabs.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/tabs.json
```

## Accessibility

- Renders `role="tablist"`, `tab` and `tabpanel`, with `aria-selected` on the active tab.
- Arrow keys move between tabs; Tab moves into the panel.


---

# Breadcrumb

> Shows where a page sits and links back to its parents.

A breadcrumb shows the path from a section to the current page, and links each step back.

## When to use

- Use it on pages two or more levels deep, such as the metadata of one release.
- Put it above the page title. The [Detail](https://design.sosialoka.tech/patterns/detail/) pattern shows it in place.
- Don't use it on top-level pages; the sidebar already says where you are.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/breadcrumb/_

## Anatomy

1. Link to a parent page
2. Separator
3. Current page

Links in `text-sm text-muted-foreground`, separated by a 14px chevron. The current page is the last item, in `text-foreground font-medium`, and is not a link. Below `sm`, collapse the middle levels into an ellipsis.

## Variants

There is one style.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `BreadcrumbLink href` | `BreadcrumbLink href` | `ShadBreadcrumbLink onPressed` | link | none | A parent page. |
| `BreadcrumbPage` | `BreadcrumbPage` | `Text` | text | none | The current page, not a link. |
| `BreadcrumbSeparator` | `BreadcrumbSeparator` | `separator` | element | chevron | The mark between steps. |
| `BreadcrumbEllipsis` | `BreadcrumbEllipsis` | `ShadBreadcrumbEllipsis` | element | none | Stands for hidden middle levels. |

## Code

**React**
```tsx
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"

export default function BreadcrumbDemo() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Rilis</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbSeparator />
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Senja di Kota</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbSeparator />
        <BreadcrumbItem>
          <BreadcrumbPage>Ubah metadata</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
</script>

<template>
  <Breadcrumb>
    <BreadcrumbList>
      <BreadcrumbItem>
        <BreadcrumbLink href="#">Rilis</BreadcrumbLink>
      </BreadcrumbItem>
      <BreadcrumbSeparator />
      <BreadcrumbItem>
        <BreadcrumbLink href="#">Senja di Kota</BreadcrumbLink>
      </BreadcrumbItem>
      <BreadcrumbSeparator />
      <BreadcrumbItem>
        <BreadcrumbPage>Ubah metadata</BreadcrumbPage>
      </BreadcrumbItem>
    </BreadcrumbList>
  </Breadcrumb>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class BreadcrumbDemo extends StatelessWidget {
  const BreadcrumbDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadBreadcrumb(
      children: [
        ShadBreadcrumbLink(onPressed: () {}, child: const Text('Rilis')),
        ShadBreadcrumbLink(onPressed: () {}, child: const Text('Senja di Kota')),
        // The current page is plain text, not a link.
        Semantics(selected: true, child: const Text('Ubah metadata')),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/breadcrumb.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/breadcrumb.json
```

## Accessibility

- The breadcrumb is a `nav` named "breadcrumb", with the steps in an ordered list.
- The current page has `aria-current="page"`.
- Separators are hidden from screen readers.


---

# Stepper

> Shows the steps of a flow and the step you are on.

A stepper shows the steps of a flow, which ones are done, and the one people are on, such as applying for a clearance.

## When to use

- Use it for flows of 3 to 6 steps that people go through in order.
- Name each step with a short noun: "Data rilis", "Dokumen".
- Save a draft at every step, so people can stop and come back: "Simpan dulu, lanjutkan kapan saja."
- Use one page with sections instead when the form is short.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/stepper/_

## Anatomy

1. Done step
2. Current step
3. Upcoming step
4. Connector

An ordered list of steps. Each step is a 32px circle and its name below it, joined to the next step by a 1px line.

| State | Circle | Line to the next step |
| --- | --- | --- |
| Completed | `primary-soft` with a check, in `primary-text` | `primary` |
| Current | `primary` with the number, in `primary-foreground` | `border` |
| Next | `muted` with the number, in `muted-foreground` | `border` |

Below `sm` only the current step's name shows, with a line such as "Langkah 2 dari 4" under the stepper; screen readers still hear every name.

## Variants

There is one style, horizontal.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value` | `v-model` | built from `Row` (no stepper in `shadcn_ui`) | number | none (React), `1` (Vue) | The current step, from 1. |
| `completedText` | `completed-text` | `Semantics label` | text | `completed` | Read after each completed step, such as "selesai". |
| `StepperItem step` | `StepperItem :step` | the index | number | none | The step's number. |
| `StepperTitle`, `StepperDescription` | same | `Text` | text | none | The step's name and an optional line. |

## Code

**React**
```tsx
import { useState } from "react"
import { Button } from "@/components/ui/button"
import { Stepper, StepperIndicator, StepperItem, StepperSeparator, StepperTitle } from "@/components/ui/stepper"

const steps = ["Pilih lagu", "Data rilis", "Dokumen", "Kirim"]

export default function StepperDemo() {
  const [step, setStep] = useState(2)
  return (
    <div className="grid w-full max-w-xl gap-6">
      <Stepper value={step} completedText="selesai" aria-label="Ajukan clearance">
        {steps.map((title, index) => (
          <StepperItem key={title} step={index + 1}>
            <StepperIndicator />
            <StepperTitle>{title}</StepperTitle>
            {index < steps.length - 1 && <StepperSeparator />}
          </StepperItem>
        ))}
      </Stepper>
      <p className="text-center text-sm text-muted-foreground sm:hidden">
        Langkah {step} dari {steps.length}
      </p>
      <div className="flex justify-between">
        <Button variant="outline" disabled={step === 1} onClick={() => setStep((s) => s - 1)}>
          Kembali
        </Button>
        <Button disabled={step === steps.length} onClick={() => setStep((s) => s + 1)}>
          Lanjut
        </Button>
      </div>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref } from "vue"
import { Button } from "@/components/ui/button"
import { Stepper, StepperIndicator, StepperItem, StepperSeparator, StepperTitle } from "@/components/ui/stepper"

const steps = ["Pilih lagu", "Data rilis", "Dokumen", "Kirim"]
const step = ref(2)
</script>

<template>
  <div class="grid w-full max-w-xl gap-6">
    <Stepper v-model="step" completed-text="selesai" aria-label="Ajukan clearance">
      <StepperItem v-for="(title, index) in steps" :key="title" :step="index + 1">
        <StepperIndicator />
        <StepperTitle>{{ title }}</StepperTitle>
        <StepperSeparator v-if="index < steps.length - 1" />
      </StepperItem>
    </Stepper>
    <p class="text-center text-sm text-muted-foreground sm:hidden">Langkah {{ step }} dari {{ steps.length }}</p>
    <div class="flex justify-between">
      <Button variant="outline" :disabled="step === 1" @click="step--">Kembali</Button>
      <Button :disabled="step === steps.length" @click="step++">Lanjut</Button>
    </div>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const clearanceSteps = ['Pilih lagu', 'Data rilis', 'Dokumen', 'Kirim'];

// shadcn_ui has no stepper: circles joined by lines, drawn from the theme. On phones only the current
// step's name shows, with "Langkah 2 dari 4" under the steps; every name stays in the semantics.
class StepperDemo extends StatefulWidget {
  const StepperDemo({super.key});

  @override
  State<StepperDemo> createState() => _StepperDemoState();
}

class _StepperDemoState extends State<StepperDemo> {
  int step = 2;

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 576),
      child: LayoutBuilder(
        builder: (context, constraints) {
          final compact = constraints.maxWidth < 640;
          return Column(
            mainAxisSize: MainAxisSize.min,
            spacing: 16,
            children: [
              Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  for (var i = 0; i < clearanceSteps.length; i++)
                    Expanded(
                      child: Semantics(
                        label: '${clearanceSteps[i]}${i + 1 < step ? ', selesai' : ''}',
                        selected: i + 1 == step,
                        child: ExcludeSemantics(
                          child: Stack(
                            children: [
                              // The line to the next step: primary once this step is done.
                              if (i < clearanceSteps.length - 1)
                                Positioned(
                                  top: 15.5,
                                  left: 0,
                                  right: 0,
                                  child: FractionalTranslation(
                                    translation: const Offset(0.5, 0),
                                    child: Padding(
                                      padding: const EdgeInsets.symmetric(horizontal: 24),
                                      child: Container(height: 1, color: i + 1 < step ? theme.colorScheme.primary : theme.colorScheme.border),
                                    ),
                                  ),
                                ),
                              Column(
                                children: [
                                  Container(
                                    width: 32,
                                    height: 32,
                                    alignment: Alignment.center,
                                    decoration: BoxDecoration(
                                      shape: BoxShape.circle,
                                      color: i + 1 < step
                                          ? c.primarySoft
                                          : i + 1 == step
                                              ? theme.colorScheme.primary
                                              : theme.colorScheme.muted,
                                    ),
                                    child: i + 1 < step
                                        ? Icon(LucideIcons.check, size: 16, color: c.primaryText)
                                        : Text(
                                            '${i + 1}',
                                            style: theme.textTheme.small.copyWith(
                                              color: i + 1 == step ? theme.colorScheme.primaryForeground : theme.colorScheme.mutedForeground,
                                            ),
                                          ),
                                  ),
                                  if (!compact || i + 1 == step) ...[
                                    const SizedBox(height: 8),
                                    Text(
                                      clearanceSteps[i],
                                      textAlign: TextAlign.center,
                                      style: i + 1 == step ? theme.textTheme.small : theme.textTheme.muted,
                                    ),
                                  ],
                                ],
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                ],
              ),
              if (compact) Text('Langkah $step dari ${clearanceSteps.length}', style: theme.textTheme.muted),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  ShadButton.outline(enabled: step > 1, onPressed: () => setState(() => step--), child: const Text('Kembali')),
                  ShadButton(enabled: step < clearanceSteps.length, onPressed: () => setState(() => step++), child: const Text('Lanjut')),
                ],
              ),
            ],
          );
        },
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/stepper.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/stepper.json
```

## Accessibility

- It is an ordered list; the current step has `aria-current="step"`.
- Completed steps say so to screen readers, such as "selesai".
- Give the list a name with `aria-label`, such as "Ajukan clearance".
- The circles and lines are decoration; the names carry the meaning.


---

# Timeline

> Lists what happened to a record, newest first.

A timeline lists the history of a record, newest first, such as the status changes of a clearance or the activity on a contract.

## When to use

- Use it for history: status changes, approvals, uploads, comments.
- Put the newest event on top.
- For recent events, show a relative time ("2 jam lalu") and put the full date in `dateTime` and `title`; older events show the date.
- For the steps still ahead, use a [Stepper](https://design.sosialoka.tech/components/stepper/).

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/timeline/_

## Anatomy

1. Latest event
2. Event dot
3. Connector
4. Title and time

An ordered list. Each event has a dot, a line to the next event, the time, a title and an optional description.

| Part | Style |
| --- | --- |
| Dot | 10px (`size-2.5`), `rounded-full`. `primary` by default; `success`, `warning`, `destructive` or `muted-foreground` by status. |
| Line | 1px (`w-px`), `border` |
| Time | `text-xs`, `muted-foreground`, in a `<time>` element |
| Title | `text-sm`, `font-medium` |
| Description | `text-sm`, `muted-foreground` |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `TimelineItem status` | `:status` | dot color from the theme | `default` \| `success` \| `warning` \| `destructive` \| `muted` | `default` | The dot's color. |
| `TimelineTime dateTime` | `datetime` | `Text` | text | none | The machine-readable time of the event. |
| `TimelineTitle`, `TimelineDescription` | same | `Text` | text | none | What happened. |

`shadcn_ui` has no timeline; the Flutter snippet draws the dots and lines from the theme.

## Code

**React**
```tsx
import { Timeline, TimelineDescription, TimelineItem, TimelineTime, TimelineTitle } from "@/components/ui/timeline"

const events = [
  { status: "success", title: "Disetujui", time: "2026-11-12T14:20", label: "12 Nov 2026, 14.20", text: "Lisensi cover siap dipakai." },
  { status: "default", title: "Ditinjau", time: "2026-11-10T10:05", label: "10 Nov 2026, 10.05", text: "Tim kami memeriksa dokumenmu." },
  { status: "default", title: "Dokumen diterima", time: "2026-11-08T16:40", label: "8 Nov 2026, 16.40", text: "Surat kuasa dan master audio lengkap." },
  { status: "muted", title: "Diajukan", time: "2026-11-05T09:12", label: "5 Nov 2026, 09.12", text: "Kamu mengajukan clearance." },
] as const

export default function TimelineDemo() {
  return (
    <Timeline aria-label="Riwayat clearance Senja di Kota" className="w-full max-w-sm">
      {events.map((e) => (
        <TimelineItem key={e.title} status={e.status}>
          <TimelineTime dateTime={e.time}>{e.label}</TimelineTime>
          <TimelineTitle>{e.title}</TimelineTitle>
          <TimelineDescription>{e.text}</TimelineDescription>
        </TimelineItem>
      ))}
    </Timeline>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Timeline, TimelineDescription, TimelineItem, TimelineTime, TimelineTitle } from "@/components/ui/timeline"

const events = [
  { status: "success", title: "Disetujui", time: "2026-11-12T14:20", label: "12 Nov 2026, 14.20", text: "Lisensi cover siap dipakai." },
  { status: "default", title: "Ditinjau", time: "2026-11-10T10:05", label: "10 Nov 2026, 10.05", text: "Tim kami memeriksa dokumenmu." },
  { status: "default", title: "Dokumen diterima", time: "2026-11-08T16:40", label: "8 Nov 2026, 16.40", text: "Surat kuasa dan master audio lengkap." },
  { status: "muted", title: "Diajukan", time: "2026-11-05T09:12", label: "5 Nov 2026, 09.12", text: "Kamu mengajukan clearance." },
] as const
</script>

<template>
  <Timeline aria-label="Riwayat clearance Senja di Kota" class="w-full max-w-sm">
    <TimelineItem v-for="e in events" :key="e.title" :status="e.status">
      <TimelineTime :datetime="e.time">
        {{ e.label }}
      </TimelineTime>
      <TimelineTitle>{{ e.title }}</TimelineTitle>
      <TimelineDescription>{{ e.text }}</TimelineDescription>
    </TimelineItem>
  </Timeline>
</template>
```

**Flutter**
```dart
// shadcn_ui has no timeline: a column of dots and lines drawn from tokens, newest event on top.
// Each event is one Semantics node, so a screen reader reads title, time and text together.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

enum _Status { success, normal, muted }

const _events = [
  (status: _Status.success, title: 'Disetujui', time: '12 Nov 2026, 14.20', text: 'Lisensi cover siap dipakai.'),
  (status: _Status.normal, title: 'Ditinjau', time: '10 Nov 2026, 10.05', text: 'Tim kami memeriksa dokumenmu.'),
  (status: _Status.normal, title: 'Dokumen diterima', time: '8 Nov 2026, 16.40', text: 'Surat kuasa dan master audio lengkap.'),
  (status: _Status.muted, title: 'Diajukan', time: '5 Nov 2026, 09.12', text: 'Kamu mengajukan clearance.'),
];

class TimelineDemo extends StatelessWidget {
  const TimelineDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    Color dot(_Status s) => switch (s) {
      _Status.success => c.success,
      _Status.normal => theme.colorScheme.primary,
      _Status.muted => theme.colorScheme.mutedForeground,
    };
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          for (final (index, e) in _events.indexed)
            Semantics(
              label: '${e.title}, ${e.time}. ${e.text}',
              child: ExcludeSemantics(
                child: IntrinsicHeight(
                  child: Row(
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: [
                      SizedBox(
                        width: 16,
                        child: Column(
                          children: [
                            const SizedBox(height: 4),
                            Container(
                              width: 10,
                              height: 10,
                              decoration: BoxDecoration(color: dot(e.status), shape: BoxShape.circle),
                            ),
                            if (index < _events.length - 1)
                              Expanded(child: Container(width: 1, color: theme.colorScheme.border)),
                          ],
                        ),
                      ),
                      const SizedBox(width: 12),
                      Expanded(
                        child: Padding(
                          padding: const EdgeInsets.only(bottom: 20),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(e.time, style: theme.textTheme.muted),
                              Text(e.title, style: const TextStyle(fontWeight: FontWeight.w500)),
                              Text(e.text, style: theme.textTheme.muted),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/timeline.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/timeline.json
```

## Accessibility

- It is a list; give it a name with `aria-label`, such as "Riwayat clearance Senja di Kota".
- The title says what happened, so the dot's color is never the only signal.
- The dots and lines are hidden from screen readers. In Flutter, each event is one `Semantics` node with its title, time and text.


---

# Table

> Shows records in rows and columns, with the shared datatable layout and pagination.

A table shows records in rows and columns; every Sosialoka product lays out its datatables the same way.

## When to use

- Use it for records people compare or scan, such as releases, documents or payouts.
- Use cards for a few rich items, and a plain list for one column of text.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/table/_

### Do and don't

- **Do:** Right-align numbers with tabular figures, so the digits line up.
- **Don't:** Don't center numbers; their magnitudes become hard to compare.

## Anatomy

1. Header row on muted
2. Row
3. Status badge

The shared datatable has four parts:

1. **Header**: column names in `muted-foreground`, medium weight.
2. **Rows**: `border-b border-border` between rows, `bg-muted/50` on hover. Status uses a [Badge](https://design.sosialoka.tech/components/badge/).
3. **Row actions**: a ghost icon button that opens a [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/), in the last column.
4. **Pagination**: below the table, inside the same card. The current page is an `outline` button.

Put the table in a card (`rounded-lg border border-border bg-card`) so it reads as one surface.

## Variants

There is one style. Add `text-right` and `tabular-nums` to number columns.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `Table`, `TableHeader`, `TableBody`, `TableRow`, `TableHead`, `TableCell` | same names | `ShadTable.list`, `ShadTableCell` | element | none | Table structure. |
| `PaginationLink isActive` | `PaginationItem :is-active` | `ShadButton.outline` | boolean | `false` | Marks the current page. |
| `href` on pagination links | `:total`, `:items-per-page` on `Pagination` | none | string / number | none | Where a page link goes, or how Vue counts pages. |

## Code

**React**
```tsx
import { useState, type MouseEvent } from "react"
import { Badge } from "@/components/ui/badge"
import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit" },
  { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu" },
  { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak" },
] as const

/** Two pages of five rows; the demo shows the first page's rows on both. */
const pages = [1, 2]

export default function TableDemo() {
  const [page, setPage] = useState(1)
  const goTo = (next: number) => (event: MouseEvent) => {
    event.preventDefault()
    setPage(next)
  }
  return (
    <div className="w-full max-w-xl rounded-lg border border-border bg-card">
      <Table>
        <TableHeader>
          <TableRow>
            <TableHead>Judul</TableHead>
            <TableHead>Artis</TableHead>
            <TableHead>Status</TableHead>
          </TableRow>
        </TableHeader>
        <TableBody>
          {releases.map((r) => (
            <TableRow key={r.title}>
              <TableCell className="font-medium">{r.title}</TableCell>
              <TableCell className="text-muted-foreground">{r.artist}</TableCell>
              <TableCell>
                <Badge variant={r.status}>{r.label}</Badge>
              </TableCell>
            </TableRow>
          ))}
        </TableBody>
      </Table>
      <Pagination className="border-t border-border py-2">
        <PaginationContent>
          <PaginationItem>
            <PaginationPrevious href="#" disabled={page === 1} onClick={goTo(page - 1)} />
          </PaginationItem>
          {pages.map((p) => (
            <PaginationItem key={p}>
              <PaginationLink href="#" isActive={p === page} onClick={goTo(p)}>
                {p}
              </PaginationLink>
            </PaginationItem>
          ))}
          <PaginationItem>
            <PaginationNext href="#" disabled={page === pages.length} onClick={goTo(page + 1)} />
          </PaginationItem>
        </PaginationContent>
      </Pagination>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Badge } from "@/components/ui/badge"
import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit" },
  { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu" },
  { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak" },
] as const
</script>

<template>
  <div class="w-full max-w-xl rounded-lg border border-border bg-card">
    <Table>
      <TableHeader>
        <TableRow>
          <TableHead>Judul</TableHead>
          <TableHead>Artis</TableHead>
          <TableHead>Status</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        <TableRow v-for="r in releases" :key="r.title">
          <TableCell class="font-medium">{{ r.title }}</TableCell>
          <TableCell class="text-muted-foreground">{{ r.artist }}</TableCell>
          <TableCell><Badge :variant="r.status">{{ r.label }}</Badge></TableCell>
        </TableRow>
      </TableBody>
    </Table>
    <Pagination v-slot="{ page }" :items-per-page="5" :total="10" :default-page="1" class="border-t border-border py-2">
      <PaginationContent v-slot="{ items }">
        <PaginationPrevious />
        <template v-for="(item, index) in items" :key="index">
          <PaginationItem v-if="item.type === 'page'" :value="item.value" :is-active="item.value === page">
            {{ item.value }}
          </PaginationItem>
        </template>
        <PaginationNext />
      </PaginationContent>
    </Pagination>
  </div>
</template>
```

**Flutter**
```dart
// shadcn_ui has no pagination widget: put ShadButton.outline (current page) and ShadButton.ghost below the table.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const releases = [
  (title: 'Senja di Kota', artist: 'Rara Senandika', status: 'Terbit'),
  (title: 'Kaset Pertama', artist: 'Bima Laras', status: 'Menunggu'),
  (title: 'Pulang Sore', artist: 'Nada Kirana', status: 'Dijadwalkan'),
];

class TableDemo extends StatelessWidget {
  const TableDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 576, maxHeight: 320),
      child: ShadTable.list(
        // Fixed widths for the title and artist; the status column takes the rest, so badges never clip.
        columnSpanExtent: (index) => switch (index) {
          0 => const FixedTableSpanExtent(200),
          1 => const FixedTableSpanExtent(180),
          _ => const RemainingTableSpanExtent(),
        },
        header: const [
          ShadTableCell.header(child: Text('Judul')),
          ShadTableCell.header(child: Text('Artis')),
          ShadTableCell.header(child: Text('Status')),
        ],
        children: releases.map(
          (r) => [
            ShadTableCell(child: Text(r.title, style: const TextStyle(fontWeight: FontWeight.w500))),
            ShadTableCell(child: Text(r.artist)),
            ShadTableCell(child: ShadBadge.outline(child: Text(r.status))),
          ],
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/table.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/table.json
```

Pagination is a separate item:

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/pagination.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/pagination.json
```

## Accessibility

- Uses native `table`, `th` and `td`, so screen readers announce rows and columns.
- Pagination is a `nav`; the current page has `aria-current="page"`.
- Give icon-only row actions an `aria-label`, such as "Aksi".


---

# Chart

> Draws numbers over time or across categories, with a table of the same numbers.

A chart shows how numbers move over time or compare across categories, such as monthly streams per platform or royalty income.

## When to use

- **Bar** to compare amounts across a few categories or months.
- **Line** for one or two measures over many points in time, such as income per month.
- **Area** only for a single total over time; stacked areas are hard to read.
- Use at most 5 series. Fold the rest into "Lainnya", or split the chart.
- With 4 or more series, label each line or bar group directly, not only in the legend.
- In scatter plots and maps, where any color can sit next to any other, use at most 3 series.
- One chart, one axis. Two measures on different scales get two charts.
- A single headline number is a stat card, not a chart.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/chart/_

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/chart/_

## Anatomy

1. Bar series in chart-1
2. Line series in chart-2
3. Axis

A [Card](https://design.sosialoka.tech/components/card/) with a title and a short description, the chart, a legend when there are two or more series, and a visually hidden table of the same numbers.

| Part | Style |
| --- | --- |
| Series | `chart-1` to `chart-5`, in order. `chart-1` is the product's own hue. Never a status color. |
| Grid | Horizontal lines only, in `border`. No axis lines. |
| Axis labels | `text-xs`, `muted-foreground`. |
| Bars | 4px rounded tops, 2px apart. |
| Lines | 2px, no dots until hover. |
| Tooltip | The popover surface: `rounded-lg`, `border`, `bg-popover`, `shadow-lg`. |
| Numbers | `tabular-nums`, in the product's locale (`12,400` in English, `12.400` in Indonesian), Rupiah with two decimals (`Rp 1.890.420,25`). |

The chart colors are tokens with 3:1 contrast on `background` and `card`. Neighboring series, in their order, stay apart for color-blind readers; colors further apart in the order can look alike, which is why 4 or more series need direct labels. See [Color](https://design.sosialoka.tech/foundations/color/#chart-palette).

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `ChartContainer config` | `ChartContainer :config` | colors from `context.sosialoka.chart1`… | `ChartConfig` | none | Each series' label and color, such as `{ color: "var(--chart-1)" }`. |
| Recharts children | Unovis children | `fl_chart` `BarChart`, `LineChart` | components | none | The chart itself. |
| `ChartTooltipContent formatter` | `formatter` | `getTooltipItem` | function | numbers in `locale` | Formats a value, such as Rupiah. |
| `ChartTooltipContent locale`, `ChartTable locale` | `locale` | `NumberFormat` locale | text | `en-GB` | How numbers read when there is no formatter, such as `"id-ID"` for `12.400`. |
| `ChartTable caption labelKey labelHeader data config format` | same | `Semantics label` | | none | The same numbers for screen readers. Always add it. |

## Code

**React**
```tsx
import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from "recharts"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import {
  ChartContainer,
  ChartLegend,
  ChartLegendContent,
  ChartTable,
  ChartTooltip,
  ChartTooltipContent,
  type ChartConfig,
} from "@/components/ui/chart"

const data = [
  { month: "Jun", spotify: 8200, youtube: 5100 },
  { month: "Jul", spotify: 9100, youtube: 5600 },
  { month: "Agu", spotify: 9800, youtube: 6900 },
  { month: "Sep", spotify: 10600, youtube: 7300 },
  { month: "Okt", spotify: 11300, youtube: 8100 },
  { month: "Nov", spotify: 12400, youtube: 8800 },
]

const config = {
  spotify: { label: "Spotify", color: "var(--chart-1)" },
  youtube: { label: "YouTube Music", color: "var(--chart-2)" },
} satisfies ChartConfig

const compact = (value: number) => new Intl.NumberFormat("id-ID", { notation: "compact" }).format(value)

export default function ChartDemo() {
  return (
    <Card className="w-full max-w-xl">
      <CardHeader>
        <CardTitle>Streaming per bulan</CardTitle>
        <CardDescription>Jun–Nov 2026, semua rilis</CardDescription>
      </CardHeader>
      <CardContent>
        <ChartContainer config={config} className="aspect-auto h-64 w-full">
          <BarChart data={data} barGap={2}>
            <CartesianGrid vertical={false} />
            <XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
            <YAxis tickLine={false} axisLine={false} tickMargin={8} width={48} tickFormatter={compact} />
            <ChartTooltip cursor={false} content={<ChartTooltipContent locale="id-ID" />} />
            <ChartLegend content={<ChartLegendContent />} />
            <Bar dataKey="spotify" fill="var(--color-spotify)" radius={[4, 4, 0, 0]} maxBarSize={20} />
            <Bar dataKey="youtube" fill="var(--color-youtube)" radius={[4, 4, 0, 0]} maxBarSize={20} />
          </BarChart>
        </ChartContainer>
        <ChartTable locale="id-ID" caption="Streaming per bulan, Jun–Nov 2026" labelHeader="Bulan" labelKey="month" data={data} config={config} />
      </CardContent>
    </Card>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import type { ChartConfig } from "@/components/ui/chart"
import { VisAxis, VisGroupedBar, VisXYContainer } from "@unovis/vue"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import {
  ChartContainer,
  ChartCrosshair,
  ChartLegendContent,
  ChartTable,
  ChartTooltip,
  ChartTooltipContent,
  componentToString,
} from "@/components/ui/chart"

const data = [
  { month: "Jun", spotify: 8200, youtube: 5100 },
  { month: "Jul", spotify: 9100, youtube: 5600 },
  { month: "Agu", spotify: 9800, youtube: 6900 },
  { month: "Sep", spotify: 10600, youtube: 7300 },
  { month: "Okt", spotify: 11300, youtube: 8100 },
  { month: "Nov", spotify: 12400, youtube: 8800 },
]
type Row = (typeof data)[number]

const config = {
  spotify: { label: "Spotify", color: "var(--chart-1)" },
  youtube: { label: "YouTube Music", color: "var(--chart-2)" },
} satisfies ChartConfig

const compact = (value: number) => new Intl.NumberFormat("id-ID", { notation: "compact" }).format(value)
</script>

<template>
  <Card class="w-full max-w-xl">
    <CardHeader>
      <CardTitle>Streaming per bulan</CardTitle>
      <CardDescription>Jun–Nov 2026, semua rilis</CardDescription>
    </CardHeader>
    <CardContent>
      <ChartContainer :config="config" class="aspect-auto h-64 w-full">
        <VisXYContainer :data="data" :padding="{ top: 8 }">
          <VisGroupedBar
            :x="(_: Row, i: number) => i"
            :y="[(d: Row) => d.spotify, (d: Row) => d.youtube]"
            :color="[config.spotify.color, config.youtube.color]"
            :rounded-corners="4"
            :bar-padding="0.3"
            :group-max-width="44"
          />
          <VisAxis type="x" :x="(_: Row, i: number) => i" :tick-format="(i: number) => data[i]?.month" :num-ticks="6" :grid-line="false" :tick-line="false" :domain-line="false" />
          <VisAxis type="y" :num-ticks="4" :tick-format="compact" :tick-line="false" :domain-line="false" />
          <ChartTooltip />
          <ChartCrosshair :template="componentToString(config, ChartTooltipContent, { labelKey: 'month', locale: 'id-ID' })" color="transparent" />
        </VisXYContainer>
        <ChartLegendContent />
      </ChartContainer>
      <ChartTable locale="id-ID" caption="Streaming per bulan, Jun–Nov 2026" label-header="Bulan" label-key="month" :data="data" :config="config" />
    </CardContent>
  </Card>
</template>
```

**Flutter**
```dart
// Charts come from fl_chart, colored with the chart palette of the Sosialoka theme (context.sosialoka.chart1…5).
// The bars are hidden from screen readers; a Semantics label carries the numbers instead.
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _months = ['Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov'];
const _spotify = [8200, 9100, 9800, 10600, 11300, 12400];
const _youtube = [5100, 5600, 6900, 7300, 8100, 8800];

class ChartDemo extends StatelessWidget {
  const ChartDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    final number = NumberFormat.decimalPattern('id');
    final summary = [
      for (var i = 0; i < _months.length; i++)
        '${_months[i]}: Spotify ${number.format(_spotify[i])}, YouTube Music ${number.format(_youtube[i])}',
    ].join('; ');
    Widget legend(Color color, String label) => Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        Container(
          width: 10,
          height: 10,
          decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(2)),
        ),
        const SizedBox(width: 6),
        Text(label, style: theme.textTheme.muted),
      ],
    );
    return ShadCard(
      width: 576,
      title: Text('Streaming per bulan', style: theme.textTheme.h4),
      description: const Text('Jun–Nov 2026, semua rilis'),
      child: Padding(
        padding: const EdgeInsets.only(top: 16),
        child: Column(
          children: [
            Semantics(
              label: 'Streaming per bulan, Jun–Nov 2026. $summary.',
              child: ExcludeSemantics(
                child: SizedBox(
                  height: 220,
                  child: BarChart(
                    BarChartData(
                      // The tooltip sits on the popover surface, like the web charts.
                      barTouchData: BarTouchData(
                        touchTooltipData: BarTouchTooltipData(
                          getTooltipColor: (_) => theme.colorScheme.popover,
                          tooltipBorder: BorderSide(color: theme.colorScheme.border),
                          getTooltipItem: (group, _, rod, rodIndex) => BarTooltipItem(
                            '${rodIndex == 0 ? 'Spotify' : 'YouTube Music'} ${number.format(rod.toY)}',
                            theme.textTheme.small.copyWith(color: theme.colorScheme.popoverForeground),
                          ),
                        ),
                      ),
                      gridData: FlGridData(
                        drawVerticalLine: false,
                        getDrawingHorizontalLine: (_) => FlLine(color: theme.colorScheme.border, strokeWidth: 1),
                      ),
                      borderData: FlBorderData(show: false),
                      titlesData: FlTitlesData(
                        topTitles: const AxisTitles(),
                        rightTitles: const AxisTitles(),
                        leftTitles: AxisTitles(
                          sideTitles: SideTitles(
                            showTitles: true,
                            reservedSize: 44,
                            getTitlesWidget: (value, meta) => Text(
                              NumberFormat.compact(locale: 'id').format(value),
                              style: theme.textTheme.muted,
                            ),
                          ),
                        ),
                        bottomTitles: AxisTitles(
                          sideTitles: SideTitles(
                            showTitles: true,
                            getTitlesWidget: (value, meta) => Text(_months[value.toInt()], style: theme.textTheme.muted),
                          ),
                        ),
                      ),
                      barGroups: [
                        for (var i = 0; i < _months.length; i++)
                          BarChartGroupData(
                            x: i,
                            barsSpace: 2,
                            barRods: [
                              BarChartRodData(
                                toY: _spotify[i].toDouble(),
                                color: c.chart1,
                                width: 14,
                                borderRadius: const BorderRadius.vertical(top: Radius.circular(4)),
                              ),
                              BarChartRodData(
                                toY: _youtube[i].toDouble(),
                                color: c.chart2,
                                width: 14,
                                borderRadius: const BorderRadius.vertical(top: Radius.circular(4)),
                              ),
                            ],
                          ),
                      ],
                    ),
                  ),
                ),
              ),
            ),
            const SizedBox(height: 12),
            Wrap(spacing: 16, children: [legend(c.chart1, 'Spotify'), legend(c.chart2, 'YouTube Music')]),
          ],
        ),
      ),
    );
  }
}
```

### Line chart

**React**
```tsx
import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { ChartContainer, ChartTable, ChartTooltip, ChartTooltipContent, type ChartConfig } from "@/components/ui/chart"

const data = [
  { month: "Jun", revenue: 1250000 },
  { month: "Jul", revenue: 1418500.5 },
  { month: "Agu", revenue: 1377250 },
  { month: "Sep", revenue: 1602000.75 },
  { month: "Okt", revenue: 1745300 },
  { month: "Nov", revenue: 1890420.25 },
]

const config = { revenue: { label: "Pendapatan" , color: "var(--chart-1)" } } satisfies ChartConfig

const rupiah = (value: unknown) =>
  new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR", minimumFractionDigits: 2 }).format(Number(value))
const compact = (value: number) => new Intl.NumberFormat("id-ID", { notation: "compact" }).format(value)

export default function ChartLineDemo() {
  return (
    <Card className="w-full max-w-xl">
      <CardHeader>
        <CardTitle>Pendapatan royalti</CardTitle>
        <CardDescription>Jun–Nov 2026, dalam Rupiah</CardDescription>
      </CardHeader>
      <CardContent>
        <ChartContainer config={config} className="aspect-auto h-56 w-full">
          <LineChart data={data} margin={{ right: 8 }}>
            <CartesianGrid vertical={false} />
            <XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
            <YAxis tickLine={false} axisLine={false} tickMargin={8} width={48} tickFormatter={compact} />
            <ChartTooltip cursor={false} content={<ChartTooltipContent formatter={(value) => rupiah(value)} hideIndicator />} />
            <Line dataKey="revenue" type="monotone" stroke="var(--color-revenue)" strokeWidth={2} dot={false} activeDot={{ r: 4, strokeWidth: 2 }} />
          </LineChart>
        </ChartContainer>
        <ChartTable caption="Pendapatan royalti, Jun–Nov 2026" labelHeader="Bulan" labelKey="month" data={data} config={config} format={rupiah} />
      </CardContent>
    </Card>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import type { ChartConfig } from "@/components/ui/chart"
import { VisAxis, VisLine, VisXYContainer } from "@unovis/vue"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { ChartContainer, ChartCrosshair, ChartTable, ChartTooltip, ChartTooltipContent, componentToString } from "@/components/ui/chart"

const data = [
  { month: "Jun", revenue: 1250000 },
  { month: "Jul", revenue: 1418500.5 },
  { month: "Agu", revenue: 1377250 },
  { month: "Sep", revenue: 1602000.75 },
  { month: "Okt", revenue: 1745300 },
  { month: "Nov", revenue: 1890420.25 },
]
type Row = (typeof data)[number]

const config = { revenue: { label: "Pendapatan", color: "var(--chart-1)" } } satisfies ChartConfig

const rupiah = (value: unknown) =>
  new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR", minimumFractionDigits: 2 }).format(Number(value))
const compact = (value: number) => new Intl.NumberFormat("id-ID", { notation: "compact" }).format(value)
</script>

<template>
  <Card class="w-full max-w-xl">
    <CardHeader>
      <CardTitle>Pendapatan royalti</CardTitle>
      <CardDescription>Jun–Nov 2026, dalam Rupiah</CardDescription>
    </CardHeader>
    <CardContent>
      <ChartContainer :config="config" class="aspect-auto h-56 w-full" cursor>
        <VisXYContainer :data="data" :padding="{ top: 8, right: 8 }">
          <VisLine :x="(_: Row, i: number) => i" :y="(d: Row) => d.revenue" :color="config.revenue.color" :line-width="2" />
          <VisAxis type="x" :x="(_: Row, i: number) => i" :tick-format="(i: number) => data[i]?.month" :num-ticks="6" :grid-line="false" :tick-line="false" :domain-line="false" />
          <VisAxis type="y" :num-ticks="4" :tick-format="compact" :tick-line="false" :domain-line="false" />
          <ChartTooltip />
          <ChartCrosshair :template="componentToString(config, ChartTooltipContent, { labelKey: 'month', hideIndicator: true, formatter: rupiah })" :color="config.revenue.color" />
        </VisXYContainer>
      </ChartContainer>
      <ChartTable caption="Pendapatan royalti, Jun–Nov 2026" label-header="Bulan" label-key="month" :data="data" :config="config" :format="rupiah" />
    </CardContent>
  </Card>
</template>
```

**Flutter**
```dart
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const revenue = [
  (month: 'Jun', value: 1250000.0),
  (month: 'Jul', value: 1418500.5),
  (month: 'Agu', value: 1377250.0),
  (month: 'Sep', value: 1602000.75),
  (month: 'Okt', value: 1745300.0),
  (month: 'Nov', value: 1890420.25),
];

// One series in chart-1, with Rupiah to two decimals. Screen readers get the same numbers as one sentence.
class ChartLineDemo extends StatelessWidget {
  const ChartLineDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    final rupiah = NumberFormat.currency(locale: 'id', symbol: 'Rp', decimalDigits: 2);
    final compact = NumberFormat.compact(locale: 'id');
    final axis = theme.textTheme.muted.copyWith(fontSize: 12);
    final summary = [
      'Pendapatan royalti, Jun–Nov 2026.',
      for (final r in revenue) '${r.month}: ${rupiah.format(r.value)}.',
    ].join(' ');

    return ShadCard(
      width: 576,
      title: Text('Pendapatan royalti', style: theme.textTheme.h4),
      description: const Text('Jun–Nov 2026, dalam Rupiah'),
      child: Semantics(
        label: summary,
        child: ExcludeSemantics(
          child: Padding(
            padding: const EdgeInsets.only(top: 16),
            child: SizedBox(
              height: 220,
              child: LineChart(
                LineChartData(
                  minY: 1000000,
                  maxY: 2000000,
                  lineBarsData: [
                    LineChartBarData(
                      spots: [for (var i = 0; i < revenue.length; i++) FlSpot(i.toDouble(), revenue[i].value)],
                      isCurved: true,
                      color: c.chart1,
                      barWidth: 2,
                      dotData: const FlDotData(show: false),
                    ),
                  ],
                  gridData: FlGridData(
                    drawVerticalLine: false,
                    horizontalInterval: 250000,
                    getDrawingHorizontalLine: (_) => FlLine(color: theme.colorScheme.border, strokeWidth: 1),
                  ),
                  borderData: FlBorderData(show: false),
                  titlesData: FlTitlesData(
                    topTitles: const AxisTitles(),
                    rightTitles: const AxisTitles(),
                    bottomTitles: AxisTitles(
                      sideTitles: SideTitles(
                        showTitles: true,
                        interval: 1,
                        getTitlesWidget: (value, meta) => SideTitleWidget(meta: meta, child: Text(revenue[value.toInt()].month, style: axis)),
                      ),
                    ),
                    leftTitles: AxisTitles(
                      sideTitles: SideTitles(
                        showTitles: true,
                        reservedSize: 44,
                        interval: 250000,
                        getTitlesWidget: (value, meta) => SideTitleWidget(meta: meta, child: Text(compact.format(value), style: axis)),
                      ),
                    ),
                  ),
                  lineTouchData: LineTouchData(
                    touchTooltipData: LineTouchTooltipData(
                      getTooltipColor: (_) => theme.colorScheme.popover,
                      tooltipBorder: BorderSide(color: theme.colorScheme.border),
                      getTooltipItems: (spots) => [
                        for (final s in spots)
                          LineTooltipItem(rupiah.format(s.y), theme.textTheme.small.copyWith(color: theme.colorScheme.popoverForeground)),
                      ],
                    ),
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/chart.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/chart.json
```

React draws with Recharts and Vue with Unovis; Flutter uses `fl_chart`.

## Accessibility

- Every chart has a text alternative: `ChartTable` renders a visually hidden table with the same numbers, and Flutter wraps the chart in a `Semantics` label that reads them.
- The drawing is hidden from screen readers and kept out of the tab order, so the table is the one source.
- The tooltip is never the only place a number lives.
- A legend names the series whenever there are two or more, so color is never the only way to tell them apart.

## Migrating from ApexCharts

Cover Clearance draws its charts with ApexCharts today. When a screen moves to this design system, its charts move to Chart: same data, the `chart-n` colors, and a `ChartTable`.


---

# Dialog

> Asks for a decision or input in a window over the page.

A dialog asks for a decision or a short input in a window over the page, which stays dimmed behind it.

## When to use

- Use it for a short form or a choice that needs the whole attention, such as renaming a release.
- Use an [Alert Dialog](https://design.sosialoka.tech/components/alert-dialog/) to confirm an action that can't be undone.
- Use a [Toast](https://design.sosialoka.tech/components/toast/) to confirm something that already happened.
- Don't put long flows in a dialog; use a page.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/dialog/_

### Do and don't

- **Do:** Keep a dialog to one decision or a short form.
- **Don't:** Don't open a dialog on top of another dialog.

## Anatomy

1. Overlay
2. Title
3. Body
4. Actions, primary last

Title, description, optional content, then actions in the footer. The window sits on `popover` with a `border`, `radius-xl` (16px) and `shadow-lg`. The page behind it is dimmed with the `overlay` token.

## Variants

There is one style. Put the main action last in the footer.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `open` / `defaultOpen` | `v-model:open` / `default-open` | `showShadDialog` | boolean | `false` | Whether it is open. |
| `onOpenChange` | `@update:open` | return value of `showShadDialog` | function | none | Runs when it opens or closes. |
| `DialogTrigger render` | `DialogTrigger as-child` | `onPressed` | element | button | The control that opens it. |

## Code

**React**
```tsx
import { useId } from "react"
import { Button } from "@/components/ui/button"
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
import { Field, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"

export default function DialogDemo() {
  const id = useId()
  return (
    <Dialog>
      <DialogTrigger render={<Button variant="outline" />}>Ubah judul</DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Ubah judul rilis</DialogTitle>
          <DialogDescription>Judul baru tampil di semua toko musik setelah dikirim ulang.</DialogDescription>
        </DialogHeader>
        <Field>
          <FieldLabel htmlFor={`${id}-title`}>Judul rilis</FieldLabel>
          <Input id={`${id}-title`} defaultValue="Senja di Kota" />
        </Field>
        <DialogFooter>
          <DialogClose render={<Button variant="outline" />}>Batal</DialogClose>
          <DialogClose render={<Button />}>Simpan</DialogClose>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Button } from "@/components/ui/button"
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
import { Field, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"

const id = useId()
</script>

<template>
  <Dialog>
    <DialogTrigger as-child>
      <Button variant="outline">Ubah judul</Button>
    </DialogTrigger>
    <DialogContent>
      <DialogHeader>
        <DialogTitle>Ubah judul rilis</DialogTitle>
        <DialogDescription>Judul baru tampil di semua toko musik setelah dikirim ulang.</DialogDescription>
      </DialogHeader>
      <Field>
        <FieldLabel :for="`${id}-title`">Judul rilis</FieldLabel>
        <Input :id="`${id}-title`" default-value="Senja di Kota" />
      </Field>
      <DialogFooter>
        <DialogClose as-child><Button variant="outline">Batal</Button></DialogClose>
        <DialogClose as-child><Button>Simpan</Button></DialogClose>
      </DialogFooter>
    </DialogContent>
  </Dialog>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class DialogDemo extends StatelessWidget {
  const DialogDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadButton.outline(
      child: const Text('Ubah judul'),
      onPressed: () => showShadDialog(
        context: context,
        builder: (context) => ShadDialog(
          title: const Text('Ubah judul rilis'),
          description: const Text('Judul baru tampil di semua toko musik setelah dikirim ulang.'),
          actions: [
            ShadButton.outline(child: const Text('Batal'), onPressed: () => Navigator.of(context).pop()),
            ShadButton(child: const Text('Simpan'), onPressed: () => Navigator.of(context).pop()),
          ],
          child: ShadInputFormField(id: 'release-title', label: const Text('Judul rilis'), initialValue: 'Senja di Kota'),
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/dialog.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/dialog.json
```

The button it installs is the Sosialoka button.

## Accessibility

- Renders `role="dialog"` with the title as its name; focus moves into the dialog and returns to the trigger when it closes.
- Escape closes it, and focus stays inside while it is open.


---

# Alert Dialog

> Confirms an action that cannot be undone.

An alert dialog asks people to confirm an action that cannot be undone, such as deleting a release, before it runs.

## When to use

- Use it only for actions that cannot be undone: deleting, cancelling a subscription, withdrawing a contract.
- Use a [Dialog](https://design.sosialoka.tech/components/dialog/) for a short form, and an undo [Toast](https://design.sosialoka.tech/components/toast/) when the action can be reversed.
- Write the title as a question ("Hapus rilis?") and name what goes away in the description.
- Label the action with its verb ("Hapus"), never "Ya" or "OK".

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/alert-dialog/_

### Do and don't

- **Do:** Name the action in the title and on the button, and focus Cancel first.
- **Don't:** Don't ask a vague question with a lone OK button.

## Anatomy

1. Warning icon
2. Title that names the action
3. Cancel, focused first
4. Destructive action

A title, a description, and a footer band with **Batal** and the action. The window sits on `popover` with a `border`, `radius-xl` and `shadow-lg`, over the `overlay` token. The focus starts on **Batal**, and the destructive action sits last, on the right.

## Variants

There is one style. Use the `destructive` button for the action; keep the default button only for actions that don't delete, such as signing out of every device.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `open` / `onOpenChange` | `v-model:open` | `showShadDialog` | boolean | `false` | Opens it from code. |
| `AlertDialogAction variant` | `AlertDialogAction variant` | `ShadButton.destructive` | text | `default` | The action button. |
| `AlertDialogCancel autoFocus` | `AlertDialogCancel` (focused first) | `ShadButton.outline(autofocus: true)` | boolean | none | Starts the focus on Cancel. |
| `AlertDialogTrigger render` | `AlertDialogTrigger as-child` | the button that calls `showShadDialog` | element | none | The button that opens it. |

## Code

**React**
```tsx
import { useState } from "react"
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button"

export default function AlertDialogDemo() {
  const [deleted, setDeleted] = useState(false)
  if (deleted) return <p className="text-sm text-muted-foreground">"Senja di Kota" dihapus.</p>
  return (
    <AlertDialog>
      <AlertDialogTrigger render={<Button variant="outline" />}>Hapus rilis</AlertDialogTrigger>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>Hapus rilis?</AlertDialogTitle>
          <AlertDialogDescription>"Senja di Kota" dan semua datanya akan dihapus. Kamu tidak bisa mengembalikannya.</AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel autoFocus>Batal</AlertDialogCancel>
          <AlertDialogAction variant="destructive" onClick={() => setDeleted(true)}>
            Hapus
          </AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref } from "vue"
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button"

const deleted = ref(false)
</script>

<template>
  <p v-if="deleted" class="text-sm text-muted-foreground">"Senja di Kota" dihapus.</p>
  <AlertDialog v-else>
    <AlertDialogTrigger as-child>
      <Button variant="outline">Hapus rilis</Button>
    </AlertDialogTrigger>
    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>Hapus rilis?</AlertDialogTitle>
        <AlertDialogDescription>"Senja di Kota" dan semua datanya akan dihapus. Kamu tidak bisa mengembalikannya.</AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogCancel>Batal</AlertDialogCancel>
        <AlertDialogAction variant="destructive" @click="deleted = true">Hapus</AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class AlertDialogDemo extends StatelessWidget {
  const AlertDialogDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadButton.outline(
      child: const Text('Hapus rilis'),
      onPressed: () => showShadDialog<bool>(
        context: context,
        builder: (context) => ShadDialog.alert(
          title: const Text('Hapus rilis?'),
          description: const Text('"Senja di Kota" dan semua datanya akan dihapus. Kamu tidak bisa mengembalikannya.'),
          actions: [
            // Cancel takes the focus first; the destructive action sits last.
            ShadButton.outline(autofocus: true, child: const Text('Batal'), onPressed: () => Navigator.of(context).pop(false)),
            ShadButton.destructive(child: const Text('Hapus'), onPressed: () => Navigator.of(context).pop(true)),
          ],
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/alert-dialog.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/alert-dialog.json
```

## Accessibility

- It has `role="alertdialog"`, named by its title and described by its description.
- The focus starts on Cancel, so pressing Enter by habit does not delete anything.
- Escape cancels; a click outside does not close it.
- The focus stays inside until it closes, then goes back to the trigger.


---

# Sheet

> A panel that slides in from the edge of the screen.

A sheet slides a panel in from the edge of the screen, over a dimmed page, for filters or details that don't need a new page.

## When to use

- Use it for filters on a list, and for a side panel with the details of one row.
- Use a [Dialog](https://design.sosialoka.tech/components/dialog/) for a decision or a short form, and a page for a long flow.
- On phones, open it from the bottom as a bottom sheet.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/sheet/_

## Anatomy

1. Overlay
2. Panel from the edge
3. Title
4. Action

A header with a title and one sentence of description, the content, and a footer with the main action. The panel sits on `popover` with a `border` on its inner edge and no radius on the edge that touches the screen, over the `overlay` token.

## Variants

| Side | Use it for |
| --- | --- |
| `right` (default) | Filters and details on the web. |
| `bottom` | Filters and actions on phones. |
| `left` / `top` | Rare; navigation menus use the Sidebar. |

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `side` on `SheetContent` | `side` on `SheetContent` | `side` on `showShadSheet` | text | `right` | The edge it slides in from. |
| `open` / `onOpenChange` | `v-model:open` | `showShadSheet` | boolean | `false` | Opens it from code. |
| `SheetTitle`, `SheetDescription` | `SheetTitle`, `SheetDescription` | `title`, `description` | text | none | Names the panel. |
| `SheetFooter` | `SheetFooter` | `actions` | element | none | The main action. |

## Code

**React**
```tsx
import { useId } from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"

const statuses = ["Terbit", "Menunggu", "Ditolak"]

export default function SheetDemo() {
  const id = useId()
  return (
    <Sheet>
      <SheetTrigger render={<Button variant="outline" />}>Filter</SheetTrigger>
      <SheetContent side="right">
        <SheetHeader>
          <SheetTitle>Filter rilis</SheetTitle>
          <SheetDescription>Tampilkan rilis dengan status yang kamu pilih.</SheetDescription>
        </SheetHeader>
        <div className="grid gap-3 px-4">
          {statuses.map((status) => (
            <div key={status} className="flex items-center gap-2">
              <Checkbox id={`${id}-${status}`} />
              <Label htmlFor={`${id}-${status}`}>{status}</Label>
            </div>
          ))}
        </div>
        <SheetFooter>
          <SheetClose render={<Button />}>Terapkan</SheetClose>
        </SheetFooter>
      </SheetContent>
    </Sheet>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"

const statuses = ["Terbit", "Menunggu", "Ditolak"]
const id = useId()
</script>

<template>
  <Sheet>
    <SheetTrigger as-child>
      <Button variant="outline">Filter</Button>
    </SheetTrigger>
    <SheetContent side="right">
      <SheetHeader>
        <SheetTitle>Filter rilis</SheetTitle>
        <SheetDescription>Tampilkan rilis dengan status yang kamu pilih.</SheetDescription>
      </SheetHeader>
      <div class="grid gap-3 px-4">
        <div v-for="status in statuses" :key="status" class="flex items-center gap-2">
          <Checkbox :id="`${id}-${status}`" />
          <Label :for="`${id}-${status}`">{{ status }}</Label>
        </div>
      </div>
      <SheetFooter>
        <SheetClose as-child>
          <Button>Terapkan</Button>
        </SheetClose>
      </SheetFooter>
    </SheetContent>
  </Sheet>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const statuses = ['Terbit', 'Menunggu', 'Ditolak'];

class SheetDemo extends StatelessWidget {
  const SheetDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadButton.outline(
      child: const Text('Filter'),
      onPressed: () => showShadSheet(
        context: context,
        side: ShadSheetSide.right,
        builder: (context) => ShadSheet(
          constraints: const BoxConstraints(maxWidth: 384),
          title: const Text('Filter rilis'),
          description: const Text('Tampilkan rilis dengan status yang kamu pilih.'),
          actions: [ShadButton(child: const Text('Terapkan'), onPressed: () => Navigator.of(context).pop())],
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            spacing: 12,
            children: [for (final status in statuses) ShadCheckbox(value: false, label: Text(status), onChanged: (_) {})],
          ),
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/sheet.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/sheet.json
```

## Accessibility

- It is a dialog named by its title; the focus moves into it and back to the trigger when it closes.
- Escape and the close button close it.
- The page behind it can't be reached until it closes.


---

# Drawer

> A bottom sheet that slides up on phones.

A drawer is a bottom sheet: a panel that slides up from the bottom of a phone screen, for sorting, filters or a short choice.

## When to use

- Use it on phones for sorting, filters and short choices, close to the thumb.
- Use a [Sheet](https://design.sosialoka.tech/components/sheet/) from the side on the web. A web app that must also work on phones opens the Sheet from `md` up and the Drawer below it.
- Use a [Dialog](https://design.sosialoka.tech/components/dialog/) for a decision that needs the whole attention.
- Long content scrolls inside the drawer; it never covers more than 85% of the screen.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/drawer/_

## Anatomy

1. Handle
2. Bottom sheet
3. Page behind, dimmed

A 48×6px handle on top, a header with a title and one sentence of description, the content, and a footer with the main action. The panel sits on `popover` with `radius-xl` on the top corners only, a `border` on top and the `overlay` token behind it. Its bottom padding keeps clear of the phone's home indicator (`env(safe-area-inset-bottom)`).

## Variants

There is one style, from the bottom. Other edges are possible, but use a Sheet for side panels.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `open` / `onOpenChange` | `v-model:open` | `showShadSheet(side: ShadSheetSide.bottom)` | boolean | `false` | Opens it from code. |
| `showSwipeHandle` | always shown from the bottom | a 48×6 `muted` box | boolean | `true` | The drag handle. |
| `DrawerTitle`, `DrawerDescription` | same | `title`, `description` | text | none | Names the panel. |
| `DrawerFooter` | `DrawerFooter` | `actions` | element | none | The main action. |

## Code

**React**
```tsx
import { useId } from "react"
import { Button } from "@/components/ui/button"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer"
import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

const orders = [
  { value: "newest", label: "Terbaru" },
  { value: "oldest", label: "Terlama" },
  { value: "title", label: "Judul A–Z" },
]

export default function DrawerDemo() {
  const id = useId()
  return (
    <Drawer>
      <DrawerTrigger render={<Button variant="outline" />}>Urutkan</DrawerTrigger>
      <DrawerContent>
        <DrawerHeader>
          <DrawerTitle>Urutkan rilis</DrawerTitle>
          <DrawerDescription>Pilih urutan daftar rilismu.</DrawerDescription>
        </DrawerHeader>
        <RadioGroup defaultValue="newest" aria-label="Urutan" className="px-4">
          {orders.map((o) => (
            <div key={o.value} className="flex items-center gap-3">
              <RadioGroupItem value={o.value} id={`${id}-${o.value}`} />
              <Label htmlFor={`${id}-${o.value}`}>{o.label}</Label>
            </div>
          ))}
        </RadioGroup>
        <DrawerFooter>
          <DrawerClose render={<Button />}>Terapkan</DrawerClose>
        </DrawerFooter>
      </DrawerContent>
    </Drawer>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Button } from "@/components/ui/button"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer"
import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

const orders = [
  { value: "newest", label: "Terbaru" },
  { value: "oldest", label: "Terlama" },
  { value: "title", label: "Judul A–Z" },
]
const id = useId()
</script>

<template>
  <Drawer>
    <DrawerTrigger as-child>
      <Button variant="outline">Urutkan</Button>
    </DrawerTrigger>
    <DrawerContent>
      <DrawerHeader>
        <DrawerTitle>Urutkan rilis</DrawerTitle>
        <DrawerDescription>Pilih urutan daftar rilismu.</DrawerDescription>
      </DrawerHeader>
      <RadioGroup default-value="newest" aria-label="Urutan" class="px-4">
        <div v-for="o in orders" :key="o.value" class="flex items-center gap-3">
          <RadioGroupItem :id="`${id}-${o.value}`" :value="o.value" />
          <Label :for="`${id}-${o.value}`">{{ o.label }}</Label>
        </div>
      </RadioGroup>
      <DrawerFooter>
        <DrawerClose as-child>
          <Button>Terapkan</Button>
        </DrawerClose>
      </DrawerFooter>
    </DrawerContent>
  </Drawer>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const sortOrders = [('newest', 'Terbaru'), ('oldest', 'Terlama'), ('title', 'Judul A–Z')];

// A bottom sheet: the shadcn_ui sheet from the bottom edge, with a drag handle on top.
class DrawerDemo extends StatelessWidget {
  const DrawerDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadButton.outline(
      child: const Text('Urutkan'),
      onPressed: () => showShadSheet(
        context: context,
        side: ShadSheetSide.bottom,
        builder: (context) {
          final theme = ShadTheme.of(context);
          final handle = ExcludeSemantics(
            child: Center(
              child: Container(
                width: 48,
                height: 6,
                decoration: BoxDecoration(color: theme.colorScheme.muted, borderRadius: BorderRadius.circular(3)),
              ),
            ),
          );
          // draggable lets the handle swipe the sheet closed; the handle sits above the title.
          return ShadSheet(
            draggable: true,
            radius: const BorderRadius.vertical(top: Radius.circular(16)),
            title: Column(spacing: 12, children: [handle, const Text('Urutkan rilis')]),
            description: const Text('Pilih urutan daftar rilismu.'),
            actions: [ShadButton(child: const Text('Terapkan'), onPressed: () => Navigator.of(context).pop())],
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.start,
              spacing: 16,
              children: [
                ShadRadioGroup<String>(
                  initialValue: 'newest',
                  items: [for (final (value, label) in sortOrders) ShadRadio(value: value, label: Text(label))],
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/drawer.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/drawer.json
```

## Accessibility

- It is a dialog named by its title; the focus moves into it and back to the trigger when it closes.
- Dragging the handle down, Escape and a tap on the overlay close it. The handle is decoration and never takes the focus, so keep a button that closes or applies.
- The page behind it can't be reached until it closes.


---

# Popover

> Shows extra content or a small form next to its trigger.

A popover opens a small panel next to the button that opened it, for extra content or a short task that doesn't need a dialog.

## When to use

- Use it to share a link, set a quick filter, or show details about one item.
- Use a [Tooltip](https://design.sosialoka.tech/components/tooltip/) for a one-line name of an icon button, and a [Dialog](https://design.sosialoka.tech/components/dialog/) for a task that needs the whole attention.
- Use a [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/) for a list of actions.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/popover/_

## Anatomy

1. Trigger
2. Arrow
3. Content

A panel on `popover` with a `border`, `radius-lg` and `shadow-lg`, 288px wide by default, placed beside its trigger. It renders outside the page flow, so a card never clips it. A title and one sentence of description may head it.

## Variants

There is one style. Choose the side (`top`, `right`, `bottom`, `left`) and the alignment (`start`, `center`, `end`).

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `open` / `onOpenChange` | `v-model:open` | `controller` | boolean | `false` | Opens and closes it from code. |
| `side` on `PopoverContent` | `side` on `PopoverContent` | `anchor` | text | `bottom` | Which side of the trigger it opens on. |
| `align` on `PopoverContent` | `align` on `PopoverContent` | `anchor` | text | `center` | How it lines up with the trigger. |
| `PopoverTrigger render` | `PopoverTrigger as-child` | `child` | element | none | The button that opens it. |

## Code

**React**
```tsx
import { useId } from "react"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger } from "@/components/ui/popover"

export default function PopoverDemo() {
  const id = useId()
  return (
    <Popover>
      <PopoverTrigger render={<Button variant="outline" />}>Bagikan</PopoverTrigger>
      <PopoverContent>
        <PopoverHeader>
          <PopoverTitle>Bagikan rilis</PopoverTitle>
          <PopoverDescription>Siapa pun yang punya tautan ini bisa mendengarkan.</PopoverDescription>
        </PopoverHeader>
        <div className="grid gap-2">
          <Label htmlFor={`${id}-link`}>Tautan rilis</Label>
          <div className="flex gap-2">
            <Input id={`${id}-link`} readOnly defaultValue="https://contoh.id/senja-di-kota" />
            <Button>Salin</Button>
          </div>
        </div>
      </PopoverContent>
    </Popover>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"

const id = useId()
</script>

<template>
  <Popover>
    <PopoverTrigger as-child>
      <Button variant="outline">Bagikan</Button>
    </PopoverTrigger>
    <PopoverContent class="grid gap-2.5" :aria-describedby="`${id}-description`">
      <div class="grid gap-1">
        <p class="font-medium">Bagikan rilis</p>
        <p :id="`${id}-description`" class="text-muted-foreground">Siapa pun yang punya tautan ini bisa mendengarkan.</p>
      </div>
      <div class="grid gap-2">
        <Label :for="`${id}-link`">Tautan rilis</Label>
        <div class="flex gap-2">
          <Input :id="`${id}-link`" readonly default-value="https://contoh.id/senja-di-kota" />
          <Button>Salin</Button>
        </div>
      </div>
    </PopoverContent>
  </Popover>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class PopoverDemo extends StatefulWidget {
  const PopoverDemo({super.key});

  @override
  State<PopoverDemo> createState() => _PopoverDemoState();
}

class _PopoverDemoState extends State<PopoverDemo> {
  final controller = ShadPopoverController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ShadPopover(
      controller: controller,
      popover: (context) => SizedBox(
        width: 288,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          spacing: 8,
          children: [
            Text('Bagikan rilis', style: theme.textTheme.large),
            Text('Siapa pun yang punya tautan ini bisa mendengarkan.', style: theme.textTheme.muted),
            Row(
              spacing: 8,
              children: [
                const Expanded(
                  child: ShadInput(initialValue: 'https://contoh.id/senja-di-kota', readOnly: true),
                ),
                ShadButton(child: const Text('Salin'), onPressed: () {}),
              ],
            ),
          ],
        ),
      ),
      child: ShadButton.outline(onPressed: controller.toggle, child: const Text('Bagikan')),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/popover.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/popover.json
```

## Accessibility

- The panel is a dialog that takes the focus when it opens and gives it back to the trigger when it closes.
- Escape and a click outside close it.
- Give the trigger a clear name, such as "Bagikan".


---

# Dropdown Menu

> Lists actions behind one button.

A dropdown menu lists actions behind one button, such as the actions of a table row.

## When to use

- Use it when a row or card has more actions than fit as buttons.
- Put the most used action first and destructive actions last, after a separator.
- Use a [Select](https://design.sosialoka.tech/components/select/) to pick a value, not a menu.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/dropdown-menu/_

### Do and don't

- **Do:** Put a destructive item last, after a separator.
- **Don't:** Don't put a destructive item first, where a quick click lands.

## Anatomy

1. Trigger button
2. Menu on elevation-lg
3. Highlighted item
4. Destructive item, last and after a separator

A trigger, usually a ghost icon button, and a popup on `popover` with a `border`, `radius-lg` and `shadow-lg`. Items use `radius-md` and highlight with `accent`.

## Variants

Items can be `destructive` (`text-destructive`), checkboxes, radio items or sub-menus.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `DropdownMenuTrigger render` | `DropdownMenuTrigger as-child` | `child` with `controller.toggle` | element | button | The control that opens it. |
| `DropdownMenuItem variant` | `DropdownMenuItem variant` | none | `default` \| `destructive` | `default` | Marks a destructive action. |
| `onClick` on an item | `@select` on an item | `onPressed` on `ShadContextMenuItem` | function | none | Runs the action. |

## Code

**React**
```tsx
import { MoreHorizontalIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

export default function DropdownMenuDemo() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="ghost" size="icon" aria-label="Aksi" />}>
        <MoreHorizontalIcon />
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuItem>Lihat</DropdownMenuItem>
        <DropdownMenuItem>Ubah</DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { MoreHorizontal } from "@lucide/vue"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
</script>

<template>
  <DropdownMenu>
    <DropdownMenuTrigger as-child>
      <Button variant="ghost" size="icon" aria-label="Aksi"><MoreHorizontal /></Button>
    </DropdownMenuTrigger>
    <DropdownMenuContent>
      <DropdownMenuItem>Lihat</DropdownMenuItem>
      <DropdownMenuItem>Ubah</DropdownMenuItem>
      <DropdownMenuSeparator />
      <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
    </DropdownMenuContent>
  </DropdownMenu>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class DropdownMenuDemo extends StatefulWidget {
  const DropdownMenuDemo({super.key});

  @override
  State<DropdownMenuDemo> createState() => _DropdownMenuDemoState();
}

class _DropdownMenuDemoState extends State<DropdownMenuDemo> {
  final controller = ShadContextMenuController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ShadContextMenu(
      controller: controller,
      items: const [
        ShadContextMenuItem(child: Text('Lihat')),
        ShadContextMenuItem(child: Text('Ubah')),
        ShadSeparator.horizontal(margin: EdgeInsets.symmetric(vertical: 4)),
        ShadContextMenuItem(child: Text('Hapus')),
      ],
      child: ShadIconButton.ghost(
        icon: const Icon(LucideIcons.ellipsis),
        onPressed: controller.toggle,
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/dropdown-menu.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/dropdown-menu.json
```

## Accessibility

- Renders `role="menu"` and `menuitem`; arrow keys move, Enter runs, Escape closes.
- Icon-only triggers need an `aria-label`.


---

# Tooltip

> Names an icon-only control on hover or focus.

A tooltip names an icon-only control when it is hovered or focused.

## When to use

- Use it to label icon buttons, such as download or edit.
- Keep it to a few words; put longer help in the page.
- Don't put anything people need to click in a tooltip.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/tooltip/_

### Do and don't

- **Do:** Use a tooltip to name an icon-only button in a word or two.
- **Don't:** Don't hide instructions or policy in a tooltip.

## Anatomy

1. Tooltip on foreground
2. Icon-only trigger

A small label in inverse colors (`foreground` fill, `background` text) on `radius-md`, with an arrow toward the control.

## Variants

There is one style. It can appear on any side of the control.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `TooltipProvider delay` | `TooltipProvider :delay-duration` | none | number (ms) | provider default | How long before it shows. |
| `TooltipContent side` | `TooltipContent side` | `anchor` | `top` \| `right` \| `bottom` \| `left` | `top` | Where it appears. |
| `TooltipTrigger render` | `TooltipTrigger as-child` | `child` | element | button | The control it names. |

## Code

**React**
```tsx
import { DownloadIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"

export default function TooltipDemo() {
  return (
    <TooltipProvider delay={0}>
      <Tooltip>
        <TooltipTrigger render={<Button variant="outline" size="icon" aria-label="Unduh laporan" />}>
          <DownloadIcon />
        </TooltipTrigger>
        <TooltipContent>Unduh laporan</TooltipContent>
      </Tooltip>
    </TooltipProvider>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Download } from "@lucide/vue"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
</script>

<template>
  <TooltipProvider :delay-duration="0">
    <Tooltip>
      <TooltipTrigger as-child>
        <Button variant="outline" size="icon" aria-label="Unduh laporan"><Download /></Button>
      </TooltipTrigger>
      <TooltipContent>Unduh laporan</TooltipContent>
    </Tooltip>
  </TooltipProvider>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class TooltipDemo extends StatelessWidget {
  const TooltipDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadTooltip(
      builder: (context) => const Text('Unduh laporan'),
      child: ShadIconButton.outline(icon: const Icon(LucideIcons.download), onPressed: () {}),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/tooltip.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/tooltip.json
```

## Accessibility

- Shows on keyboard focus as well as hover.
- The control still needs an `aria-label`; the tooltip helps sighted people, the label helps screen readers.


---

# Toast

> Confirms an action with a short message that goes away.

A toast confirms that something happened, such as a save or a send, with a short message that goes away by itself.

## When to use

- Use it to confirm an action the person just took: "Rilis tersimpan."
- Use it for errors that are not tied to one field: "Belum bisa mengirim. Coba lagi sebentar."
- Show validation errors under their field, not in a toast; the message comes from the backend.
- Use a [Dialog](https://design.sosialoka.tech/components/dialog/) when the person must decide something.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/toast/_

### Do and don't

- **Do:** Confirm what just happened in a few words.
- **Don't:** Don't put errors, long text or decisions in a toast; it closes on its own.

## Anatomy

1. Status icon
2. Message
3. Close

A message on `popover` with a `border`, `radius-lg` and `shadow-lg`, with an icon in the status color: `success`, `info`, `warning` or `destructive`. Toasts stack in a corner and follow the page's mode.

## Variants

`toast()` for a plain message, and `toast.success`, `toast.info`, `toast.warning`, `toast.error` for a status icon.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `toast.success(message)` from `sonner` | `toast.success(message)` from `vue-sonner` | `ShadToaster.of(context).show(ShadToast(...))` | function | none | Shows a toast. |
| `<Toaster />` once in the app | `<Toaster />` once in the app | `ShadToaster` (in `ShadApp`) | element | none | Where toasts appear. |
| `position` on `Toaster` | `position` on `Toaster` | `alignment` | string | `bottom-right` | Corner of the screen. |

The Sosialoka `Toaster` reads light or dark from `data-theme` or the `.dark` class on `<html>`, so it needs no theme provider.

## Code

**React**
```tsx
import { toast } from "sonner"
import { Button } from "@/components/ui/button"
import { Toaster } from "@/components/ui/sonner"

export default function SonnerDemo() {
  return (
    <div className="flex flex-wrap gap-2">
      <Button variant="outline" onClick={() => toast.success("Rilis tersimpan.")}>
        Simpan
      </Button>
      <Button variant="outline" onClick={() => toast.error("Belum bisa mengirim. Coba lagi sebentar.")}>
        Kirim
      </Button>
      <Toaster />
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { toast } from "vue-sonner"
import { Button } from "@/components/ui/button"
import { Toaster } from "@/components/ui/sonner"
</script>

<template>
  <div class="flex flex-wrap gap-2">
    <Button variant="outline" @click="toast.success('Rilis tersimpan.')">Simpan</Button>
    <Button variant="outline" @click="toast.error('Belum bisa mengirim. Coba lagi sebentar.')">Kirim</Button>
    <Toaster />
  </div>
</template>
```

**Flutter**
```dart
// ShadApp already wraps the app in a ShadToaster.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class SonnerDemo extends StatelessWidget {
  const SonnerDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Wrap(
      spacing: 8,
      children: [
        ShadButton.outline(
          child: const Text('Simpan'),
          onPressed: () => ShadToaster.of(context).show(const ShadToast(description: Text('Rilis tersimpan.'))),
        ),
        ShadButton.outline(
          child: const Text('Kirim'),
          onPressed: () => ShadToaster.of(context).show(
            const ShadToast.destructive(description: Text('Belum bisa mengirim. Coba lagi sebentar.')),
          ),
        ),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/sonner.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/sonner.json
```

## Accessibility

- Toasts are announced politely by screen readers and don't take focus.
- Keep them short; anything people must act on belongs in the page or a dialog.


---

# Progress

> Shows how far a task with a known length has come.

A progress bar shows how far a task of known length has come, such as uploading a master file.

## When to use

- Use it for uploads, imports and other tasks that report a percentage.
- Use a [Spinner](https://design.sosialoka.tech/components/spinner/) when the length is unknown.
- Always show a label above the bar, and the percentage when it helps.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/progress/_

## Anatomy

1. Label
2. Value
3. Track
4. Indicator

A label and an optional value above an 8px (`h-2`) pill track on `muted`, filled with `primary` up to the value.

## Variants

There is one style.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `value` | `model-value` | `value` (0 to 1) | number | React: none, which makes the bar indeterminate; Vue: `0` | How far the task has come, 0 to 100 on the web. |
| `ProgressLabel` | `aria-labelledby` on a visible label | `semanticsLabel` | text | none | Names the task. |
| `ProgressValue` | text beside the label | `semanticsValue` | text | none | Shows the percentage. |

## Code

**React**
```tsx
import { Progress, ProgressLabel, ProgressValue } from "@/components/ui/progress"

export default function ProgressDemo() {
  return (
    <Progress value={64} className="w-full max-w-sm">
      <ProgressLabel>Mengunggah master.wav</ProgressLabel>
      <ProgressValue />
    </Progress>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { Progress } from "@/components/ui/progress"

const id = useId()
</script>

<template>
  <div class="grid w-full max-w-sm gap-3">
    <div class="flex text-sm">
      <span :id="`${id}-label`" class="font-medium">Mengunggah master.wav</span>
      <span class="ml-auto text-muted-foreground tabular-nums">64%</span>
    </div>
    <Progress :model-value="64" :aria-labelledby="`${id}-label`" />
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class ProgressDemo extends StatelessWidget {
  const ProgressDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 384),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        spacing: 12,
        children: [
          Row(
            children: [
              Text('Mengunggah master.wav', style: theme.textTheme.small),
              const Spacer(),
              Text('64%', style: theme.textTheme.muted),
            ],
          ),
          ShadProgress(value: 0.64, minHeight: 8, semanticsLabel: 'Mengunggah master.wav', semanticsValue: '64%'),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/progress.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/progress.json
```

## Accessibility

- It has `role="progressbar"` with `aria-valuenow`, `aria-valuemin` and `aria-valuemax`.
- Name it with its visible label.
- Don't announce every percent; say when the task is done, for example with a toast.


---

# Spinner

> Shows that something is loading or saving.

A spinner shows that a short task is running, such as saving a form or loading a list.

## When to use

- Use it inside a button while its action runs, with the button disabled and its label in the present tense ("Menyimpan…").
- Use it for a short wait with a label beside it, such as "Memuat data rilis".
- Use a [Skeleton](https://design.sosialoka.tech/components/skeleton/) when you know the shape of the content that is loading, and a [Progress](https://design.sosialoka.tech/components/progress/) bar when you know how far the task has come.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/spinner/_

## Anatomy

1. Track
2. Spinning arc

A 16px Lucide `Loader2` icon (`size-4`) turning with `animate-spin`, in the current text color.

## Variants

There is one style. Change the size with a `size-*` class, such as `size-6` for a page that is loading.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `aria-label` | `aria-label` | `label` (Semantics) | text | `Loading` | What is loading, such as "Menyimpan". |
| `className` | `class` | `SizedBox.square(dimension:)` | class | `size-4` | The size. |

## Code

**React**
```tsx
import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"

export default function SpinnerDemo() {
  return (
    <div className="flex flex-wrap items-center gap-6">
      <Button disabled>
        <Spinner aria-label="Menyimpan" />
        Menyimpan…
      </Button>
      <div className="flex items-center gap-2 text-sm text-muted-foreground">
        <Spinner aria-label="Memuat data rilis" />
        Memuat data rilis
      </div>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"
</script>

<template>
  <div class="flex flex-wrap items-center gap-6">
    <Button disabled>
      <Spinner aria-label="Menyimpan" />
      Menyimpan…
    </Button>
    <div class="flex items-center gap-2 text-sm text-muted-foreground">
      <Spinner aria-label="Memuat data rilis" />
      Memuat data rilis
    </div>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

// shadcn_ui has no spinner: a 16px CircularProgressIndicator in the primary color stands in.
class Spinner extends StatelessWidget {
  const Spinner({super.key, required this.label, this.color});

  final String label;
  final Color? color;

  @override
  Widget build(BuildContext context) {
    return Semantics(
      label: label,
      liveRegion: true,
      child: SizedBox.square(
        dimension: 16,
        child: CircularProgressIndicator(strokeWidth: 2, color: color ?? ShadTheme.of(context).colorScheme.primary),
      ),
    );
  }
}

class SpinnerDemo extends StatelessWidget {
  const SpinnerDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return Wrap(
      spacing: 24,
      runSpacing: 12,
      crossAxisAlignment: WrapCrossAlignment.center,
      children: [
        ShadButton(
          enabled: false,
          leading: Spinner(label: 'Menyimpan', color: theme.colorScheme.primaryForeground),
          child: const Text('Menyimpan…'),
        ),
        Row(
          mainAxisSize: MainAxisSize.min,
          spacing: 8,
          children: [
            const Spinner(label: 'Memuat data rilis'),
            Text('Memuat data rilis', style: theme.textTheme.muted),
          ],
        ),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/spinner.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/spinner.json
```

## Accessibility

- It has `role="status"`; give it an `aria-label` that says what is happening.
- It keeps turning when `prefers-reduced-motion` is on: the turning is the only sign that the task is still running.
- When the task ends, replace it with the result, such as a toast or the loaded list.


---

# Skeleton

> A placeholder in the shape of content that is loading.

A skeleton draws gray placeholders in the shape of the content that is loading, so the page doesn't jump when it arrives.

## When to use

- Use it when you know the shape of what is loading: rows of a list, a card, a profile.
- Use a [Spinner](https://design.sosialoka.tech/components/spinner/) for a short wait without a known shape, such as a button that saves.
- Match the real layout: the same number of rows and the same sizes, roughly.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/skeleton/_

## Anatomy

1. Shape placeholder
2. Line placeholder

Boxes on `muted` with `radius-md` and a gentle `animate-pulse`. The container that is loading carries `aria-busy="true"` and a screen-reader text such as "Memuat rilis…".

## Variants

There is one style. Shape it with size classes: `size-10` for an avatar, `h-4 w-3/4` for a line of text.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `className` | `class` | `width`, `height` on a `muted` box | class | none | The size and shape. |

## Code

**React**
```tsx
import { Skeleton } from "@/components/ui/skeleton"

export default function SkeletonDemo() {
  return (
    <div aria-busy="true" className="grid w-full max-w-sm gap-4">
      <span className="sr-only">Memuat rilis…</span>
      {[0, 1, 2].map((row) => (
        <div key={row} className="flex items-center gap-3">
          <Skeleton className="size-10" />
          <div className="grid flex-1 gap-2">
            <Skeleton className="h-4 w-3/4" />
            <Skeleton className="h-3 w-1/2" />
          </div>
        </div>
      ))}
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Skeleton } from "@/components/ui/skeleton"
</script>

<template>
  <div aria-busy="true" class="grid w-full max-w-sm gap-4">
    <span class="sr-only">Memuat rilis…</span>
    <div v-for="row in 3" :key="row" class="flex items-center gap-3">
      <Skeleton class="size-10" />
      <div class="grid flex-1 gap-2">
        <Skeleton class="h-4 w-3/4" />
        <Skeleton class="h-3 w-1/2" />
      </div>
    </div>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

// shadcn_ui has no skeleton: muted boxes with the md radius stand in, and the list says it is busy.
class Bone extends StatelessWidget {
  const Bone({super.key, required this.width, required this.height});

  final double width;
  final double height;

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return Container(
      width: width,
      height: height,
      decoration: BoxDecoration(color: theme.colorScheme.muted, borderRadius: theme.radius),
    );
  }
}

class SkeletonDemo extends StatelessWidget {
  const SkeletonDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Semantics(
      label: 'Memuat rilis…',
      child: ExcludeSemantics(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          spacing: 16,
          children: [
            for (var row = 0; row < 3; row++)
              const Row(
                mainAxisSize: MainAxisSize.min,
                spacing: 12,
                children: [
                  Bone(width: 40, height: 40),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    spacing: 8,
                    children: [Bone(width: 240, height: 16), Bone(width: 160, height: 12)],
                  ),
                ],
              ),
          ],
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/skeleton.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/skeleton.json
```

## Accessibility

- Put `aria-busy="true"` on the container that is loading and remove it when the content is in.
- Give screen readers one text for the whole placeholder, such as "Memuat rilis…", and hide the boxes from them.
- The pulse stops with `prefers-reduced-motion`.


---

# Avatar

> Shows a person or an artist as a picture or initials.

An avatar shows a person or an artist as a picture, or as initials when there is no picture.

## When to use

- Use it next to names in tables, comments and the account menu.
- Always pair it with the name in text, unless the name is right next to it.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/avatar/_

## Anatomy

1. Initials on a soft fill
2. Picture
3. Stack, with a card-colored ring

A circle (`radius-full`, the only round shape in the system) with an image, or initials on `muted` with `muted-foreground` text.

## Variants

Sizes come from the `size-*` class; the default is 32px.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `AvatarImage src alt` | `AvatarImage :src alt` | first argument of `ShadAvatar` | string | none | The picture. |
| `AvatarFallback` | `AvatarFallback` | `placeholder` | element | none | Initials while loading or without a picture. |

## Code

**React**
```tsx
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"

const portrait =
  "data:image/svg+xml;utf8," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="#cbd5e1"/><circle cx="32" cy="26" r="12" fill="#94a3b8"/><rect x="14" y="42" width="36" height="22" rx="11" fill="#94a3b8"/></svg>'
  )

export default function AvatarDemo() {
  return (
    <div className="flex items-center gap-3">
      <Avatar>
        <AvatarImage src={portrait} alt="Foto profil" />
        <AvatarFallback>RS</AvatarFallback>
      </Avatar>
      <Avatar>
        <AvatarFallback>BL</AvatarFallback>
      </Avatar>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"

const portrait =
  "data:image/svg+xml;utf8," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="#cbd5e1"/><circle cx="32" cy="26" r="12" fill="#94a3b8"/><rect x="14" y="42" width="36" height="22" rx="11" fill="#94a3b8"/></svg>',
  )
</script>

<template>
  <div class="flex items-center gap-3">
    <Avatar>
      <AvatarImage :src="portrait" alt="Foto profil" />
      <AvatarFallback>RS</AvatarFallback>
    </Avatar>
    <Avatar>
      <AvatarFallback>BL</AvatarFallback>
    </Avatar>
  </div>
</template>
```

**Flutter**
```dart
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class AvatarDemo extends StatelessWidget {
  const AvatarDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return const Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        ShadAvatar('assets/portrait.png', placeholder: Text('RS')),
        SizedBox(width: 12),
        ShadAvatar('', placeholder: Text('BL')),
      ],
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/avatar.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/avatar.json
```

## Accessibility

- Give the image an `alt` that names the person, or `alt=""` when the name is already next to it.


---

# Sidebar

> The main navigation of a dashboard.

The sidebar is the main navigation of a Sosialoka dashboard, on the left of every page.

## When to use

- Use it for the 4 to 8 main sections of a product.
- Group related items under a label when there are more than six.
- Put page-level actions in the page, not in the sidebar.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/sidebar/_

## Anatomy

1. Product logo
2. Active item
3. Search card
4. Content

This is the sidebar of the dashboard shell (Alternative A): a white panel (`sidebar`) 16rem wide, with icon and label items on `radius-md`. The active item uses `sidebar-accent` with `sidebar-accent-foreground` text, the product's soft tint. On small screens it becomes a sheet that slides in.

## Variants

- `collapsible="offcanvas"` (default): slides away on small screens.
- `collapsible="icon"`: collapses to icons.
- `collapsible="none"`: always shown, as in the preview.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `SidebarProvider` | `SidebarProvider` | none | element | none | Holds the open state; wraps the layout. |
| `collapsible` | `collapsible` | none | see Variants | `offcanvas` | How it collapses. |
| `SidebarMenuButton isActive` | `SidebarMenuButton :is-active` | `backgroundColor` from `sidebar-accent` | boolean | `false` | Marks the current section. |
| `SidebarMenuButton render` | `SidebarMenuButton as-child` | `onPressed` | element | button | Renders the item as a link. |

## Code

**React**
```tsx
import { BarChart3Icon, DiscIcon, FileTextIcon, HomeIcon, SettingsIcon } from "lucide-react"
import {
  Sidebar,
  SidebarContent,
  SidebarGroup,
  SidebarGroupContent,
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
  SidebarProvider,
} from "@/components/ui/sidebar"

const items = [
  { title: "Dasbor", icon: HomeIcon, active: true },
  { title: "Rilis", icon: DiscIcon },
  { title: "Royalti", icon: BarChart3Icon },
  { title: "Dokumen", icon: FileTextIcon },
  { title: "Pengaturan", icon: SettingsIcon },
]

export default function SidebarDemo() {
  return (
    <SidebarProvider className="min-h-0 w-auto">
      <div className="h-96 overflow-hidden rounded-lg border border-border">
        <Sidebar collapsible="none">
          <SidebarContent>
            <SidebarGroup>
              <SidebarGroupContent>
                <SidebarMenu>
                  {items.map((item) => (
                    <SidebarMenuItem key={item.title}>
                      <SidebarMenuButton
                        isActive={item.active}
                        render={<a href="#" aria-current={item.active ? "page" : undefined} />}
                      >
                        <item.icon />
                        <span>{item.title}</span>
                      </SidebarMenuButton>
                    </SidebarMenuItem>
                  ))}
                </SidebarMenu>
              </SidebarGroupContent>
            </SidebarGroup>
          </SidebarContent>
        </Sidebar>
      </div>
    </SidebarProvider>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { BarChart3, Disc, FileText, Home, Settings } from "@lucide/vue"
import {
  Sidebar,
  SidebarContent,
  SidebarGroup,
  SidebarGroupContent,
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
  SidebarProvider,
} from "@/components/ui/sidebar"

const items = [
  { title: "Dasbor", icon: Home, active: true },
  { title: "Rilis", icon: Disc },
  { title: "Royalti", icon: BarChart3 },
  { title: "Dokumen", icon: FileText },
  { title: "Pengaturan", icon: Settings },
]
</script>

<template>
  <SidebarProvider class="min-h-0 w-auto">
    <div class="h-96 overflow-hidden rounded-lg border border-border">
      <Sidebar collapsible="none">
        <SidebarContent>
          <SidebarGroup>
            <SidebarGroupContent>
              <SidebarMenu>
                <SidebarMenuItem v-for="item in items" :key="item.title">
                  <SidebarMenuButton as-child :is-active="item.active">
                    <a href="#" :aria-current="item.active ? 'page' : undefined">
                      <component :is="item.icon" />
                      <span>{{ item.title }}</span>
                    </a>
                  </SidebarMenuButton>
                </SidebarMenuItem>
              </SidebarMenu>
            </SidebarGroupContent>
          </SidebarGroup>
        </SidebarContent>
      </Sidebar>
    </div>
  </SidebarProvider>
</template>
```

**Flutter**
```dart
// shadcn_ui has no sidebar widget: build it from a Column of ShadButton.ghost items,
// and mark the active one with the primary-soft and primary-text colors of the Sosialoka theme.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const items = ['Dasbor', 'Rilis', 'Royalti', 'Dokumen', 'Pengaturan'];

class SidebarDemo extends StatelessWidget {
  const SidebarDemo({super.key, this.active = 'Dasbor'});

  final String active;

  @override
  Widget build(BuildContext context) {
    final scheme = ShadTheme.of(context).colorScheme;
    final c = context.sosialoka;
    return Container(
      width: 256,
      color: scheme.card,
      padding: const EdgeInsets.all(8),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          for (final item in items)
            ShadButton.ghost(
              mainAxisAlignment: MainAxisAlignment.start,
              backgroundColor: item == active ? c.primarySoft : null,
              foregroundColor: item == active ? c.primaryText : scheme.foreground,
              onPressed: () {},
              child: Text(item),
            ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/sidebar.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/sidebar.json
```

It also installs the Sosialoka sheet, separator, skeleton, tooltip, input and button.

## Accessibility

- Render items as links, and set `aria-current="page"` on the active one.
- The collapse button needs an `aria-label`; the sidebar can be toggled with ⌘B or Ctrl+B.


---

# Command

> Searches menus and records from the keyboard.

Command searches menus and records as you type, and powers the search in the dashboard's header card.

## When to use

- Use it for a global search over menus and records, opened with ⌘K or Ctrl+K.
- Use an [Input](https://design.sosialoka.tech/components/input/) to filter one table.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/command/_

## Search card

A page without the dashboard frame can use a floating search card on its own: a card (`rounded-lg border border-border bg-card shadow-md`) that looks like a search field and opens the command palette in a dialog. Inside the [Dashboard](https://design.sosialoka.tech/patterns/dashboard/) frame, the search sits in the header card instead.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/components/command/_

**React**
```tsx
import * as React from "react"
import { SearchIcon } from "lucide-react"
import {
  Command,
  CommandDialog,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/components/ui/command"

/** The floating search card of the Alt A dashboard header: a card-styled trigger that opens the command palette. */
export default function SearchCardDemo() {
  const [open, setOpen] = React.useState(false)

  React.useEffect(() => {
    const onKey = (e: KeyboardEvent) => {
      if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
        // One palette per keypress: the first listener claims it, so other ⌘K handlers stay closed.
        if (e.defaultPrevented) return
        e.preventDefault()
        e.stopPropagation()
        setOpen((o) => !o)
      }
    }
    document.addEventListener("keydown", onKey)
    return () => document.removeEventListener("keydown", onKey)
  }, [])

  return (
    <>
      <button
        type="button"
        onClick={() => setOpen(true)}
        className="flex h-12 w-full max-w-lg items-center gap-3 rounded-lg border border-border bg-card px-4 text-left text-sm text-muted-foreground shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
      >
        <SearchIcon className="size-4" />
        <span className="flex-1">Cari rilis, artis, atau dokumen</span>
        <kbd className="rounded-sm border border-border bg-muted px-1.5 font-mono text-xs">⌘K</kbd>
      </button>
      <CommandDialog open={open} onOpenChange={setOpen}>
        {/* In Base UI, CommandDialog is only the window: the palette inside is a Command. */}
        <Command>
          <CommandInput placeholder="Cari rilis, artis, atau dokumen" />
          <CommandList>
            <CommandEmpty>Tidak ada yang cocok.</CommandEmpty>
            <CommandGroup heading="Rilis">
              <CommandItem>Senja di Kota</CommandItem>
              <CommandItem>Kaset Pertama</CommandItem>
            </CommandGroup>
            <CommandGroup heading="Menu">
              <CommandItem>Royalti</CommandItem>
              <CommandItem>Dokumen</CommandItem>
            </CommandGroup>
          </CommandList>
        </Command>
      </CommandDialog>
    </>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Search } from "@lucide/vue"
import { onBeforeUnmount, onMounted, ref } from "vue"
import {
  CommandDialog,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/components/ui/command"

/** The floating search card of the Alt A dashboard header: a card-styled trigger that opens the command palette. */
const open = ref(false)
const onKey = (e: KeyboardEvent) => {
  if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
    // One palette per keypress: the first listener claims it, so other ⌘K handlers stay closed.
    if (e.defaultPrevented) return
    e.preventDefault()
    e.stopPropagation()
    open.value = !open.value
  }
}
onMounted(() => document.addEventListener("keydown", onKey))
onBeforeUnmount(() => document.removeEventListener("keydown", onKey))
</script>

<template>
  <button
    type="button"
    class="flex h-12 w-full max-w-lg items-center gap-3 rounded-lg border border-border bg-card px-4 text-left text-sm text-muted-foreground shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
    @click="open = true"
  >
    <Search class="size-4" />
    <span class="flex-1">Cari rilis, artis, atau dokumen</span>
    <kbd class="rounded-sm border border-border bg-muted px-1.5 font-mono text-xs">⌘K</kbd>
  </button>
  <CommandDialog v-model:open="open">
    <CommandInput placeholder="Cari rilis, artis, atau dokumen" />
    <CommandList>
      <CommandEmpty>Tidak ada yang cocok.</CommandEmpty>
      <CommandGroup heading="Rilis">
        <CommandItem value="senja">Senja di Kota</CommandItem>
        <CommandItem value="kaset">Kaset Pertama</CommandItem>
      </CommandGroup>
      <CommandGroup heading="Menu">
        <CommandItem value="royalti">Royalti</CommandItem>
        <CommandItem value="dokumen">Dokumen</CommandItem>
      </CommandGroup>
    </CommandList>
  </CommandDialog>
</template>
```

**Flutter**
```dart
// The floating search card of the dashboard header. It opens a search sheet built like CommandDemo.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class SearchCardDemo extends StatelessWidget {
  const SearchCardDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ShadCard(
      width: 512,
      padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
      child: ShadInput(
        placeholder: const Text('Cari rilis, artis, atau dokumen'),
        leading: const Icon(LucideIcons.search, size: 16),
        readOnly: true,
        onPressed: () => showShadSheet(
          context: context,
          side: ShadSheetSide.top,
          builder: (context) => const ShadSheet(title: Text('Cari'), child: SizedBox(height: 240)),
        ),
      ),
    );
  }
}
```

## Anatomy

1. Search field
2. Group heading
3. Highlighted result
4. Keyboard shortcut

A search input with a `border` line under it, then groups of items. Items use `radius-md` and the highlighted item uses `accent`. In a dialog the window uses `radius-xl`; inline, the list sits on `radius-lg`.

## Variants

Inline (`Command`) or in a dialog (`CommandDialog`).

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `CommandDialog open onOpenChange` | `CommandDialog v-model:open` | `showShadSheet` | boolean | `false` | Opens the palette. In React, put a `Command` inside it; in Vue it is built in. |
| `CommandInput placeholder` | `CommandInput placeholder` | `ShadInput placeholder` | string | none | What to search for. |
| `CommandItem onSelect` | `CommandItem @select` | `onPressed` | function | none | Runs when an item is chosen. |
| `CommandEmpty` | `CommandEmpty` | empty-state text | element | none | Shown when nothing matches. |

## Code

**React**
```tsx
import { BarChart3Icon, DiscIcon, FileTextIcon, SettingsIcon } from "lucide-react"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandShortcut,
} from "@/components/ui/command"

export default function CommandDemo() {
  return (
    <Command className="w-full max-w-sm border border-border shadow-md">
      <CommandInput placeholder="Cari menu atau rilis" />
      <CommandList>
        <CommandEmpty>Tidak ada yang cocok.</CommandEmpty>
        <CommandGroup heading="Menu">
          <CommandItem>
            <DiscIcon />
            Rilis
          </CommandItem>
          <CommandItem>
            <BarChart3Icon />
            Royalti
          </CommandItem>
          <CommandItem>
            <FileTextIcon />
            Dokumen
          </CommandItem>
          <CommandItem>
            <SettingsIcon />
            Pengaturan
            <CommandShortcut>⌘,</CommandShortcut>
          </CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { BarChart3, Disc, FileText, Settings } from "@lucide/vue"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandShortcut,
} from "@/components/ui/command"
</script>

<template>
  <Command class="w-full max-w-sm border border-border shadow-md">
    <CommandInput placeholder="Cari menu atau rilis" />
    <CommandList>
      <CommandEmpty>Tidak ada yang cocok.</CommandEmpty>
      <CommandGroup heading="Menu">
        <CommandItem value="rilis"><Disc />Rilis</CommandItem>
        <CommandItem value="royalti"><BarChart3 />Royalti</CommandItem>
        <CommandItem value="dokumen"><FileText />Dokumen</CommandItem>
        <CommandItem value="pengaturan"><Settings />Pengaturan<CommandShortcut>⌘,</CommandShortcut></CommandItem>
      </CommandGroup>
    </CommandList>
  </Command>
</template>
```

**Flutter**
```dart
// shadcn_ui has no command palette: filter a list under a ShadInput.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const menu = ['Rilis', 'Royalti', 'Dokumen', 'Pengaturan'];

class CommandDemo extends StatefulWidget {
  const CommandDemo({super.key});

  @override
  State<CommandDemo> createState() => _CommandDemoState();
}

class _CommandDemoState extends State<CommandDemo> {
  String query = '';

  @override
  Widget build(BuildContext context) {
    final matches = menu.where((m) => m.toLowerCase().contains(query.toLowerCase()));
    return ShadCard(
      width: 384,
      padding: const EdgeInsets.all(4),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          ShadInput(
            placeholder: const Text('Cari menu atau rilis'),
            leading: const Icon(LucideIcons.search, size: 16),
            onChanged: (v) => setState(() => query = v),
          ),
          for (final m in matches) ShadButton.ghost(mainAxisAlignment: MainAxisAlignment.start, onPressed: () {}, child: Text(m)),
          if (matches.isEmpty) const Padding(padding: EdgeInsets.all(12), child: Text('Tidak ada yang cocok.')),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/command.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/command.json
```

## Accessibility

- Arrow keys move through items, Enter chooses, Escape closes the dialog.
- Show the shortcut (⌘K) on the search card so people find it.


---

# Login

> The sign-in page. A brand hero of chapters sits beside the form, which is signed "from Sosialoka".

Every Sosialoka product signs people in on the same page, which makes it the first place they see that the products are one family. The left side tells the product's story in short chapters. The right side holds the form, and the form is the same in every product.

## When to use

- Use it for sign in, sign up and password reset in a web app.
- Keep each product's own chapters, art and logo. Don't change the form layout or the footer.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/login/_

## Anatomy

1. **Hero** (from `lg` up): autoplaying chapters on `brand-ground`. Each chapter has art, a title in the brand display font and one lead sentence. Progress bars and a pause button sit at the bottom.
2. **Form**: the product logo, a heading, the fields and one primary action.
3. **Footer**: "from [mark] Sosialoka" under the form.

## Rules

- **Columns:** the hero is hidden below `lg`. It takes half the page at `lg` and two thirds at `xl`.
- **One primary action:** the submit button ("Masuk"). "Forgot password" and "Sign up" are links.
- **Copy:** a chapter title is one idea in about eight words. The lead is one sentence. Write Indonesian copy with "kamu", as everywhere in Sosialoka.
- **Color:** the hero uses `brand-ground` and `brand-ground-foreground`. Token tests check that pair for 4.5:1 contrast. A chapter that sets its own `ground` must also set an `ink` that passes 4.5:1 on it.
- **Mark:** pass the Sosialoka mark as `markSrc`. Download it from [Brand](https://design.sosialoka.tech/brand/).

### Motion

| What | Duration | Easing |
| --- | --- | --- |
| A chapter on screen | `duration-chapter` (7 s) | linear progress bar |
| Next chapter rises as a sheet | `duration-sheet` (1050 ms) | `ease-in-out` |
| Title words rise one by one | 900 ms, from 420 ms + 40 ms per word | `ease-expo` |
| Lead fades in | `duration-slow` (700 ms), from 780 ms | `ease-standard` |

- The next chapter starts when the active progress bar finishes, so anything that pauses the bar holds the chapter.
- Hover or focus inside the hero holds only the chapter being read.
- The pause button and a hidden browser tab stop every animation in the hero.
- With `prefers-reduced-motion`, the movement stops but chapters still change, with a short fade.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `slides` | `slides` | `_LoginHero` | `{ title, lead, art?, ground?, ink? }[]` | none | The chapters. In Vue, art comes from the `art` slot (`{ slide, index }`). |
| `logo` | `#logo` slot | widget | element | none | The product logo above the form. |
| `markSrc` | `mark-src` | `Image` | string | none | The Sosialoka mark in the footer. |
| `labels` | `labels` | `Text` | `{ hero, pause, play, chapter, from }` | English | Text for screen readers and the footer. `chapter` takes `{n}` and `{title}`. The example passes Indonesian. |
| `children` | default slot | `_LoginForm` | element | none | The form. |

## Code

**React**
```tsx
import { CheckIcon, DiscIcon, LinkIcon, PenLineIcon } from "lucide-react"
import { LoginSplit, type LoginSlide } from "@/components/blocks/login-split"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

/** A chapter illustration: a small product card drawn with tokens. */
function Scene({ icon: Icon, title, meta }: { icon: typeof DiscIcon; title: string; meta: string }) {
  return (
    <div className="flex w-72 items-center gap-3 rounded-xl bg-card p-4 text-card-foreground shadow-lg">
      <span className="grid size-10 place-items-center rounded-lg bg-primary-soft text-primary-text">
        <Icon className="size-5" />
      </span>
      <span className="grid gap-0.5">
        <span className="text-sm font-semibold">{title}</span>
        <span className="text-xs text-muted-foreground">{meta}</span>
      </span>
    </div>
  )
}

const slides: LoginSlide[] = [
  {
    title: "Rilis musikmu ke seluruh dunia.",
    lead: "Kirim lagu ke layanan streaming dari satu tempat.",
    art: <Scene icon={DiscIcon} title="Senja di Kota" meta="Terkirim ke 32 platform" />,
  },
  {
    title: "Cover lagu favoritmu tanpa takut copyright strike.",
    lead: "Kami urus izinnya, kamu fokus berkarya.",
    art: <Scene icon={CheckIcon} title="Izin cover disetujui" meta="Kaset Pertama · 2 menit lalu" />,
  },
  {
    title: "Tanda tangan dokumen di mana saja.",
    lead: "Kirim, tanda tangani, dan simpan perjanjian secara online.",
    art: <Scene icon={PenLineIcon} title="Perjanjian rilis" meta="Ditandatangani 2 dari 2 pihak" />,
  },
  {
    title: "Semua link musikmu di satu tempat.",
    lead: "Satu halaman untuk lagu, video, dan jadwal manggungmu.",
    art: <Scene icon={LinkIcon} title="Halaman artis" meta="1.204 kunjungan minggu ini" />,
  },
]

export default function LoginSplitDemo() {
  return (
    <LoginSplit
      slides={slides}
      markSrc="/brand/sosialoka.png"
      labels={{ hero: "Sorotan produk", pause: "Jeda", play: "Putar", chapter: "Bab {n}: {title}" }}
      logo={
        <span className="flex items-center gap-2 font-semibold">
          <span className="size-7 rounded-md bg-primary" />
          Produkmu
        </span>
      }
    >
      <form className="grid gap-6" onSubmit={(e) => e.preventDefault()}>
        <div className="grid gap-1">
          <h1 className="text-2xl font-semibold">Masuk ke akunmu</h1>
          <p className="text-sm text-muted-foreground">Senang ketemu lagi.</p>
        </div>
        <div className="grid gap-2">
          <Label htmlFor="login-email">Email</Label>
          <Input id="login-email" type="email" autoComplete="email" />
        </div>
        <div className="grid gap-2">
          <div className="flex items-center justify-between">
            <Label htmlFor="login-password">Kata sandi</Label>
            <a href="#" className="text-sm text-primary-text underline-offset-4 hover:underline">
              Lupa kata sandi?
            </a>
          </div>
          <Input id="login-password" type="password" autoComplete="current-password" />
        </div>
        <Button type="submit" className="w-full">
          Masuk
        </Button>
        <p className="text-center text-sm text-muted-foreground">
          Belum punya akun?{" "}
          <a href="#" className="font-medium text-primary-text underline-offset-4 hover:underline">
            Daftar
          </a>
        </p>
      </form>
    </LoginSplit>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Check, Disc, Link, PenLine } from "@lucide/vue"
import { LoginSplit, type LoginSlide } from "@/components/blocks/login-split"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

/** Each chapter's illustration: a small product card drawn with tokens. */
const scenes = [
  { icon: Disc, title: "Senja di Kota", meta: "Terkirim ke 32 platform" },
  { icon: Check, title: "Izin cover disetujui", meta: "Kaset Pertama · 2 menit lalu" },
  { icon: PenLine, title: "Perjanjian rilis", meta: "Ditandatangani 2 dari 2 pihak" },
  { icon: Link, title: "Halaman artis", meta: "1.204 kunjungan minggu ini" },
]

const slides: LoginSlide[] = [
  { title: "Rilis musikmu ke seluruh dunia.", lead: "Kirim lagu ke layanan streaming dari satu tempat." },
  { title: "Cover lagu favoritmu tanpa takut copyright strike.", lead: "Kami urus izinnya, kamu fokus berkarya." },
  { title: "Tanda tangan dokumen di mana saja.", lead: "Kirim, tanda tangani, dan simpan perjanjian secara online." },
  { title: "Semua link musikmu di satu tempat.", lead: "Satu halaman untuk lagu, video, dan jadwal manggungmu." },
]
const labels = { hero: "Sorotan produk", pause: "Jeda", play: "Putar", chapter: "Bab {n}: {title}" }
</script>

<template>
  <LoginSplit :slides="slides" mark-src="/brand/sosialoka.png" :labels="labels">
    <template #logo>
      <span class="flex items-center gap-2 font-semibold">
        <span class="size-7 rounded-md bg-primary" />
        Produkmu
      </span>
    </template>

    <template #art="{ index }">
      <div class="flex w-72 items-center gap-3 rounded-xl bg-card p-4 text-card-foreground shadow-lg">
        <span class="grid size-10 place-items-center rounded-lg bg-primary-soft text-primary-text">
          <component :is="scenes[index]!.icon" class="size-5" />
        </span>
        <span class="grid gap-0.5">
          <span class="text-sm font-semibold">{{ scenes[index]!.title }}</span>
          <span class="text-xs text-muted-foreground">{{ scenes[index]!.meta }}</span>
        </span>
      </div>
    </template>

    <form class="grid gap-6" @submit.prevent>
      <div class="grid gap-1">
        <h1 class="text-2xl font-semibold">Masuk ke akunmu</h1>
        <p class="text-sm text-muted-foreground">Senang ketemu lagi.</p>
      </div>
      <div class="grid gap-2">
        <Label for="login-email-vue">Email</Label>
        <Input id="login-email-vue" type="email" autocomplete="email" />
      </div>
      <div class="grid gap-2">
        <div class="flex items-center justify-between">
          <Label for="login-password-vue">Kata sandi</Label>
          <a href="#" class="text-sm text-primary-text underline-offset-4 hover:underline">Lupa kata sandi?</a>
        </div>
        <Input id="login-password-vue" type="password" autocomplete="current-password" />
      </div>
      <Button type="submit" class="w-full">Masuk</Button>
      <p class="text-center text-sm text-muted-foreground">
        Belum punya akun?
        <a href="#" class="font-medium text-primary-text underline-offset-4 hover:underline">Daftar</a>
      </p>
    </form>
  </LoginSplit>
</template>
```

**Flutter**
```dart
// Flutter has no registry blocks: build the login pattern from widgets with the Sosialoka theme.
// The hero sits beside the form only on wide screens (from 1024 logical px, like lg on the web);
// on phones the form stands alone. Colors come from brand-ground and brand-ground-foreground.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class LoginSplitDemo extends StatelessWidget {
  const LoginSplitDemo({super.key, this.heroFrom = 1024, this.height = 560});

  /// The narrowest width that shows the hero.
  final double heroFrom;
  final double height;

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: height,
      child: LayoutBuilder(
        builder: (context, constraints) {
          final form = _LoginForm();
          if (constraints.maxWidth < heroFrom) return form;
          return Row(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              const Expanded(child: _LoginHero()),
              Expanded(child: form),
            ],
          );
        },
      ),
    );
  }
}

class _LoginHero extends StatelessWidget {
  const _LoginHero();

  @override
  Widget build(BuildContext context) {
    final c = context.sosialoka;
    final text = ShadTheme.of(context).textTheme;
    return ColoredBox(
      color: c.brandGround,
      child: Padding(
        padding: const EdgeInsets.all(48),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            Text('Rilis musikmu ke seluruh dunia.', style: text.h1Large.copyWith(color: c.brandGroundForeground)),
            const SizedBox(height: 16),
            Text(
              'Kirim lagu ke layanan streaming dari satu tempat.',
              style: text.large.copyWith(color: c.brandGroundForeground),
            ),
          ],
        ),
      ),
    );
  }
}

class _LoginForm extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return Padding(
      padding: const EdgeInsets.all(24),
      child: Column(
        children: [
          Expanded(
            child: Center(
              child: ConstrainedBox(
                constraints: const BoxConstraints(maxWidth: 384),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.stretch,
                  children: [
                    Text('Masuk ke akunmu', style: theme.textTheme.h3),
                    const SizedBox(height: 24),
                    ShadInputFormField(
                      id: 'email',
                      label: const Text('Email'),
                      keyboardType: TextInputType.emailAddress,
                    ),
                    const SizedBox(height: 16),
                    ShadInputFormField(id: 'password', label: const Text('Kata sandi'), obscureText: true),
                    const SizedBox(height: 24),
                    ShadButton(onPressed: () {}, child: const Text('Masuk')),
                    ShadButton.link(onPressed: () {}, child: const Text('Lupa kata sandi?')),
                  ],
                ),
              ),
            ),
          ),
          Text('from Sosialoka', style: theme.textTheme.muted),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/login-split.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/login-split.json
```

The block lands in `components/blocks/`. It brings its own keyframes, so you don't need any global CSS.

## Flutter

Flutter has no blocks. The Flutter code builds the same page from widgets. Show the hero only from 1024 logical pixels, so on phones the form stands alone. The chapter motion is optional in Flutter. A single still chapter is fine.

## Accessibility

- The hero is a carousel (`aria-roledescription="carousel"`). Each chapter bar is a button named "Bab 1: …", and the active one has `aria-current`.
- The whole title is read once. The animated words are hidden from screen readers.
- The pause button uses `aria-pressed`, and its name switches between "Pause" and "Play" (`labels.pause` and `labels.play`).


---

# Dashboard

> The dashboard frame. It has a white sidebar, a floating header card with the search, icon actions and the account, and the content area.

The dashboard frame is the second place where every Sosialoka product looks like one family (Alternative A). The menu, search and account sit in the same place in every product, so people who use more than one product never have to look for them.

## When to use

- Use it for every signed-in page of a web app.
- Put lists, details and forms inside it. Don't build a second header or a second sidebar.

### Do and don't

- **Do:** Keep header actions to icons, each named by a tooltip, with the avatar last.
- **Don't:** Don't fill the header with text buttons; they push the search aside and crowd small screens.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/dashboard/_

## Anatomy

1. Sidebar with the product logo
2. Header card, floating over a blur
3. Search: opens the command palette
4. Language code dropdown, then icon actions with tooltips
5. Avatar and account menu, always last
6. Content on background

- **Sidebar:** 16rem on the white `sidebar` surface, with the product logo on top. The active item uses `sidebar-accent` and has `aria-current="page"`.
- **Header card:** one card, 56px tall (`h-14 rounded-lg border-border bg-card shadow-md`), that stays at the top while the page scrolls under a blur. It holds the search, the icon actions and the avatar, as the Cover Clearance header does.
- **Search:** fills the card's left side without a box of its own and opens the command palette. ⌘K or Ctrl+K opens it too.
- **Actions:** the language as an outlined pill with its code, then 36px ghost icon buttons in `muted-foreground`, each named by a tooltip.
- **Account:** the avatar, always last, opens the account menu.
- **Content:** the page, on `background`.

## Rules

- **One search:** the card and ⌘K open the same palette. The block listens for ⌘K once per page, so it never opens a second palette over a search card from [Command](https://design.sosialoka.tech/components/command/).
- **Menu:** use five to seven items with icons. Settings go last. A product with more pages follows [Navigation menu](https://design.sosialoka.tech/patterns/navigation-menu/).
- **Actions:** the language first, then at most three icon actions in this order: mode, help, notifications. Build the mode with `DashboardModeSelect` and the others with `DashboardIconButton`, whose `label` becomes its tooltip and name.
- **Mode:** `DashboardModeSelect`, a menu of Light, Dark and Auto. **Auto follows the device's setting and is where new users start.** While on Auto, the page switches along when the device does, with no reload. The icon shows the pick (sun, moon, or monitor for Auto) and the tooltip names it, such as "Mode: Auto". `useColorMode()` sets `data-theme` on `<html>` and remembers the pick; set the same mode in an inline `<head>` script so the page doesn't flash. Flutter: `ThemeMode.light`, `ThemeMode.dark` and `ThemeMode.system` (Auto).
- **Language:** `DashboardLanguageSelect`, as in Lokasign: an outlined dropdown trigger with the current code, "ID" or "EN", in mono and a chevron. It opens a menu of languages with the current one marked. It is a pill (`rounded-full`), the one pill in the header, and stays a menu so more languages can join.
- **Notifications:** `badge` shows the unread count; leave it out at zero. The bell opens the panel from [Notifications](https://design.sosialoka.tech/patterns/notifications/).
- **Account menu:** show the name and one detail line, then the actions. "Keluar" goes last as a destructive item.
- **Small screens:** below `md` the sidebar becomes a sheet that opens from the menu button.
- **Preview frames:** `collapsible="none"` keeps the sidebar in the page flow, such as inside a frame on a docs page.

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `nav` | `nav` | `ShadButton.ghost` list | pages, parents or sections | none | The menu. For sections, sub menus and counts, see [Navigation menu](https://design.sosialoka.tech/patterns/navigation-menu/). |
| `logo` | `#logo` slot | widget | element | none | The product logo at the top of the sidebar. |
| `account` | `account` | `ShadAvatar` | `{ name, initials, detail?, menu }` | none | The avatar and its menu. A menu item can set `onSelect` and `destructive`. |
| `actions` | `#actions` slot | `ShadButton.outline` and `ShadIconButton.ghost` in a `ShadTooltip` | elements | none | Actions between the search and the avatar: `DashboardLanguageSelect` (`value`, `options`, `onValueChange`, `label`; Vue `v-model`), `DashboardModeSelect` (`value`, `onValueChange`, `labels`; Vue `v-model`) with `useColorMode(storageKey?)`, then `DashboardIconButton` (`label`, `badge?`, the icon as its child). |
| `search` | `search` | `ShadInput` in a `ShadCard` | `{ groups: { heading, items }[] }` | none | What the palette lists. An item runs its `onSelect`. |
| `collapsible` | `collapsible` | none | `offcanvas`, `icon`, `none` | `offcanvas` | How the sidebar collapses. |
| `labels` | `labels` | `Text` | `{ search, empty, account, menu }` | English | Text for the search card, the palette and screen readers. The example passes Indonesian. |
| `children` | default slot | `Expanded` child | element | none | The page content. |

## Code

**React**
```tsx
import { useState } from "react"
import { BarChart3Icon, BellIcon, DiscIcon, FileTextIcon, HomeIcon, SettingsIcon } from "lucide-react"
import {
  DashboardIconButton,
  DashboardLanguageSelect,
  DashboardModeSelect,
  DashboardShell,
  useColorMode,
} from "@/components/blocks/dashboard-shell"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"

const nav = [
  { title: "Dasbor", href: "#", icon: HomeIcon, active: true },
  { title: "Rilis", href: "#rilis", icon: DiscIcon },
  { title: "Royalti", href: "#royalti", icon: BarChart3Icon },
  { title: "Dokumen", href: "#dokumen", icon: FileTextIcon },
  { title: "Pengaturan", href: "#pengaturan", icon: SettingsIcon },
]

const stats = [
  { label: "Rilis aktif", value: "24" },
  { label: "Streaming bulan ini", value: "182.430" },
  { label: "Royalti bulan ini", value: "Rp4.812.500,00" },
]

export default function DashboardShellDemo() {
  const [mode, setMode] = useColorMode()
  const [language, setLanguage] = useState("id")
  return (
    <DashboardShell
      nav={nav}
      actions={
        <>
          <DashboardLanguageSelect
            label="Bahasa"
            value={language}
            onValueChange={setLanguage}
            options={[
              { code: "id", label: "Bahasa Indonesia" },
              { code: "en", label: "English" },
            ]}
          />
          <DashboardModeSelect
            value={mode}
            onValueChange={setMode}
            labels={{ mode: "Mode", light: "Terang", dark: "Gelap", auto: "Auto" }}
          />
          <DashboardIconButton label="Notifikasi" badge={3}>
            <BellIcon />
          </DashboardIconButton>
        </>
      }
      labels={{ search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }}
      logo={
        <span className="flex items-center gap-2 font-semibold">
          <span className="size-7 rounded-md bg-primary" />
          Produkmu
        </span>
      }
      account={{
        name: "Raka Pratama",
        initials: "RP",
        detail: "raka@contoh.id",
        menu: [{ label: "Profil" }, { label: "Pengaturan akun" }, { label: "Keluar", destructive: true }],
      }}
      search={{
        groups: [
          { heading: "Rilis", items: [{ label: "Senja di Kota" }, { label: "Kaset Pertama" }] },
          { heading: "Menu", items: nav.map((item) => ({ label: item.title })) },
        ],
      }}
    >
      <h1 className="text-2xl font-semibold">Dasbor</h1>
      <p className="mt-1 text-sm text-muted-foreground">Ringkasan katalogmu minggu ini.</p>
      <div className="mt-6 grid gap-4 sm:grid-cols-3">
        {stats.map((stat) => (
          <Card key={stat.label}>
            <CardHeader>
              <CardDescription>{stat.label}</CardDescription>
              <CardTitle className="text-2xl tabular-nums">{stat.value}</CardTitle>
            </CardHeader>
          </Card>
        ))}
      </div>
    </DashboardShell>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { BarChart3, Bell, Disc, FileText, Home, Settings } from "@lucide/vue"
import { ref } from "vue"
import {
  DashboardIconButton,
  DashboardLanguageSelect,
  DashboardModeSelect,
  DashboardShell,
  useColorMode,
} from "@/components/blocks/dashboard-shell"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"

const nav = [
  { title: "Dasbor", href: "#", icon: Home, active: true },
  { title: "Rilis", href: "#rilis", icon: Disc },
  { title: "Royalti", href: "#royalti", icon: BarChart3 },
  { title: "Dokumen", href: "#dokumen", icon: FileText },
  { title: "Pengaturan", href: "#pengaturan", icon: Settings },
]

const stats = [
  { label: "Rilis aktif", value: "24" },
  { label: "Streaming bulan ini", value: "182.430" },
  { label: "Royalti bulan ini", value: "Rp4.812.500,00" },
]

const account = {
  name: "Raka Pratama",
  initials: "RP",
  detail: "raka@contoh.id",
  menu: [{ label: "Profil" }, { label: "Pengaturan akun" }, { label: "Keluar", destructive: true }],
}

const search = {
  groups: [
    { heading: "Rilis", items: [{ label: "Senja di Kota" }, { label: "Kaset Pertama" }] },
    { heading: "Menu", items: nav.map((item) => ({ label: item.title })) },
  ],
}
const mode = useColorMode()
const modeLabels = { mode: "Mode", light: "Terang", dark: "Gelap", auto: "Auto" }
const language = ref("id")
const languages = [
  { code: "id", label: "Bahasa Indonesia" },
  { code: "en", label: "English" },
]
const labels = { search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }
</script>

<template>
  <DashboardShell :nav="nav" :account="account" :search="search" :labels="labels">
    <template #logo>
      <span class="flex items-center gap-2 font-semibold">
        <span class="size-7 rounded-md bg-primary" />
        Produkmu
      </span>
    </template>
    <template #actions>
      <DashboardLanguageSelect v-model="language" label="Bahasa" :options="languages" />
      <DashboardModeSelect v-model="mode" :labels="modeLabels" />
      <DashboardIconButton label="Notifikasi" :badge="3">
        <Bell />
      </DashboardIconButton>
    </template>

    <h1 class="text-2xl font-semibold">Dasbor</h1>
    <p class="mt-1 text-sm text-muted-foreground">Ringkasan katalogmu minggu ini.</p>
    <div class="mt-6 grid gap-4 sm:grid-cols-3">
      <Card v-for="stat in stats" :key="stat.label">
        <CardHeader>
          <CardDescription>{{ stat.label }}</CardDescription>
          <CardTitle class="text-2xl tabular-nums">{{ stat.value }}</CardTitle>
        </CardHeader>
      </Card>
    </div>
  </DashboardShell>
</template>
```

**Flutter**
```dart
// Flutter has no registry blocks: build the dashboard frame (Alt A) from widgets with the Sosialoka theme.
// A white sidebar, then the floating header card: the search, the language (code + chevron), the mode menu
// (Terang, Gelap, Auto = ThemeMode.system), notifications and the account avatar last. Every icon action has a
// tooltip that names it. Give the app's `themeMode` the picked mode and save it; new users start on Auto.
// On narrow screens, move the menu into a sheet opened from a menu button.
import 'package:flutter/material.dart' show ThemeMode;
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _menu = ['Dasbor', 'Rilis', 'Royalti', 'Dokumen', 'Pengaturan'];
const _stats = [('Rilis aktif', '24'), ('Streaming bulan ini', '182.430'), ('Royalti bulan ini', 'Rp4.812.500,00')];

const _modes = {
  ThemeMode.light: ('Terang', LucideIcons.sun),
  ThemeMode.dark: ('Gelap', LucideIcons.moon),
  ThemeMode.system: ('Auto', LucideIcons.monitor),
};

class DashboardShellDemo extends StatefulWidget {
  const DashboardShellDemo({super.key, this.height = 560});

  final double height;

  @override
  State<DashboardShellDemo> createState() => _DashboardShellDemoState();
}

class _DashboardShellDemoState extends State<DashboardShellDemo> {
  final _modeMenu = ShadContextMenuController();
  // In the app this comes from storage and goes to MaterialApp/ShadApp `themeMode`.
  var _mode = ThemeMode.system;

  @override
  void dispose() {
    _modeMenu.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    return SizedBox(
      height: widget.height,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          Container(
            width: 256,
            padding: const EdgeInsets.all(8),
            decoration: BoxDecoration(
              color: theme.colorScheme.card,
              border: Border(right: BorderSide(color: theme.colorScheme.border)),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                for (final item in _menu)
                  ShadButton.ghost(
                    mainAxisAlignment: MainAxisAlignment.start,
                    backgroundColor: item == 'Dasbor' ? c.primarySoft : null,
                    foregroundColor: item == 'Dasbor' ? c.primaryText : theme.colorScheme.foreground,
                    onPressed: () {},
                    child: Text(item),
                  ),
              ],
            ),
          ),
          Expanded(
            child: ColoredBox(
              color: theme.colorScheme.background,
              child: Padding(
                padding: const EdgeInsets.all(24),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ShadCard(
                      padding: const EdgeInsets.symmetric(horizontal: 8),
                      child: SizedBox(
                        height: 54,
                        child: Row(
                          children: [
                            Expanded(
                              child: ShadInput(
                                placeholder: const Text('Cari rilis, artis, atau dokumen'),
                                leading: const Icon(LucideIcons.search, size: 16),
                                decoration: const ShadDecoration(border: ShadBorder.none, focusedBorder: ShadBorder.none),
                                readOnly: true,
                                onPressed: () {},
                              ),
                            ),
                            // Language first, as in Lokasign: the current code with a chevron, opening a menu of languages.
                            ShadButton.outline(
                              height: 36,
                              decoration: const ShadDecoration(border: ShadBorder(radius: BorderRadius.all(Radius.circular(18)))),
                              padding: const EdgeInsets.only(left: 12, right: 8),
                              onPressed: () {},
                              trailing: Icon(LucideIcons.chevronDown, size: 14, color: theme.colorScheme.mutedForeground),
                              child: Text('ID', style: TextStyle(fontFamily: theme.textTheme.family, fontFeatures: const [FontFeature.tabularFigures()], fontSize: 12, fontWeight: FontWeight.w500)),
                            ),
                            const SizedBox(width: 4),
                            ShadContextMenu(
                              controller: _modeMenu,
                              items: [
                                for (final MapEntry(key: mode, value: (label, icon)) in _modes.entries)
                                  ShadContextMenuItem(
                                    leading: Icon(icon, size: 16),
                                    trailing: mode == _mode ? const Icon(LucideIcons.check, size: 16) : null,
                                    onPressed: () {
                                      setState(() => _mode = mode);
                                      _modeMenu.hide();
                                    },
                                    child: Text(label),
                                  ),
                              ],
                              child: ShadTooltip(
                                builder: (context) => Text('Mode: ${_modes[_mode]!.$1}'),
                                child: ShadIconButton.ghost(icon: Icon(_modes[_mode]!.$2, size: 18), onPressed: _modeMenu.toggle),
                              ),
                            ),
                            ShadTooltip(
                              builder: (context) => const Text('Notifikasi'),
                              child: Stack(
                                clipBehavior: Clip.none,
                                children: [
                                  ShadIconButton.ghost(icon: const Icon(LucideIcons.bell, size: 18), onPressed: () {}),
                                  Positioned(
                                    top: 4,
                                    right: 4,
                                    child: Container(
                                      constraints: const BoxConstraints(minWidth: 16),
                                      height: 16,
                                      alignment: Alignment.center,
                                      decoration: BoxDecoration(color: theme.colorScheme.destructive, borderRadius: BorderRadius.circular(8)),
                                      child: Text('3', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: theme.colorScheme.destructiveForeground)),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            const SizedBox(width: 4),
                            const ShadAvatar('', placeholder: Text('RP'), size: Size.square(36)),
                          ],
                        ),
                      ),
                    ),
                    const SizedBox(height: 24),
                    Text('Dasbor', style: theme.textTheme.h3),
                    const SizedBox(height: 16),
                    Row(
                      children: [
                        for (final (label, value) in _stats) ...[
                          Expanded(
                            child: ShadCard(
                              description: Text(label),
                              title: Text(value, style: theme.textTheme.h4),
                            ),
                          ),
                          if (label != _stats.last.$1) const SizedBox(width: 16),
                        ],
                      ],
                    ),
                  ],
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/dashboard-shell.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/dashboard-shell.json
```

The block lands in `components/blocks/` and installs the Sosialoka Sidebar, Command, Dropdown Menu and Avatar with it.

## Flutter

Flutter has no blocks. The Flutter code builds the same frame from widgets: a sidebar column, the header card with the search, the icon actions and the avatar, and the content. On phones, move the menu into a sheet.

## Accessibility

- The active menu item has `aria-current="page"`.
- The search is a button, and its name is the search text. The ⌘K hint is shown beside it.
- Each icon action is named by its `label`, and a count is read with it, such as "Notifikasi (3)".
- The mode button is read with the current pick, such as "Mode: Auto", and the menu marks the pick as checked.
- The avatar button is named "Akun" followed by the account name.


---

# Navigation menu

> The sidebar menu of a product with many pages, with titled sections, sub menus that open in place, and counts.

Products with many pages, such as the Loka Musik admin, group the menu into titled sections and fold related pages under a parent. The menu lives in the sidebar of the [Dashboard](https://design.sosialoka.tech/patterns/dashboard/) frame; this page sets how it grows.

## When to use

- Add sections once the menu has more than about seven entries. Name each one after the work it holds, such as "Keuangan & Royalti".
- Add a parent when three or more pages belong together, such as the reports. Two related pages stay as pages.
- A product with five to seven pages keeps the plain list of the Dashboard frame.

### Do and don't

- **Do:** Keep the menu to two levels: a parent and its pages.
- **Don't:** Don't nest a sub menu in a sub menu; turn that level into tabs on the page.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/navigation-menu/_

## Anatomy

1. Section label
2. Page with a count
3. Parent, open
4. Sub menu with a guide line
5. Current page

The menu sits on the `sidebar` surface. Section labels use `muted-foreground` in `text-xs`. The current page, also inside a sub menu, uses `sidebar-accent`. A sub menu hangs from its parent on a `border` guide line.

## Rules

- **Two levels at most:** a parent and its pages. A deeper area becomes tabs inside its page.
- **A parent is not a page.** It only opens and closes its sub menu and has no `href`. When the area needs an overview, make it the first page, such as "Ringkasan".
- **Open on arrival:** a parent opens by itself when one of its pages is the current page, and its title turns semibold.
- **Open more than one:** opening a parent doesn't close the others.
- **Counts:** a badge shows how many things wait, such as open tickets. Show it on the page; on a closed parent, show the sum. Leave out zero.
- **Order:** sections run from daily work to setup: overview, operations, clients, money, then system. Settings and administration go last.
- **Icons:** first-level pages and parents have an icon; sub menu pages don't.
- **Icons only:** when the sidebar collapses to icons, a parent opens its pages in a menu beside the rail.
- **Phones:** the whole menu moves into the sheet, with the same sections and sub menus.

## Props

The Dashboard block's `nav` takes pages, parents and sections:

| Entry | Shape | Use |
| --- | --- | --- |
| Page | `{ title, href, icon?, active?, badge? }` | A page. `active` marks the current page; `badge` is a count. |
| Parent | `{ title, icon?, items, badge? }` | Opens a sub menu of pages. No `href`. |
| Section | `{ label, items }` | A titled part of the menu, holding pages and parents. |

Pass a list of sections, or a list of pages and parents for a menu without titles. Vue uses the same shapes; Flutter builds the menu from widgets.

## Code

**React**
```tsx
import {
  BuildingIcon,
  CoinsIcon,
  FileTextIcon,
  LayoutDashboardIcon,
  LifeBuoyIcon,
  MegaphoneIcon,
  MusicIcon,
  PercentIcon,
  SettingsIcon,
  ShieldIcon,
  TruckIcon,
} from "lucide-react"
import { DashboardShell, type DashboardNavSection } from "@/components/blocks/dashboard-shell"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"

// The Loka Musik admin menu: titled sections, pages, and parents that open a sub menu.
const nav: DashboardNavSection[] = [
  {
    label: "Overview & Support",
    items: [
      { title: "Dasbor", href: "#dasbor", icon: LayoutDashboardIcon },
      { title: "Tiket Support", href: "#tiket", icon: LifeBuoyIcon, badge: 3 },
      { title: "Pengumuman", href: "#pengumuman", icon: MegaphoneIcon },
    ],
  },
  {
    label: "Katalog & Operasional",
    items: [
      { title: "Pengiriman", href: "#pengiriman", icon: TruckIcon, badge: 12 },
      {
        title: "Laporan",
        icon: FileTextIcon,
        items: [
          { title: "Rilisan", href: "#laporan-rilisan" },
          { title: "Laporan Pengiriman", href: "#laporan-pengiriman" },
          { title: "Laporan Trek", href: "#laporan-trek" },
        ],
      },
    ],
  },
  {
    label: "Manajemen Klien & Artis",
    items: [
      { title: "Klien", href: "#klien", icon: BuildingIcon },
      {
        title: "Artis",
        icon: MusicIcon,
        items: [
          { title: "Artis", href: "#artis" },
          { title: "Klien Artis", href: "#klien-artis" },
          { title: "Kandidat Premium", href: "#kandidat" },
        ],
      },
    ],
  },
  {
    label: "Keuangan & Royalti",
    items: [
      {
        title: "Royalti",
        icon: CoinsIcon,
        items: [
          { title: "Ringkasan", href: "#royalti" },
          { title: "Laporan Royalti", href: "#laporan-royalti", active: true },
          { title: "Unggah Laporan", href: "#unggah" },
          { title: "Penarikan", href: "#penarikan", badge: 5 },
        ],
      },
      {
        title: "Pajak",
        icon: PercentIcon,
        items: [
          { title: "Klien PPh21", href: "#pph21" },
          { title: "Pengaturan PPh21", href: "#pph21-pengaturan" },
        ],
      },
    ],
  },
  {
    label: "Sistem & Master Data",
    items: [
      {
        title: "Pengaturan",
        icon: SettingsIcon,
        items: [
          { title: "Opsi", href: "#opsi" },
          { title: "Template Email", href: "#template-email" },
        ],
      },
      {
        title: "Administrasi",
        icon: ShieldIcon,
        items: [
          { title: "Manajemen Staf", href: "#staf" },
          { title: "Log Aktivitas", href: "#log" },
        ],
      },
    ],
  },
]

export default function NavigationMenuDemo() {
  return (
    <DashboardShell
      nav={nav}
      labels={{ search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }}
      logo={
        <span className="flex items-center gap-2 font-semibold">
          <span className="size-7 rounded-md bg-primary" />
          Loka Musik Admin
        </span>
      }
      account={{
        name: "Raka Pratama",
        initials: "RP",
        detail: "raka@contoh.id",
        menu: [{ label: "Profil" }, { label: "Keluar", destructive: true }],
      }}
      search={{ groups: [{ heading: "Menu", items: [{ label: "Laporan Royalti" }, { label: "Penarikan" }] }] }}
    >
      <h1 className="text-2xl font-semibold">Laporan Royalti</h1>
      <p className="mt-1 text-sm text-muted-foreground">Laporan dari aggregator yang sudah diunggah.</p>
      <div className="mt-6 grid gap-4 md:grid-cols-3">
        {[
          ["Laporan bulan ini", "18"],
          ["Menunggu diproses", "4"],
          ["Total pendapatan", "Rp182.430.000,00"],
        ].map(([label, value]) => (
          <Card key={label}>
            <CardHeader>
              <CardDescription>{label}</CardDescription>
              <CardTitle className="text-2xl tabular-nums">{value}</CardTitle>
            </CardHeader>
          </Card>
        ))}
      </div>
    </DashboardShell>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Building, Coins, FileText, LayoutDashboard, LifeBuoy, Megaphone, Music, Percent, Settings, Shield, Truck } from "@lucide/vue"
import type { DashboardNavSection } from "@/components/blocks/dashboard-shell"
import { DashboardShell } from "@/components/blocks/dashboard-shell"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"

// The Loka Musik admin menu: titled sections, pages, and parents that open a sub menu.
const nav: DashboardNavSection[] = [
  {
    label: "Overview & Support",
    items: [
      { title: "Dasbor", href: "#dasbor", icon: LayoutDashboard },
      { title: "Tiket Support", href: "#tiket", icon: LifeBuoy, badge: 3 },
      { title: "Pengumuman", href: "#pengumuman", icon: Megaphone },
    ],
  },
  {
    label: "Katalog & Operasional",
    items: [
      { title: "Pengiriman", href: "#pengiriman", icon: Truck, badge: 12 },
      {
        title: "Laporan",
        icon: FileText,
        items: [
          { title: "Rilisan", href: "#laporan-rilisan" },
          { title: "Laporan Pengiriman", href: "#laporan-pengiriman" },
          { title: "Laporan Trek", href: "#laporan-trek" },
        ],
      },
    ],
  },
  {
    label: "Manajemen Klien & Artis",
    items: [
      { title: "Klien", href: "#klien", icon: Building },
      {
        title: "Artis",
        icon: Music,
        items: [
          { title: "Artis", href: "#artis" },
          { title: "Klien Artis", href: "#klien-artis" },
          { title: "Kandidat Premium", href: "#kandidat" },
        ],
      },
    ],
  },
  {
    label: "Keuangan & Royalti",
    items: [
      {
        title: "Royalti",
        icon: Coins,
        items: [
          { title: "Ringkasan", href: "#royalti" },
          { title: "Laporan Royalti", href: "#laporan-royalti", active: true },
          { title: "Unggah Laporan", href: "#unggah" },
          { title: "Penarikan", href: "#penarikan", badge: 5 },
        ],
      },
      {
        title: "Pajak",
        icon: Percent,
        items: [
          { title: "Klien PPh21", href: "#pph21" },
          { title: "Pengaturan PPh21", href: "#pph21-pengaturan" },
        ],
      },
    ],
  },
  {
    label: "Sistem & Master Data",
    items: [
      {
        title: "Pengaturan",
        icon: Settings,
        items: [
          { title: "Opsi", href: "#opsi" },
          { title: "Template Email", href: "#template-email" },
        ],
      },
      {
        title: "Administrasi",
        icon: Shield,
        items: [
          { title: "Manajemen Staf", href: "#staf" },
          { title: "Log Aktivitas", href: "#log" },
        ],
      },
    ],
  },
]

const account = {
  name: "Raka Pratama",
  initials: "RP",
  detail: "raka@contoh.id",
  menu: [{ label: "Profil" }, { label: "Keluar", destructive: true }],
}
const search = { groups: [{ heading: "Menu", items: [{ label: "Laporan Royalti" }, { label: "Penarikan" }] }] }
const labels = { search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }
const stats = [
  ["Laporan bulan ini", "18"],
  ["Menunggu diproses", "4"],
  ["Total pendapatan", "Rp182.430.000,00"],
]
</script>

<template>
  <DashboardShell :nav="nav" :account="account" :search="search" :labels="labels">
    <template #logo>
      <span class="flex items-center gap-2 font-semibold">
        <span class="size-7 rounded-md bg-primary" />
        Loka Musik Admin
      </span>
    </template>
    <h1 class="text-2xl font-semibold">Laporan Royalti</h1>
    <p class="mt-1 text-sm text-muted-foreground">Laporan dari aggregator yang sudah diunggah.</p>
    <div class="mt-6 grid gap-4 md:grid-cols-3">
      <Card v-for="[label, value] in stats" :key="label">
        <CardHeader>
          <CardDescription>{{ label }}</CardDescription>
          <CardTitle class="text-2xl tabular-nums">{{ value }}</CardTitle>
        </CardHeader>
      </Card>
    </div>
  </DashboardShell>
</template>
```

**Flutter**
```dart
// The navigation menu of a product with many pages, such as the Loka Musik admin: titled sections, pages,
// and parents that open a sub menu in place. A parent is not a page; it opens on its own when one of its
// pages is the current page. Put this column in the sidebar of the dashboard frame.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class _Page {
  const _Page(this.title, {this.icon, this.active = false, this.badge});
  final String title;
  final IconData? icon;
  final bool active;
  final int? badge;
}

class _Parent {
  const _Parent(this.title, this.icon, this.pages);
  final String title;
  final IconData icon;
  final List<_Page> pages;
}

const _sections = <(String, List<Object>)>[
  ('Overview & Support', [
    _Page('Dasbor', icon: LucideIcons.layoutDashboard),
    _Page('Tiket Support', icon: LucideIcons.lifeBuoy, badge: 3),
  ]),
  ('Katalog & Operasional', [
    _Page('Pengiriman', icon: LucideIcons.truck, badge: 12),
    _Parent('Laporan', LucideIcons.fileText, [_Page('Rilisan'), _Page('Laporan Pengiriman'), _Page('Laporan Trek')]),
  ]),
  ('Keuangan & Royalti', [
    _Parent('Royalti', LucideIcons.coins, [
      _Page('Ringkasan'),
      _Page('Laporan Royalti', active: true),
      _Page('Unggah Laporan'),
      _Page('Penarikan', badge: 5),
    ]),
    _Parent('Pajak', LucideIcons.percent, [_Page('Klien PPh21'), _Page('Pengaturan PPh21')]),
  ]),
];

class NavigationMenuDemo extends StatelessWidget {
  const NavigationMenuDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return Container(
      width: 256,
      padding: const EdgeInsets.all(8),
      decoration: BoxDecoration(
        color: theme.colorScheme.card,
        border: Border(right: BorderSide(color: theme.colorScheme.border)),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        mainAxisSize: MainAxisSize.min,
        children: [
          for (final (label, entries) in _sections) ...[
            Padding(
              padding: const EdgeInsets.fromLTRB(8, 12, 8, 4),
              child: Text(label, style: theme.textTheme.small.copyWith(color: theme.colorScheme.mutedForeground, fontSize: 12)),
            ),
            for (final entry in entries)
              if (entry is _Parent) _ParentEntry(parent: entry) else _PageEntry(page: entry as _Page),
          ],
        ],
      ),
    );
  }
}

class _PageEntry extends StatelessWidget {
  const _PageEntry({required this.page, this.indent = false});

  final _Page page;
  final bool indent;

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    return Semantics(
      selected: page.active,
      child: ShadButton.ghost(
        height: indent ? 32 : 36,
        mainAxisAlignment: MainAxisAlignment.start,
        backgroundColor: page.active ? c.primarySoft : null,
        foregroundColor: page.active ? c.primaryText : theme.colorScheme.foreground,
        leading: page.icon == null ? null : Icon(page.icon, size: 16),
        trailing: page.badge == null ? null : Text('${page.badge}', style: theme.textTheme.small.copyWith(fontSize: 12)),
        onPressed: () {},
        child: Expanded(child: Text(page.title, overflow: TextOverflow.ellipsis)),
      ),
    );
  }
}

class _ParentEntry extends StatefulWidget {
  const _ParentEntry({required this.parent});

  final _Parent parent;

  @override
  State<_ParentEntry> createState() => _ParentEntryState();
}

class _ParentEntryState extends State<_ParentEntry> {
  // A parent opens on its own when one of its pages is the current page.
  late bool _open = widget.parent.pages.any((p) => p.active);

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        Semantics(
          expanded: _open,
          child: ShadButton.ghost(
            mainAxisAlignment: MainAxisAlignment.start,
            foregroundColor: theme.colorScheme.foreground,
            leading: Icon(widget.parent.icon, size: 16),
            trailing: AnimatedRotation(
              turns: _open ? 0.25 : 0,
              duration: const Duration(milliseconds: 200),
              child: const Icon(LucideIcons.chevronRight, size: 16),
            ),
            onPressed: () => setState(() => _open = !_open),
            child: Expanded(child: Text(widget.parent.title)),
          ),
        ),
        if (_open)
          Container(
            margin: const EdgeInsets.only(left: 15),
            padding: const EdgeInsets.only(left: 9),
            decoration: BoxDecoration(border: Border(left: BorderSide(color: theme.colorScheme.border))),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [for (final page in widget.parent.pages) _PageEntry(page: page, indent: true)],
            ),
          ),
      ],
    );
  }
}
```

## Install

The menu is part of the Dashboard block; install it from [Dashboard](https://design.sosialoka.tech/patterns/dashboard/#install).

## Accessibility

- A parent is a button with `aria-expanded` and `aria-controls` pointing at its sub menu.
- The current page has `aria-current="page"`, inside a sub menu too.
- A section label names its group of links.
- A count is read with its page, such as "Tiket Support 3".


---

# Mobile app

> The phone app frame. It has a top bar with the title and search, the content, and a bottom nav of 3 to 5 destinations.

The mobile app frame is the phone version of the [Dashboard](https://design.sosialoka.tech/patterns/dashboard/): the same places for the title, the search and the main destinations in every Sosialoka app, from Cover Clearance to My Loka Link.

## When to use

- Use it for every signed-in screen of a phone app, and for a web app on phones.
- Put lists, details and forms inside it. Don't build a second header or a second navigation.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/mobile-app/_

## Anatomy

1. **Top bar:** 56px tall, with the screen title on the left and at most two icon buttons on the right, such as notifications. An optional search field sits under it.
2. **Content:** the screen, on `background`, with room at the bottom so the last item is never hidden behind the bottom nav.
3. **Bottom nav:** 3 to 5 destinations, each an icon above a label. The current one is in `primary`, without a pill behind it.

## Rules

- **Top bar holds the title, two icon buttons and the search, nothing else.** Greetings, summary cards, tabs and filters go in the content below it.
- **Home screen:** the greeting, the featured card's title and headline figures at the top may use `font-brand`; everything else stays in `font-sans`. See [Brand moments](https://design.sosialoka.tech/brand/#brand-moments).
- **Bottom nav:** 3 to 5 destinations, labels always shown, targets at least 48px tall. Put Account last.
- **Sort and filter** open a [Drawer](https://design.sosialoka.tech/components/drawer/) from the bottom, never a page.
- **Rows** use [Item](https://design.sosialoka.tech/components/item/); a status goes in a [Badge](https://design.sosialoka.tech/components/badge/) on the row.
- **Safe areas:** the top bar and the bottom nav keep clear of the notch and the home indicator (`env(safe-area-inset-*)`).

## Props

| React | Vue | Flutter | Type | Default | Use |
| --- | --- | --- | --- | --- | --- |
| `title` | `title` | `Text` | text | none | The screen title. |
| `nav` | `nav` | a `Row` of icon and label buttons | `{ title, href, icon, active? }[]` | none | The bottom nav. |
| `actions` | `#actions` slot | `ShadIconButton.ghost` | element | none | At most two icon buttons in the top bar. |
| `search` | `#search` slot | `ShadInput` | element | none | The optional search under the title. |
| `labels` | `labels` | `Semantics` | `{ nav }` | English | The name of the bottom nav for screen readers, such as "Navigasi utama". |
| `children` | default slot | `Expanded` child | element | none | The screen content. |

## Code

**React**
```tsx
import { useId } from "react"
import { BarChart3Icon, BellIcon, DiscIcon, HomeIcon, SearchIcon, UserIcon } from "lucide-react"
import { MobileShell } from "@/components/blocks/mobile-shell"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer"
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group"
import { Item, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/ui/item"
import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

const nav = [
  { title: "Beranda", href: "#", icon: HomeIcon },
  { title: "Rilis", href: "#rilis", icon: DiscIcon, active: true },
  { title: "Royalti", href: "#royalti", icon: BarChart3Icon },
  { title: "Notifikasi", href: "#notifikasi", icon: BellIcon },
  { title: "Akun", href: "#akun", icon: UserIcon },
]

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit" },
  { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu" },
  { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak" },
  { title: "Jalan Pulang", artist: "Raka Pratama", status: "success", label: "Terbit" },
] as const

export default function MobileShellDemo() {
  const id = useId()
  return (
    <MobileShell
      title="Rilis"
      nav={nav}
      labels={{ nav: "Navigasi utama" }}
      actions={
        <Button variant="ghost" size="icon-lg" className="size-11" aria-label="Notifikasi">
          <BellIcon />
        </Button>
      }
      search={
        <InputGroup>
          <InputGroupAddon>
            <SearchIcon />
          </InputGroupAddon>
          <InputGroupInput type="search" aria-label="Cari rilis" placeholder="Cari judul atau artis" />
        </InputGroup>
      }
    >
      <div className="mb-3 flex items-center justify-between">
        <p className="text-sm text-muted-foreground">6 rilis</p>
        <Drawer>
          <DrawerTrigger render={<Button variant="outline" size="sm" />}>Urutkan</DrawerTrigger>
          <DrawerContent>
            <DrawerHeader>
              <DrawerTitle>Urutkan rilis</DrawerTitle>
            </DrawerHeader>
            <RadioGroup defaultValue="newest" aria-label="Urutan" className="px-4">
              {[
                ["newest", "Terbaru"],
                ["oldest", "Terlama"],
                ["title", "Judul A–Z"],
              ].map(([value, label]) => (
                <div key={value} className="flex items-center gap-3">
                  <RadioGroupItem value={value} id={`${id}-${value}`} />
                  <Label htmlFor={`${id}-${value}`}>{label}</Label>
                </div>
              ))}
            </RadioGroup>
            <DrawerFooter>
              <DrawerClose render={<Button />}>Terapkan</DrawerClose>
            </DrawerFooter>
          </DrawerContent>
        </Drawer>
      </div>
      <ItemGroup className="gap-2">
        {releases.map((r) => (
          <Item key={r.title} variant="outline" render={<a href="#" />}>
            <ItemContent>
              <ItemTitle>{r.title}</ItemTitle>
              <ItemDescription>{r.artist}</ItemDescription>
            </ItemContent>
            <Badge variant={r.status}>{r.label}</Badge>
          </Item>
        ))}
      </ItemGroup>
    </MobileShell>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { useId } from "vue"
import { BarChart3, Bell, Disc, Home, Search, User } from "@lucide/vue"
import { MobileShell } from "@/components/blocks/mobile-shell"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "@/components/ui/drawer"
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group"
import { Item, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/ui/item"
import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

const nav = [
  { title: "Beranda", href: "#", icon: Home },
  { title: "Rilis", href: "#rilis", icon: Disc, active: true },
  { title: "Royalti", href: "#royalti", icon: BarChart3 },
  { title: "Notifikasi", href: "#notifikasi", icon: Bell },
  { title: "Akun", href: "#akun", icon: User },
]

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit" },
  { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu" },
  { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak" },
  { title: "Jalan Pulang", artist: "Raka Pratama", status: "success", label: "Terbit" },
] as const

const orders = [
  { value: "newest", label: "Terbaru" },
  { value: "oldest", label: "Terlama" },
  { value: "title", label: "Judul A–Z" },
]
const id = useId()
</script>

<template>
  <MobileShell title="Rilis" :nav="nav" :labels="{ nav: 'Navigasi utama' }">
    <template #actions>
      <Button variant="ghost" size="icon-lg" class="size-11" aria-label="Notifikasi">
        <Bell />
      </Button>
    </template>
    <template #search>
      <InputGroup>
        <InputGroupAddon>
          <Search />
        </InputGroupAddon>
        <InputGroupInput type="search" aria-label="Cari rilis" placeholder="Cari judul atau artis" />
      </InputGroup>
    </template>

    <div class="mb-3 flex items-center justify-between">
      <p class="text-sm text-muted-foreground">6 rilis</p>
      <Drawer>
        <DrawerTrigger as-child>
          <Button variant="outline" size="sm">Urutkan</Button>
        </DrawerTrigger>
        <DrawerContent>
          <DrawerHeader>
            <DrawerTitle>Urutkan rilis</DrawerTitle>
          </DrawerHeader>
          <RadioGroup default-value="newest" aria-label="Urutan" class="px-4">
            <div v-for="o in orders" :key="o.value" class="flex items-center gap-3">
              <RadioGroupItem :id="`${id}-${o.value}`" :value="o.value" />
              <Label :for="`${id}-${o.value}`">{{ o.label }}</Label>
            </div>
          </RadioGroup>
          <DrawerFooter>
            <DrawerClose as-child>
              <Button>Terapkan</Button>
            </DrawerClose>
          </DrawerFooter>
        </DrawerContent>
      </Drawer>
    </div>
    <ItemGroup class="gap-2">
      <Item v-for="r in releases" :key="r.title" variant="outline" as-child>
        <a href="#">
          <ItemContent>
            <ItemTitle>{{ r.title }}</ItemTitle>
            <ItemDescription>{{ r.artist }}</ItemDescription>
          </ItemContent>
          <Badge :variant="r.status">{{ r.label }}</Badge>
        </a>
      </Item>
    </ItemGroup>
  </MobileShell>
</template>
```

**Flutter**
```dart
// The phone app frame: a top bar with the title, one icon button and the search, the content, and a
// bottom nav of five destinations. Greetings, summary cards, tabs and filters go in the content.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const mobileNav = [
  (LucideIcons.house, 'Beranda'),
  (LucideIcons.disc, 'Rilis'),
  (LucideIcons.chartColumn, 'Royalti'),
  (LucideIcons.bell, 'Notifikasi'),
  (LucideIcons.user, 'Akun'),
];

const mobileReleases = [
  ('Senja di Kota', 'Rara Senandika', 'Terbit'),
  ('Kaset Pertama', 'Bima Laras', 'Menunggu'),
  ('Pulang Sore', 'Nada Kirana', 'Dijadwalkan'),
  ('Hujan Bulan Juni', 'Arka Wening', 'Terbit'),
  ('Lampu Kota', 'Sinta Maharani', 'Ditolak'),
  ('Jalan Pulang', 'Raka Pratama', 'Terbit'),
];

class MobileShellDemo extends StatelessWidget {
  const MobileShellDemo({super.key, this.active = 1});

  final int active;

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final border = BorderSide(color: theme.colorScheme.border);
    return SizedBox(
      width: 390,
      height: 720,
      child: DecoratedBox(
        decoration: BoxDecoration(color: theme.colorScheme.background),
        child: Column(
          children: [
            // Top bar: title, at most two icon buttons, then the search.
            DecoratedBox(
              decoration: BoxDecoration(border: Border(bottom: border)),
              child: Padding(
                padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
                child: Column(
                  children: [
                    SizedBox(
                      height: 56,
                      child: Row(
                        children: [
                          Expanded(child: Text('Rilis', style: theme.textTheme.large)),
                          ShadIconButton.ghost(
                            width: 44,
                            height: 44,
                            icon: const Icon(LucideIcons.bell, size: 20, semanticLabel: 'Notifikasi'),
                            onPressed: () {},
                          ),
                        ],
                      ),
                    ),
                    const ShadInput(
                      placeholder: Text('Cari judul atau artis'),
                      leading: Icon(LucideIcons.search, size: 16),
                    ),
                  ],
                ),
              ),
            ),
            Expanded(
              child: ListView.separated(
                padding: const EdgeInsets.all(16),
                itemCount: mobileReleases.length,
                separatorBuilder: (_, _) => const SizedBox(height: 8),
                itemBuilder: (context, i) {
                  final (title, artist, status) = mobileReleases[i];
                  // ShadItem's actions slot is narrow, so the status badge sits beside the title.
                  return ShadItem.outline(
                    title: Row(children: [Expanded(child: Text(title)), ShadBadge.secondary(child: Text(status))]),
                    description: Text(artist),
                    onPressed: () {},
                  );
                },
              ),
            ),
            // Bottom nav: icon above an always-visible label, 48px tall targets, the current page in primary.
            DecoratedBox(
              decoration: BoxDecoration(border: Border(top: border), color: theme.colorScheme.background),
              child: SafeArea(
                top: false,
                child: Row(
                  children: [
                    for (var i = 0; i < mobileNav.length; i++)
                      Expanded(
                        child: Semantics(
                          selected: i == active,
                          button: true,
                          child: GestureDetector(
                            onTap: () {},
                            child: ConstrainedBox(
                              constraints: const BoxConstraints(minHeight: 56),
                              child: Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                spacing: 4,
                                children: [
                                  Icon(
                                    mobileNav[i].$1,
                                    size: 20,
                                    color: i == active ? theme.colorScheme.primary : theme.colorScheme.mutedForeground,
                                  ),
                                  Text(
                                    mobileNav[i].$2,
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis,
                                    style: theme.textTheme.small.copyWith(
                                      fontSize: 12,
                                      color: i == active ? theme.colorScheme.primary : theme.colorScheme.mutedForeground,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                        ),
                      ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
```

## Install

**React**
```bash
npx shadcn@latest add https://design.sosialoka.tech/r/react/mobile-shell.json
```

**Vue**
```bash
npx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/mobile-shell.json
```

The block lands in `components/blocks/`. Install [Item](https://design.sosialoka.tech/components/item/), [Drawer](https://design.sosialoka.tech/components/drawer/), [Badge](https://design.sosialoka.tech/components/badge/), [Input Group](https://design.sosialoka.tech/components/input-group/), [Button](https://design.sosialoka.tech/components/button/), [Label](https://design.sosialoka.tech/components/label/) and [Radio Group](https://design.sosialoka.tech/components/radio-group/) for the content shown here.

## Flutter

Flutter apps build the same frame from widgets: a `Column` with the top bar, an `Expanded` list of `ShadItem`, and a bottom row of icon and label buttons inside a `SafeArea`. A Material `NavigationBar` works too if it follows the same rules: labels always shown, the current item in `primary`, no pill indicator.

## Accessibility

- The bottom nav is a `nav` named "Main navigation" by default ("Navigasi utama" in the example); the current destination has `aria-current="page"`.
- Every destination shows its label, so it never relies on the icon alone.
- Icon buttons in the top bar have a name, such as "Notifikasi".
- The bell opens the notifications page, not a popover: see [Notifications](https://design.sosialoka.tech/patterns/notifications/).


---

# List

> A list page. It has stats, search and filters, a table with row actions, and pagination.

Most screens in a Sosialoka product start as a list: releases, contracts, payouts, artists. Every list page has the same parts in the same order, so people know where to look in any product.

## When to use

- Use it for any collection people browse, search and act on.
- For one record, use a [Detail](https://design.sosialoka.tech/patterns/detail/) page. For an empty collection, show the [empty state](https://design.sosialoka.tech/patterns/states/) instead of an empty table.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/list/_

## Anatomy

1. **Header:** the page title and one primary action, such as "Rilis baru".
2. **Stats:** up to four cards with a label and a number.
3. **Filters:** search on top, then the status chips ([Toggle Group](https://design.sosialoka.tech/components/toggle-group/)) with the count of each status. They sit above the table they filter.
4. **Table:** inside a card, with a status badge column and one row action button at the end.
5. **Pagination:** under the table, inside the same card.

## Rules

- **One primary action** in the header. Every other action lives in the row menu.
- **Row menu:** name the button after the row ("Aksi untuk Senja di Kota"). Put the destructive item last, after a separator.
- **Status:** use the status badges (`success`, `warning`, `info`, `destructive`), never the brand color.
- **Numbers:** right-align them only in money columns. Use `tabular-nums` and show Rupiah with two decimals.
- **Status chips** always have one status on: "Semua" by default, and a click on the active chip keeps it on.
- **Filters** keep their values in the URL, so a shared link opens the same view.
- **On phones,** turn the table into an accordion: see [Responsive table](https://design.sosialoka.tech/patterns/responsive-table/).

## Code

**React**
```tsx
import { useState, type MouseEvent } from "react"
import { MoreHorizontalIcon, PlusIcon, SearchIcon } from "lucide-react"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Input } from "@/components/ui/input"
import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

const stats = [
  { label: "Rilis aktif", value: "24" },
  { label: "Menunggu dikirim", value: "3" },
  { label: "Royalti bulan ini", value: "Rp4.812.500,00" },
]

const statuses = [
  { label: "Semua", value: "semua", count: 24 },
  { label: "Terbit", value: "terbit", count: 12 },
  { label: "Menunggu", value: "menunggu", count: 8 },
  { label: "Ditolak", value: "ditolak", count: 4 },
]

const releases = [
  { title: "Senja di Kota", artist: "Raka Pratama", status: "success", label: "Terbit", date: "14 Nov 2026" },
  { title: "Kaset Pertama", artist: "Nadia Senja", status: "warning", label: "Menunggu", date: "21 Nov 2026" },
  { title: "Pulang Sore", artist: "Bima Laras", status: "info", label: "Dijadwalkan", date: "28 Nov 2026" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak", date: "2 Nov 2026" },
] as const

/** Two pages of four rows; the demo shows the first page's rows on both. */
const pages = [1, 2]

/** A list page: title and one main action, stats, filters above the table, row actions in a menu, pages below. */
export default function ListPageDemo() {
  const [page, setPage] = useState(1)
  const [status, setStatus] = useState("semua")
  const goTo = (next: number) => (event: MouseEvent) => {
    event.preventDefault()
    setPage(next)
  }
  return (
    <div className="min-h-svh bg-background p-6 text-foreground">
      <div className="mx-auto grid max-w-5xl gap-6">
        <div className="flex items-center justify-between gap-4">
          <h1 className="text-2xl font-semibold">Rilis</h1>
          <Button>
            <PlusIcon />
            Rilis baru
          </Button>
        </div>

        <div className="grid gap-4 sm:grid-cols-3">
          {stats.map((stat) => (
            <Card key={stat.label}>
              <CardHeader>
                <CardDescription>{stat.label}</CardDescription>
                <CardTitle className="text-2xl tabular-nums">{stat.value}</CardTitle>
              </CardHeader>
            </Card>
          ))}
        </div>

        <div className="flex flex-wrap items-center gap-3">
          <div className="relative w-full max-w-xs">
            <SearchIcon className="pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground" />
            <Input type="search" aria-label="Cari rilis" placeholder="Cari judul atau artis" className="pl-8" />
          </div>
        </div>

        <ToggleGroup
          variant="outline"
          spacing={2}
          aria-label="Filter status"
          value={[status]}
          // A status filter always has one value: clicking the active chip keeps it on.
          onValueChange={(value) => value.length > 0 && setStatus(value[value.length - 1])}
        >
          {statuses.map((s) => (
            <ToggleGroupItem key={s.value} value={s.value}>
              {s.label}
              <span className="tabular-nums text-muted-foreground">{s.count}</span>
            </ToggleGroupItem>
          ))}
        </ToggleGroup>

        <div className="rounded-xl border border-border bg-card">
          <Table>
            <TableHeader>
              <TableRow>
                <TableHead>Judul</TableHead>
                <TableHead>Artis</TableHead>
                <TableHead>Status</TableHead>
                <TableHead>Tanggal rilis</TableHead>
                <TableHead className="w-12">
                  <span className="sr-only">Aksi</span>
                </TableHead>
              </TableRow>
            </TableHeader>
            <TableBody>
              {releases.map((r) => (
                <TableRow key={r.title}>
                  <TableCell className="font-medium">{r.title}</TableCell>
                  <TableCell className="text-muted-foreground">{r.artist}</TableCell>
                  <TableCell>
                    <Badge variant={r.status}>{r.label}</Badge>
                  </TableCell>
                  <TableCell className="tabular-nums">{r.date}</TableCell>
                  <TableCell>
                    <DropdownMenu>
                      <DropdownMenuTrigger
                        render={<Button variant="ghost" size="icon-sm" aria-label={`Aksi untuk ${r.title}`} />}
                      >
                        <MoreHorizontalIcon />
                      </DropdownMenuTrigger>
                      <DropdownMenuContent align="end">
                        <DropdownMenuItem>Lihat</DropdownMenuItem>
                        <DropdownMenuItem>Ubah</DropdownMenuItem>
                        <DropdownMenuSeparator />
                        <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
                      </DropdownMenuContent>
                    </DropdownMenu>
                  </TableCell>
                </TableRow>
              ))}
            </TableBody>
          </Table>
          <Pagination className="border-t border-border py-2">
            <PaginationContent>
              <PaginationItem>
                <PaginationPrevious href="#" disabled={page === 1} onClick={goTo(page - 1)} />
              </PaginationItem>
              {pages.map((p) => (
                <PaginationItem key={p}>
                  <PaginationLink href="#" isActive={p === page} onClick={goTo(p)}>
                    {p}
                  </PaginationLink>
                </PaginationItem>
              ))}
              <PaginationItem>
                <PaginationNext href="#" disabled={page === pages.length} onClick={goTo(page + 1)} />
              </PaginationItem>
            </PaginationContent>
          </Pagination>
        </div>
      </div>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { ref } from "vue"
import { MoreHorizontal, Plus, Search } from "@lucide/vue"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Input } from "@/components/ui/input"
import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

/** A list page: title and one main action, stats, filters above the table, row actions in a menu, pages below. */
const stats = [
  { label: "Rilis aktif", value: "24" },
  { label: "Menunggu dikirim", value: "3" },
  { label: "Royalti bulan ini", value: "Rp4.812.500,00" },
]

const statuses = [
  { label: "Semua", value: "semua", count: 24 },
  { label: "Terbit", value: "terbit", count: 12 },
  { label: "Menunggu", value: "menunggu", count: 8 },
  { label: "Ditolak", value: "ditolak", count: 4 },
]

const releases = [
  { title: "Senja di Kota", artist: "Raka Pratama", status: "success", label: "Terbit", date: "14 Nov 2026" },
  { title: "Kaset Pertama", artist: "Nadia Senja", status: "warning", label: "Menunggu", date: "21 Nov 2026" },
  { title: "Pulang Sore", artist: "Bima Laras", status: "info", label: "Dijadwalkan", date: "28 Nov 2026" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak", date: "2 Nov 2026" },
] as const
const status = ref("semua")
// A status filter always has one value: clicking the active chip keeps it on.
function pickStatus(value: unknown) {
  if (typeof value === "string" && value) status.value = value
}
</script>

<template>
  <div class="min-h-svh bg-background p-6 text-foreground">
    <div class="mx-auto grid max-w-5xl gap-6">
      <div class="flex items-center justify-between gap-4">
        <h1 class="text-2xl font-semibold">Rilis</h1>
        <Button><Plus />Rilis baru</Button>
      </div>

      <div class="grid gap-4 sm:grid-cols-3">
        <Card v-for="stat in stats" :key="stat.label">
          <CardHeader>
            <CardDescription>{{ stat.label }}</CardDescription>
            <CardTitle class="text-2xl tabular-nums">{{ stat.value }}</CardTitle>
          </CardHeader>
        </Card>
      </div>

      <div class="flex flex-wrap items-center gap-3">
        <div class="relative w-full max-w-xs">
          <Search class="pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground" />
          <Input type="search" aria-label="Cari rilis" placeholder="Cari judul atau artis" class="pl-8" />
        </div>
      </div>

      <ToggleGroup type="single" variant="outline" :spacing="2" aria-label="Filter status" :model-value="status" @update:model-value="pickStatus">
        <ToggleGroupItem v-for="s in statuses" :key="s.value" :value="s.value">
          {{ s.label }}
          <span class="tabular-nums text-muted-foreground">{{ s.count }}</span>
        </ToggleGroupItem>
      </ToggleGroup>

      <div class="rounded-xl border border-border bg-card">
        <Table>
          <TableHeader>
            <TableRow>
              <TableHead>Judul</TableHead>
              <TableHead>Artis</TableHead>
              <TableHead>Status</TableHead>
              <TableHead>Tanggal rilis</TableHead>
              <TableHead class="w-12"><span class="sr-only">Aksi</span></TableHead>
            </TableRow>
          </TableHeader>
          <TableBody>
            <TableRow v-for="r in releases" :key="r.title">
              <TableCell class="font-medium">{{ r.title }}</TableCell>
              <TableCell class="text-muted-foreground">{{ r.artist }}</TableCell>
              <TableCell><Badge :variant="r.status">{{ r.label }}</Badge></TableCell>
              <TableCell class="tabular-nums">{{ r.date }}</TableCell>
              <TableCell>
                <DropdownMenu>
                  <DropdownMenuTrigger as-child>
                    <Button variant="ghost" size="icon-sm" :aria-label="`Aksi untuk ${r.title}`"><MoreHorizontal /></Button>
                  </DropdownMenuTrigger>
                  <DropdownMenuContent align="end">
                    <DropdownMenuItem>Lihat</DropdownMenuItem>
                    <DropdownMenuItem>Ubah</DropdownMenuItem>
                    <DropdownMenuSeparator />
                    <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
                  </DropdownMenuContent>
                </DropdownMenu>
              </TableCell>
            </TableRow>
          </TableBody>
        </Table>
        <Pagination v-slot="{ page }" :items-per-page="4" :total="8" :default-page="1" class="border-t border-border py-2">
          <PaginationContent v-slot="{ items }">
            <PaginationPrevious />
            <template v-for="(item, index) in items" :key="index">
              <PaginationItem v-if="item.type === 'page'" :value="item.value" :is-active="item.value === page">
                {{ item.value }}
              </PaginationItem>
            </template>
            <PaginationNext />
          </PaginationContent>
        </Pagination>
      </div>
    </div>
  </div>
</template>
```

**Flutter**
```dart
// A list page: title and one main action, stats, filters above the table, row actions in a menu, pages below.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _stats = [('Rilis aktif', '24'), ('Menunggu dikirim', '3'), ('Royalti bulan ini', 'Rp4.812.500,00')];
const _releases = [
  (title: 'Senja di Kota', artist: 'Raka Pratama', status: 'Terbit', date: '14 Nov 2026'),
  (title: 'Kaset Pertama', artist: 'Nadia Senja', status: 'Menunggu', date: '21 Nov 2026'),
  (title: 'Pulang Sore', artist: 'Bima Laras', status: 'Dijadwalkan', date: '28 Nov 2026'),
];

class ListPageDemo extends StatelessWidget {
  const ListPageDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 880),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          Row(
            children: [
              Expanded(child: Text('Rilis', style: theme.textTheme.h3)),
              ShadButton(
                leading: const Icon(LucideIcons.plus, size: 16),
                onPressed: () {},
                child: const Text('Rilis baru'),
              ),
            ],
          ),
          const SizedBox(height: 16),
          Row(
            children: [
              for (final (label, value) in _stats) ...[
                Expanded(
                  child: ShadCard(description: Text(label), title: Text(value, style: theme.textTheme.h4)),
                ),
                if (label != _stats.last.$1) const SizedBox(width: 16),
              ],
            ],
          ),
          const SizedBox(height: 16),
          const SizedBox(
            width: 320,
            child: ShadInput(
              placeholder: Text('Cari judul atau artis'),
              leading: Icon(LucideIcons.search, size: 16),
            ),
          ),
          const SizedBox(height: 12),
          // A status filter always has one value: allowDeselection keeps the active chip on.
          ShadToggleGroup<String>(
            initialValue: 'semua',
            allowDeselection: false,
            variant: ShadToggleVariant.outline,
            spacing: 8,
            items: [
              for (final (value, label, count) in const [('semua', 'Semua', 24), ('terbit', 'Terbit', 12), ('menunggu', 'Menunggu', 8), ('ditolak', 'Ditolak', 4)])
                ShadToggleGroupItem(
                  value: value,
                  child: Row(
                    mainAxisSize: MainAxisSize.min,
                    spacing: 6,
                    children: [Text(label), Text('$count', style: theme.textTheme.muted)],
                  ),
                ),
            ],
          ),
          const SizedBox(height: 16),
          ShadCard(
            padding: EdgeInsets.zero,
            child: SizedBox(
              height: 200,
              child: ShadTable.list(
                columnSpanExtent: (index) => switch (index) {
                  0 => const FixedTableSpanExtent(220),
                  1 => const FixedTableSpanExtent(180),
                  2 => const FixedTableSpanExtent(150),
                  3 => const FixedTableSpanExtent(150),
                  _ => const RemainingTableSpanExtent(),
                },
                header: const [
                  ShadTableCell.header(child: Text('Judul')),
                  ShadTableCell.header(child: Text('Artis')),
                  ShadTableCell.header(child: Text('Status')),
                  ShadTableCell.header(child: Text('Tanggal rilis')),
                  ShadTableCell.header(child: SizedBox.shrink()),
                ],
                children: _releases.map(
                  (r) => [
                    ShadTableCell(child: Text(r.title, style: const TextStyle(fontWeight: FontWeight.w500))),
                    ShadTableCell(child: Text(r.artist)),
                    ShadTableCell(child: ShadBadge.outline(child: Text(r.status))),
                    ShadTableCell(child: Text(r.date)),
                    ShadTableCell(child: _RowActions(title: r.title)),
                  ],
                ),
              ),
            ),
          ),
          const SizedBox(height: 8),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ShadButton.ghost(onPressed: () {}, child: const Text('Sebelumnya')),
              ShadButton.outline(onPressed: () {}, child: const Text('1')),
              ShadButton.ghost(onPressed: () {}, child: const Text('2')),
              ShadButton.ghost(onPressed: () {}, child: const Text('Berikutnya')),
            ],
          ),
        ],
      ),
    );
  }
}

/// The row's actions behind one button, with the destructive one last.
class _RowActions extends StatefulWidget {
  const _RowActions({required this.title});

  final String title;

  @override
  State<_RowActions> createState() => _RowActionsState();
}

class _RowActionsState extends State<_RowActions> {
  final controller = ShadContextMenuController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ShadContextMenu(
      controller: controller,
      items: [
        const ShadContextMenuItem(child: Text('Lihat')),
        const ShadContextMenuItem(child: Text('Ubah')),
        const ShadSeparator.horizontal(margin: EdgeInsets.symmetric(vertical: 4)),
        ShadContextMenuItem(child: Text('Hapus', style: TextStyle(color: context.sosialoka.destructive))),
      ],
      child: Semantics(
        label: 'Aksi untuk ${widget.title}',
        child: ShadIconButton.ghost(icon: const Icon(LucideIcons.ellipsis), onPressed: controller.toggle),
      ),
    );
  }
}
```

## Built from

[Button](https://design.sosialoka.tech/components/button/), [Card](https://design.sosialoka.tech/components/card/), [Input](https://design.sosialoka.tech/components/input/), [Toggle Group](https://design.sosialoka.tech/components/toggle-group/), [Table](https://design.sosialoka.tech/components/table/), [Badge](https://design.sosialoka.tech/components/badge/) and [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/).

## Flutter

`ShadTable.list` holds the rows. shadcn_ui has no pagination widget, so put outline and ghost buttons under the table. Open the row actions from a `ShadContextMenu` and give the button a semantic label.


---

# Responsive table

> A table on wide screens that turns into an accordion on phones, with every column and action still there.

A responsive table shows records in a table on wide screens and as an accordion on phones, where a table would need sideways scrolling.

## When to use

- Use it for any list page that must work on phones, such as releases or payouts.
- Keep the [Table](https://design.sosialoka.tech/components/table/) as it is from `md` up; below it, each row becomes one [Accordion](https://design.sosialoka.tech/components/accordion/) item.
- Use a list of [Item](https://design.sosialoka.tech/components/item/) rows instead when a row has only two or three facts.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/responsive-table/_

## Anatomy

1. **From `md` up:** the table, inside a card, with the row action at the end of each row.
2. **Below `md`:** one accordion item per row. The trigger holds the main column (the title) and the status badge; the content holds the other columns as label–value pairs and the row action.

## Rules

- **Same data, same actions.** Every column and every action of the table is still there in the accordion.
- **Only one is shown.** Hide the other with `hidden` / `md:hidden`, so screen readers never hear the records twice.
- **Trigger:** the title and the status, nothing else, so the closed list stays easy to scan.
- **No sideways scrolling** at 390px.

## Code

**React**
```tsx
import { MoreHorizontalIcon } from "lucide-react"
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit", date: "14 Nov 2026" },
  { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu", date: "21 Nov 2026" },
  { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan", date: "28 Nov 2026" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit", date: "3 Nov 2026" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak", date: "2 Nov 2026" },
] as const

function RowActions({ title }: { title: string }) {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="ghost" size="icon-sm" aria-label={`Aksi untuk ${title}`} />}>
        <MoreHorizontalIcon />
      </DropdownMenuTrigger>
      <DropdownMenuContent align="end">
        <DropdownMenuItem>Lihat</DropdownMenuItem>
        <DropdownMenuItem>Ubah</DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}

/** A table from md up; below it every row becomes an accordion item. Only one of them is ever shown. */
export default function ResponsiveTableDemo() {
  return (
    <div className="min-h-svh bg-background p-4 text-foreground md:p-6">
      <div className="hidden rounded-xl border border-border bg-card md:block">
        <Table>
          <TableHeader>
            <TableRow>
              <TableHead>Judul</TableHead>
              <TableHead>Artis</TableHead>
              <TableHead>Status</TableHead>
              <TableHead>Tanggal</TableHead>
              <TableHead className="w-12">
                <span className="sr-only">Aksi</span>
              </TableHead>
            </TableRow>
          </TableHeader>
          <TableBody>
            {releases.map((r) => (
              <TableRow key={r.title}>
                <TableCell className="font-medium">{r.title}</TableCell>
                <TableCell className="text-muted-foreground">{r.artist}</TableCell>
                <TableCell>
                  <Badge variant={r.status}>{r.label}</Badge>
                </TableCell>
                <TableCell className="text-muted-foreground">{r.date}</TableCell>
                <TableCell>
                  <RowActions title={r.title} />
                </TableCell>
              </TableRow>
            ))}
          </TableBody>
        </Table>
      </div>

      <Accordion className="rounded-xl border border-border bg-card px-4 md:hidden">
        {releases.map((r) => (
          <AccordionItem key={r.title} value={r.title}>
            <AccordionTrigger>
              <span className="flex flex-1 items-center justify-between gap-2">
                <span>{r.title}</span>
                <Badge variant={r.status}>{r.label}</Badge>
              </span>
            </AccordionTrigger>
            <AccordionContent>
              <dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1">
                <dt className="text-muted-foreground">Artis</dt>
                <dd>{r.artist}</dd>
                <dt className="text-muted-foreground">Tanggal</dt>
                <dd>{r.date}</dd>
              </dl>
              <div className="mt-2 flex justify-end">
                <RowActions title={r.title} />
              </div>
            </AccordionContent>
          </AccordionItem>
        ))}
      </Accordion>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { MoreHorizontal } from "@lucide/vue"
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

const releases = [
  { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit", date: "14 Nov 2026" },
  { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu", date: "21 Nov 2026" },
  { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan", date: "28 Nov 2026" },
  { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit", date: "3 Nov 2026" },
  { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak", date: "2 Nov 2026" },
] as const
</script>

<!-- A table from md up; below it every row becomes an accordion item. Only one of them is ever shown. -->
<template>
  <div class="min-h-svh bg-background p-4 text-foreground md:p-6">
    <div class="hidden rounded-xl border border-border bg-card md:block">
      <Table>
        <TableHeader>
          <TableRow>
            <TableHead>Judul</TableHead>
            <TableHead>Artis</TableHead>
            <TableHead>Status</TableHead>
            <TableHead>Tanggal</TableHead>
            <TableHead class="w-12"><span class="sr-only">Aksi</span></TableHead>
          </TableRow>
        </TableHeader>
        <TableBody>
          <TableRow v-for="r in releases" :key="r.title">
            <TableCell class="font-medium">{{ r.title }}</TableCell>
            <TableCell class="text-muted-foreground">{{ r.artist }}</TableCell>
            <TableCell><Badge :variant="r.status">{{ r.label }}</Badge></TableCell>
            <TableCell class="text-muted-foreground">{{ r.date }}</TableCell>
            <TableCell>
              <DropdownMenu>
                <DropdownMenuTrigger as-child>
                  <Button variant="ghost" size="icon-sm" :aria-label="`Aksi untuk ${r.title}`"><MoreHorizontal /></Button>
                </DropdownMenuTrigger>
                <DropdownMenuContent align="end">
                  <DropdownMenuItem>Lihat</DropdownMenuItem>
                  <DropdownMenuItem>Ubah</DropdownMenuItem>
                  <DropdownMenuSeparator />
                  <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
                </DropdownMenuContent>
              </DropdownMenu>
            </TableCell>
          </TableRow>
        </TableBody>
      </Table>
    </div>

    <Accordion type="single" collapsible class="rounded-xl border border-border bg-card px-4 md:hidden">
      <AccordionItem v-for="r in releases" :key="r.title" :value="r.title">
        <AccordionTrigger>
          <span class="flex flex-1 items-center justify-between gap-2">
            <span>{{ r.title }}</span>
            <Badge :variant="r.status">{{ r.label }}</Badge>
          </span>
        </AccordionTrigger>
        <AccordionContent>
          <dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1">
            <dt class="text-muted-foreground">Artis</dt>
            <dd>{{ r.artist }}</dd>
            <dt class="text-muted-foreground">Tanggal</dt>
            <dd>{{ r.date }}</dd>
          </dl>
          <div class="mt-2 flex justify-end">
            <DropdownMenu>
              <DropdownMenuTrigger as-child>
                <Button variant="ghost" size="icon-sm" :aria-label="`Aksi untuk ${r.title}`"><MoreHorizontal /></Button>
              </DropdownMenuTrigger>
              <DropdownMenuContent align="end">
                <DropdownMenuItem>Lihat</DropdownMenuItem>
                <DropdownMenuItem>Ubah</DropdownMenuItem>
                <DropdownMenuSeparator />
                <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
              </DropdownMenuContent>
            </DropdownMenu>
          </div>
        </AccordionContent>
      </AccordionItem>
    </Accordion>
  </div>
</template>
```

**Flutter**
```dart
// A table on wide screens; below 768 logical pixels every row becomes an accordion item.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

const tableReleases = [
  ('Senja di Kota', 'Rara Senandika', 'Terbit', '14 Nov 2026'),
  ('Kaset Pertama', 'Bima Laras', 'Menunggu', '21 Nov 2026'),
  ('Pulang Sore', 'Nada Kirana', 'Dijadwalkan', '28 Nov 2026'),
  ('Hujan Bulan Juni', 'Arka Wening', 'Terbit', '3 Nov 2026'),
  ('Lampu Kota', 'Sinta Maharani', 'Ditolak', '2 Nov 2026'),
];

class ResponsiveTableDemo extends StatelessWidget {
  const ResponsiveTableDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return LayoutBuilder(
      builder: (context, constraints) {
        if (constraints.maxWidth >= 768) {
          return SizedBox(
            height: 320,
            child: ShadTable.list(
              columnSpanExtent: (index) => switch (index) {
                0 => const FixedTableSpanExtent(220),
                1 => const FixedTableSpanExtent(200),
                2 => const FixedTableSpanExtent(160),
                _ => const RemainingTableSpanExtent(),
              },
              header: const [
                ShadTableCell.header(child: Text('Judul')),
                ShadTableCell.header(child: Text('Artis')),
                ShadTableCell.header(child: Text('Status')),
                ShadTableCell.header(child: Text('Tanggal')),
              ],
              children: [
                for (final (title, artist, status, date) in tableReleases)
                  [
                    ShadTableCell(child: Text(title)),
                    ShadTableCell(child: Text(artist)),
                    ShadTableCell(child: ShadBadge.secondary(child: Text(status))),
                    ShadTableCell(child: Text(date)),
                  ],
              ],
            ),
          );
        }
        return ShadAccordion<String>(
          children: [
            for (final (title, artist, status, date) in tableReleases)
              ShadAccordionItem(
                value: title,
                title: Row(
                  children: [Expanded(child: Text(title)), ShadBadge.secondary(child: Text(status))],
                ),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  spacing: 4,
                  children: [
                    Text('Artis: $artist', style: theme.textTheme.muted),
                    Text('Tanggal: $date', style: theme.textTheme.muted),
                    Align(
                      alignment: Alignment.centerRight,
                      child: ShadIconButton.ghost(
                        icon: Icon(LucideIcons.ellipsis, size: 16, semanticLabel: 'Aksi untuk $title'),
                        onPressed: () {},
                      ),
                    ),
                  ],
                ),
              ),
          ],
        );
      },
    );
  }
}
```

## Built from

[Table](https://design.sosialoka.tech/components/table/), [Accordion](https://design.sosialoka.tech/components/accordion/), [Badge](https://design.sosialoka.tech/components/badge/) and [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/).

## Flutter

Use a `LayoutBuilder`: from 768 logical pixels show `ShadTable.list`; below it, a `ShadAccordion` with one item per row.


---

# Detail

> A record page. It has the title with its status and main action, tabs, and label–value pairs.

A detail page shows one record and the next thing to do with it.

## When to use

- Use it when someone opens a row from a [List](https://design.sosialoka.tech/patterns/list/).
- Use a [Dialog](https://design.sosialoka.tech/components/dialog/) instead for a record that needs only a quick look.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/detail/_

## Anatomy

1. **[Breadcrumb](https://design.sosialoka.tech/components/breadcrumb/)** above the title: the list, then this record as the current page.
2. **Header:** the title, the status badge, one primary action, and a menu with the other actions.
3. **Tabs** with an underline, one per part of the record.
4. **Facts:** label–value pairs (`dl`) in a card. The label is `muted-foreground` and sits above the value.

## Rules

- **One primary action:** the step that moves the record forward, such as "Kirim ke platform". Hide it when there is no next step.
- **Labels above values,** in a grid of two or three columns. Don't use a two-column table for facts.
- **Tabs** open on the summary. Keep each tab's content short enough to scan.

## Code

**React**
```tsx
import { MoreHorizontalIcon } from "lucide-react"
import { Badge } from "@/components/ui/badge"
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

const facts = [
  { term: "Artis", value: "Raka Pratama" },
  { term: "Label", value: "Rekaman Senja" },
  { term: "Genre", value: "Pop" },
  { term: "Tanggal rilis", value: "14 Nov 2026" },
  { term: "UPC", value: "198765432109" },
  { term: "Jumlah lagu", value: "4" },
]

/** A record page: back link, title with status and one main action, tabs, then label–value pairs. */
export default function DetailPageDemo() {
  return (
    <div className="min-h-svh bg-background p-6 text-foreground">
      <div className="mx-auto grid max-w-5xl gap-6">
        <Breadcrumb>
          <BreadcrumbList>
            <BreadcrumbItem>
              <BreadcrumbLink href="#">Rilis</BreadcrumbLink>
            </BreadcrumbItem>
            <BreadcrumbSeparator />
            <BreadcrumbItem>
              <BreadcrumbPage>Senja di Kota</BreadcrumbPage>
            </BreadcrumbItem>
          </BreadcrumbList>
        </Breadcrumb>
        <div className="flex flex-wrap items-center justify-between gap-4">
          <div className="flex items-center gap-3">
            <h1 className="text-2xl font-semibold">Senja di Kota</h1>
            <Badge variant="warning">Menunggu</Badge>
          </div>
          <div className="flex items-center gap-2">
            <Button>Kirim ke platform</Button>
            <DropdownMenu>
              <DropdownMenuTrigger render={<Button variant="outline" size="icon" aria-label="Aksi lainnya" />}>
                <MoreHorizontalIcon />
              </DropdownMenuTrigger>
              <DropdownMenuContent align="end">
                <DropdownMenuItem>Ubah</DropdownMenuItem>
                <DropdownMenuItem>Unduh metadata</DropdownMenuItem>
                <DropdownMenuSeparator />
                <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
              </DropdownMenuContent>
            </DropdownMenu>
          </div>
        </div>

        <Tabs defaultValue="ringkasan">
          <TabsList>
            <TabsTrigger value="ringkasan">Ringkasan</TabsTrigger>
            <TabsTrigger value="lagu">Lagu</TabsTrigger>
            <TabsTrigger value="dokumen">Dokumen</TabsTrigger>
          </TabsList>
          <TabsContent value="ringkasan" className="pt-4">
            <Card>
              <CardContent>
                <dl className="grid gap-x-6 gap-y-4 sm:grid-cols-3">
                  {facts.map((f) => (
                    <div key={f.term} className="grid gap-1">
                      <dt className="text-sm text-muted-foreground">{f.term}</dt>
                      <dd className="font-medium">{f.value}</dd>
                    </div>
                  ))}
                </dl>
              </CardContent>
            </Card>
          </TabsContent>
          <TabsContent value="lagu" className="pt-4 text-muted-foreground">
            Empat lagu siap dikirim.
          </TabsContent>
          <TabsContent value="dokumen" className="pt-4 text-muted-foreground">
            Perjanjian rilis sudah ditandatangani.
          </TabsContent>
        </Tabs>
      </div>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { MoreHorizontal } from "@lucide/vue"
import { Badge } from "@/components/ui/badge"
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "@/components/ui/breadcrumb"
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

/** A record page: back link, title with status and one main action, tabs, then label–value pairs. */
const facts = [
  { term: "Artis", value: "Raka Pratama" },
  { term: "Label", value: "Rekaman Senja" },
  { term: "Genre", value: "Pop" },
  { term: "Tanggal rilis", value: "14 Nov 2026" },
  { term: "UPC", value: "198765432109" },
  { term: "Jumlah lagu", value: "4" },
]
</script>

<template>
  <div class="min-h-svh bg-background p-6 text-foreground">
    <div class="mx-auto grid max-w-5xl gap-6">
      <Breadcrumb>
        <BreadcrumbList>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Rilis</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbSeparator />
          <BreadcrumbItem>
            <BreadcrumbPage>Senja di Kota</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
      <div class="flex flex-wrap items-center justify-between gap-4">
        <div class="flex items-center gap-3">
          <h1 class="text-2xl font-semibold">Senja di Kota</h1>
          <Badge variant="warning">Menunggu</Badge>
        </div>
        <div class="flex items-center gap-2">
          <Button>Kirim ke platform</Button>
          <DropdownMenu>
            <DropdownMenuTrigger as-child>
              <Button variant="outline" size="icon" aria-label="Aksi lainnya"><MoreHorizontal /></Button>
            </DropdownMenuTrigger>
            <DropdownMenuContent align="end">
              <DropdownMenuItem>Ubah</DropdownMenuItem>
              <DropdownMenuItem>Unduh metadata</DropdownMenuItem>
              <DropdownMenuSeparator />
              <DropdownMenuItem variant="destructive">Hapus</DropdownMenuItem>
            </DropdownMenuContent>
          </DropdownMenu>
        </div>
      </div>

      <Tabs default-value="ringkasan">
        <TabsList>
          <TabsTrigger value="ringkasan">Ringkasan</TabsTrigger>
          <TabsTrigger value="lagu">Lagu</TabsTrigger>
          <TabsTrigger value="dokumen">Dokumen</TabsTrigger>
        </TabsList>
        <TabsContent value="ringkasan" class="pt-4">
          <Card>
            <CardContent>
              <dl class="grid gap-x-6 gap-y-4 sm:grid-cols-3">
                <div v-for="f in facts" :key="f.term" class="grid gap-1">
                  <dt class="text-sm text-muted-foreground">{{ f.term }}</dt>
                  <dd class="font-medium">{{ f.value }}</dd>
                </div>
              </dl>
            </CardContent>
          </Card>
        </TabsContent>
        <TabsContent value="lagu" class="pt-4 text-muted-foreground">Empat lagu siap dikirim.</TabsContent>
        <TabsContent value="dokumen" class="pt-4 text-muted-foreground">Perjanjian rilis sudah ditandatangani.</TabsContent>
      </Tabs>
    </div>
  </div>
</template>
```

**Flutter**
```dart
// A record page: breadcrumb, title with status and one main action, tabs, then label–value pairs.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _facts = [
  ('Artis', 'Raka Pratama'),
  ('Label', 'Rekaman Senja'),
  ('Genre', 'Pop'),
  ('Tanggal rilis', '14 Nov 2026'),
  ('UPC', '198765432109'),
  ('Jumlah lagu', '4'),
];

class DetailPageDemo extends StatelessWidget {
  const DetailPageDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 880),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          ShadBreadcrumb(
            children: [
              ShadBreadcrumbLink(onPressed: () {}, child: const Text('Rilis')),
              Semantics(selected: true, child: const Text('Senja di Kota')),
            ],
          ),
          const SizedBox(height: 8),
          Row(
            children: [
              Text('Senja di Kota', style: theme.textTheme.h3),
              const SizedBox(width: 12),
              ShadBadge(backgroundColor: c.warningSoft, foregroundColor: c.warning, child: const Text('Menunggu')),
              const Spacer(),
              ShadButton(onPressed: () {}, child: const Text('Kirim ke platform')),
            ],
          ),
          const SizedBox(height: 16),
          ShadTabs<String>(
            value: 'ringkasan',
            // Tabs share the bar width equally; leave room for the longest label.
            tabBarConstraints: const BoxConstraints(maxWidth: 520),
            tabs: [
              ShadTab(
                value: 'ringkasan',
                content: ShadCard(
                  child: Wrap(
                    spacing: 24,
                    runSpacing: 16,
                    children: [
                      for (final (term, value) in _facts)
                        SizedBox(
                          width: 240,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(term, style: theme.textTheme.muted),
                              const SizedBox(height: 4),
                              Text(value, style: const TextStyle(fontWeight: FontWeight.w500)),
                            ],
                          ),
                        ),
                    ],
                  ),
                ),
                child: const Text('Ringkasan'),
              ),
              const ShadTab(value: 'lagu', content: Text('Empat lagu siap dikirim.'), child: Text('Lagu')),
              const ShadTab(
                value: 'dokumen',
                content: Text('Perjanjian rilis sudah ditandatangani.'),
                child: Text('Dokumen'),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
```

## Built from

[Breadcrumb](https://design.sosialoka.tech/components/breadcrumb/), [Button](https://design.sosialoka.tech/components/button/), [Badge](https://design.sosialoka.tech/components/badge/), [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/), [Tabs](https://design.sosialoka.tech/components/tabs/) and [Card](https://design.sosialoka.tech/components/card/).

## Flutter

Use `ShadTabs` with room for the longest label, and a `Wrap` of label–value columns inside a `ShadCard`.


---

# Form

> A form. Labels sit above the fields, hints are one sentence, errors come from the backend, and the actions go in the footer.

Forms look and behave the same in every product and framework. That includes Flutter, which used to put floating labels inside the fields.

## When to use

- Use it to create or edit a record.
- Split a long form into cards with one heading each. Use the [Login](https://design.sosialoka.tech/patterns/login/) page for sign in.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/form/_

## Anatomy

1. **Card** with a title and one sentence about what to fill in.
2. **Fields,** each with a label above it and an optional one-sentence hint below.
3. **Error** under its field, in `destructive`, joined to the field with `aria-describedby`.
4. **Footer:** "Batal" as an outline button, then the primary action.

## Rules

- **Labels above the fields,** never inside them as a placeholder or a floating label.
- **Hints** are one practical sentence: what to fill in, an example, or a limit.
- **Errors come from the backend.** The client only enables or disables the submit button; it never writes its own error text. Set `aria-invalid="true"` on the field.
- **One primary action** per form, last in the footer.

## Code

**React**
```tsx
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"

const genres = [
  { label: "Pilih genre", value: null },
  { label: "Pop", value: "pop" },
  { label: "Rock", value: "rock" },
  { label: "Dangdut", value: "dangdut" },
  { label: "Jazz", value: "jazz" },
]

/**
 * A form: labels above the fields, a one-sentence hint under a field, the error the backend sent under its
 * field, and the actions in the card footer. The error text comes from the API response, never from the client.
 */
export default function FormPageDemo() {
  return (
    <div className="min-h-svh bg-background p-6 text-foreground">
      <form className="mx-auto max-w-2xl" onSubmit={(e) => e.preventDefault()}>
        <Card>
          <CardHeader>
            <CardTitle>Data rilis</CardTitle>
            <CardDescription>Isi sesuai yang akan tampil di platform musik.</CardDescription>
          </CardHeader>
          <CardContent className="grid gap-5">
            <div className="grid gap-2">
              <Label htmlFor="release-title">Judul</Label>
              <Input
                id="release-title"
                aria-invalid="true"
                aria-describedby="release-title-hint release-title-error"
              />
              <p id="release-title-hint" className="text-sm text-muted-foreground">
                Tulis persis seperti di sampul.
              </p>
              <p id="release-title-error" className="text-sm text-destructive">
                Judul lagunya belum diisi.
              </p>
            </div>
            <div className="grid gap-2">
              <Label htmlFor="release-artist">Artis</Label>
              <Input id="release-artist" defaultValue="Raka Pratama" />
            </div>
            <div className="grid gap-2">
              <Label htmlFor="release-genre">Genre</Label>
              <Select items={genres}>
                <SelectTrigger id="release-genre" className="w-full">
                  <SelectValue />
                </SelectTrigger>
                <SelectContent>
                  {genres
                    .filter((g) => g.value !== null)
                    .map((g) => (
                      <SelectItem key={g.value} value={g.value}>
                        {g.label}
                      </SelectItem>
                    ))}
                </SelectContent>
              </Select>
            </div>
            <div className="flex items-center gap-2">
              <Checkbox id="release-explicit" />
              <Label htmlFor="release-explicit">Lagu ini mengandung lirik eksplisit</Label>
            </div>
          </CardContent>
          <CardFooter className="justify-end gap-2">
            <Button type="button" variant="outline">
              Batal
            </Button>
            <Button type="submit">Simpan</Button>
          </CardFooter>
        </Card>
      </form>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"

/**
 * A form: labels above the fields, a one-sentence hint under a field, the error the backend sent under its
 * field, and the actions in the card footer. The error text comes from the API response, never from the client.
 */
const genres = [
  { label: "Pop", value: "pop" },
  { label: "Rock", value: "rock" },
  { label: "Dangdut", value: "dangdut" },
  { label: "Jazz", value: "jazz" },
]
</script>

<template>
  <div class="min-h-svh bg-background p-6 text-foreground">
    <form class="mx-auto max-w-2xl" @submit.prevent>
      <Card>
        <CardHeader>
          <CardTitle>Data rilis</CardTitle>
          <CardDescription>Isi sesuai yang akan tampil di platform musik.</CardDescription>
        </CardHeader>
        <CardContent class="grid gap-5">
          <div class="grid gap-2">
            <Label for="release-title-vue">Judul</Label>
            <Input id="release-title-vue" aria-invalid="true" aria-describedby="release-title-hint-vue release-title-error-vue" />
            <p id="release-title-hint-vue" class="text-sm text-muted-foreground">Tulis persis seperti di sampul.</p>
            <p id="release-title-error-vue" class="text-sm text-destructive">Judul lagunya belum diisi.</p>
          </div>
          <div class="grid gap-2">
            <Label for="release-artist-vue">Artis</Label>
            <Input id="release-artist-vue" default-value="Raka Pratama" />
          </div>
          <div class="grid gap-2">
            <Label for="release-genre-vue">Genre</Label>
            <Select>
              <SelectTrigger id="release-genre-vue" class="w-full">
                <SelectValue placeholder="Pilih genre" />
              </SelectTrigger>
              <SelectContent>
                <SelectItem v-for="g in genres" :key="g.value" :value="g.value">{{ g.label }}</SelectItem>
              </SelectContent>
            </Select>
          </div>
          <div class="flex items-center gap-2">
            <Checkbox id="release-explicit-vue" />
            <Label for="release-explicit-vue">Lagu ini mengandung lirik eksplisit</Label>
          </div>
        </CardContent>
        <CardFooter class="justify-end gap-2">
          <Button type="button" variant="outline">Batal</Button>
          <Button type="submit">Simpan</Button>
        </CardFooter>
      </Card>
    </form>
  </div>
</template>
```

**Flutter**
```dart
// A form: labels above the fields (ShadInputFormField's label, never a floating Material labelText),
// a one-sentence hint, the error the backend sent under its field, and the actions at the bottom.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class FormPageDemo extends StatelessWidget {
  const FormPageDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ShadCard(
      width: 576,
      title: Text('Data rilis', style: theme.textTheme.h4),
      description: const Text('Isi sesuai yang akan tampil di platform musik.'),
      footer: Row(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          ShadButton.outline(onPressed: () {}, child: const Text('Batal')),
          const SizedBox(width: 8),
          ShadButton(onPressed: () {}, child: const Text('Simpan')),
        ],
      ),
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            ShadInputFormField(
              id: 'title',
              label: const Text('Judul'),
              description: const Text('Tulis persis seperti di sampul.'),
              // The message comes from the API response; the app never writes its own.
              forceErrorText: 'Judul lagunya belum diisi.',
            ),
            const SizedBox(height: 16),
            ShadInputFormField(id: 'artist', label: const Text('Artis'), initialValue: 'Raka Pratama'),
            const SizedBox(height: 16),
            ShadSelectFormField<String>(
              id: 'genre',
              label: const Text('Genre'),
              minWidth: 544,
              placeholder: const Text('Pilih genre'),
              options: const [
                ShadOption(value: 'pop', child: Text('Pop')),
                ShadOption(value: 'rock', child: Text('Rock')),
                ShadOption(value: 'dangdut', child: Text('Dangdut')),
                ShadOption(value: 'jazz', child: Text('Jazz')),
              ],
              selectedOptionBuilder: (context, value) => Text(value),
            ),
            const SizedBox(height: 16),
            ShadCheckboxFormField(
              id: 'explicit',
              initialValue: false,
              inputLabel: const Text('Lagu ini mengandung lirik eksplisit'),
            ),
          ],
        ),
      ),
    );
  }
}
```

## Built from

[Card](https://design.sosialoka.tech/components/card/), [Label](https://design.sosialoka.tech/components/label/), [Input](https://design.sosialoka.tech/components/input/), [Select](https://design.sosialoka.tech/components/select/), [Checkbox](https://design.sosialoka.tech/components/checkbox/) and [Button](https://design.sosialoka.tech/components/button/).

## Flutter

Use `ShadInputFormField(label: …)`, not `InputDecoration.labelText`. The label then sits above the field as it does on the web. Show the backend's message with `forceErrorText`.


---

# Empty, loading and error

> What a page shows when there is nothing yet, while it loads, and when loading fails.

Every list and card has three states besides "full". Show them in the place where the content would be, at the same size, so the page doesn't jump.

## When to use

- **Empty:** the collection has nothing yet, or no row matches the filters.
- **Loading:** the data is on its way. Show a skeleton in the shape of the content.
- **Error:** loading failed. Say what failed and offer a way to try again.

## Empty

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/states/_

A title, one sentence about what will appear, and the one action that fills the space. When filters hide every row, the action clears the filters.

## Loading

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/states/_

Skeletons in the shape of the rows that are coming, `aria-busy="true"` on the container, and a sentence for screen readers. Skip the skeleton for loads under about 300 ms.

**React**
```tsx
import { Skeleton } from "@/components/ui/skeleton"

/** Loading: skeletons in the shape of the rows that are coming, and a sentence for screen readers. */
export default function LoadingStateDemo() {
  return (
    <div aria-busy="true" className="grid w-full max-w-md gap-4 rounded-xl border border-border bg-card p-4">
      <span className="sr-only">Memuat rilis…</span>
      {[0, 1, 2].map((row) => (
        <div key={row} className="flex items-center gap-3" aria-hidden="true">
          <Skeleton className="size-10 rounded-md" />
          <div className="grid flex-1 gap-2">
            <Skeleton className="h-4 w-2/3" />
            <Skeleton className="h-3 w-1/3" />
          </div>
        </div>
      ))}
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Skeleton } from "@/components/ui/skeleton"

/** Loading: skeletons in the shape of the rows that are coming, and a sentence for screen readers. */
</script>

<template>
  <div aria-busy="true" class="grid w-full max-w-md gap-4 rounded-xl border border-border bg-card p-4">
    <span class="sr-only">Memuat rilis…</span>
    <div v-for="row in 3" :key="row" class="flex items-center gap-3" aria-hidden="true">
      <Skeleton class="size-10 rounded-md" />
      <div class="grid flex-1 gap-2">
        <Skeleton class="h-4 w-2/3" />
        <Skeleton class="h-3 w-1/3" />
      </div>
    </div>
  </div>
</template>
```

**Flutter**
```dart
// Loading: placeholder bars in the shape of the rows that are coming, and a label for screen readers.
// shadcn_ui has no skeleton widget; muted boxes with the theme radius do the job.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class LoadingStateDemo extends StatelessWidget {
  const LoadingStateDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final muted = ShadTheme.of(context).colorScheme.muted;
    Widget bar(double width, double height) => Container(
      width: width,
      height: height,
      decoration: BoxDecoration(color: muted, borderRadius: BorderRadius.circular(6)),
    );
    return Semantics(
      label: 'Memuat rilis…',
      child: ExcludeSemantics(
        child: ShadCard(
          width: 448,
          child: Column(
            children: [
              for (var row = 0; row < 3; row++)
                Padding(
                  padding: const EdgeInsets.symmetric(vertical: 8),
                  child: Row(
                    children: [
                      bar(40, 40),
                      const SizedBox(width: 12),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [bar(240, 14), const SizedBox(height: 8), bar(120, 12)],
                      ),
                    ],
                  ),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
```

## Error

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/states/_

`role="alert"`, what failed, what to do next, and "Coba lagi". The message comes from the backend when there is one.

**React**
```tsx
import { RefreshCwIcon, TriangleAlertIcon } from "lucide-react"
import { Button } from "@/components/ui/button"

/** Loading failed: what failed, what to do next, and a way to try again. */
export default function ErrorStateDemo() {
  return (
    <div
      role="alert"
      className="flex w-full max-w-md flex-col items-center gap-4 rounded-xl border border-border bg-card px-6 py-10 text-center"
    >
      <span className="grid size-12 place-items-center rounded-lg bg-destructive-soft text-destructive">
        <TriangleAlertIcon className="size-6" />
      </span>
      <div className="grid gap-1">
        <h2 className="text-lg font-semibold">Rilis belum bisa dimuat</h2>
        <p className="text-sm text-muted-foreground">Cek koneksimu, lalu coba lagi.</p>
      </div>
      <Button variant="outline">
        <RefreshCwIcon />
        Coba lagi
      </Button>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { RefreshCw, TriangleAlert } from "@lucide/vue"
import { Button } from "@/components/ui/button"

/** Loading failed: what failed, what to do next, and a way to try again. */
</script>

<template>
  <div role="alert" class="flex w-full max-w-md flex-col items-center gap-4 rounded-xl border border-border bg-card px-6 py-10 text-center">
    <span class="grid size-12 place-items-center rounded-lg bg-destructive-soft text-destructive">
      <TriangleAlert class="size-6" />
    </span>
    <div class="grid gap-1">
      <h2 class="text-lg font-semibold">Rilis belum bisa dimuat</h2>
      <p class="text-sm text-muted-foreground">Cek koneksimu, lalu coba lagi.</p>
    </div>
    <Button variant="outline"><RefreshCw />Coba lagi</Button>
  </div>
</template>
```

**Flutter**
```dart
// Loading failed: what failed, what to do next, and a way to try again. Announced as a live region.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

class ErrorStateDemo extends StatelessWidget {
  const ErrorStateDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final c = context.sosialoka;
    return Semantics(
      liveRegion: true,
      child: ConstrainedBox(
        constraints: const BoxConstraints(maxWidth: 448),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Container(
              width: 48,
              height: 48,
              decoration: BoxDecoration(color: c.destructiveSoft, borderRadius: BorderRadius.circular(8)),
              child: Icon(LucideIcons.triangleAlert, color: c.destructive),
            ),
            const SizedBox(height: 16),
            Text('Rilis belum bisa dimuat', style: theme.textTheme.large),
            const SizedBox(height: 4),
            Text('Cek koneksimu, lalu coba lagi.', style: theme.textTheme.muted),
            const SizedBox(height: 16),
            ShadButton.outline(
              leading: const Icon(LucideIcons.refreshCw, size: 16),
              onPressed: () {},
              child: const Text('Coba lagi'),
            ),
          ],
        ),
      ),
    );
  }
}
```

## Code for the empty state

**React**
```tsx
import { DiscIcon, PlusIcon } from "lucide-react"
import { Button } from "@/components/ui/button"

/** Nothing here yet: what will appear, in one sentence, and the one action that fills it. */
export default function EmptyStateDemo() {
  return (
    <div className="flex w-full max-w-md flex-col items-center gap-4 rounded-xl border border-dashed border-border px-6 py-10 text-center">
      <span className="grid size-12 place-items-center rounded-lg bg-muted text-muted-foreground">
        <DiscIcon className="size-6" />
      </span>
      <div className="grid gap-1">
        <h2 className="text-lg font-semibold">Belum ada rilis</h2>
        <p className="text-sm text-muted-foreground">Rilis pertamamu akan muncul di sini.</p>
      </div>
      <Button>
        <PlusIcon />
        Rilis baru
      </Button>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Disc, Plus } from "@lucide/vue"
import { Button } from "@/components/ui/button"

/** Nothing here yet: what will appear, in one sentence, and the one action that fills it. */
</script>

<template>
  <div class="flex w-full max-w-md flex-col items-center gap-4 rounded-xl border border-dashed border-border px-6 py-10 text-center">
    <span class="grid size-12 place-items-center rounded-lg bg-muted text-muted-foreground">
      <Disc class="size-6" />
    </span>
    <div class="grid gap-1">
      <h2 class="text-lg font-semibold">Belum ada rilis</h2>
      <p class="text-sm text-muted-foreground">Rilis pertamamu akan muncul di sini.</p>
    </div>
    <Button><Plus />Rilis baru</Button>
  </div>
</template>
```

**Flutter**
```dart
// Nothing here yet: what will appear, in one sentence, and the one action that fills it.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

class EmptyStateDemo extends StatelessWidget {
  const EmptyStateDemo({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 448),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            width: 48,
            height: 48,
            decoration: BoxDecoration(color: theme.colorScheme.muted, borderRadius: BorderRadius.circular(8)),
            child: Icon(LucideIcons.disc, color: theme.colorScheme.mutedForeground),
          ),
          const SizedBox(height: 16),
          Text('Belum ada rilis', style: theme.textTheme.large),
          const SizedBox(height: 4),
          Text('Rilis pertamamu akan muncul di sini.', style: theme.textTheme.muted),
          const SizedBox(height: 16),
          ShadButton(
            leading: const Icon(LucideIcons.plus, size: 16),
            onPressed: () {},
            child: const Text('Rilis baru'),
          ),
        ],
      ),
    );
  }
}
```

## Built from

[Button](https://design.sosialoka.tech/components/button/) and the Skeleton that installs with [Sidebar](https://design.sosialoka.tech/components/sidebar/).

## Flutter

shadcn_ui has no skeleton widget. Muted boxes with the theme radius do the job. Wrap the error state in `Semantics(liveRegion: true)`.


---

# Notifications

> The bell panel and the notifications page. Unread comes first, categories are chips, and both use one row.

Every Sosialoka product tells people what changed in the same two places: a panel under the bell in the header, and a notifications page with everything. Both use the same row, so a notification looks the same wherever it shows up.

## When to use

- Use the panel for a quick look: the newest notifications and a way to clear the badge.
- Use the page to go through everything, by category or unread only.
- For a message about the page someone is on, use an [Alert](https://design.sosialoka.tech/components/alert/) or a [toast](https://design.sosialoka.tech/components/toast/) instead of a notification.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/notifications/_

## Anatomy

### Page

1. **Header:** the title "Notifikasi", one line of copy and "Tandai semua dibaca".
2. **Category chips:** [Toggle Group](https://design.sosialoka.tech/components/toggle-group/) chips, "Semua" first, each with its unread count.
3. **Card:** the Semua / Belum dibaca switch and the page menu on top, then the rows grouped as "Hari ini" and "Sebelumnya", then "Muat lagi".

### Row

1. **Icon:** the category's icon in a neutral circle.
2. **Title:** bold while unread.
3. **Body:** one or two lines.
4. **Time and category:** "5 menit lalu · Pembayaran". The full date and time show as a tooltip.
5. **Unread dot** at the end, then the row menu beside the row.

### Panel

1. **Bell:** `DashboardIconButton` from the [Dashboard](https://design.sosialoka.tech/patterns/dashboard/) header, with the unread count as its badge.
2. **Popover:** 360px wide, with "Notifikasi", "Tandai semua dibaca" and the Semua / Belum dibaca switch on top.
3. **Rows:** at most 8, grouped by time, the same row as on the page.
4. **Footer:** "Lihat semua notifikasi" opens the page.

## Rules

- **Mark all read** applies to the category that is on. Disable it when nothing there is unread.
- **Category chips** always have one category on: "Semua" by default, and a click on the active chip keeps it on. Each count is read as words, such as "Pembayaran (1 belum dibaca)". On phones the chips stay on one line that scrolls sideways; from `sm` they wrap. The category and the switch live in the URL, as list filters do.
- **Badge:** the unread count, "99+" above 99, and none at zero. The bell's name carries the count, such as "Notifikasi (3)".
- **Panel:** at most 8 rows. On phones the bell opens the page instead of a popover.
- **A click** marks the notification read and opens the page it is about. A notification without a target is only marked read.
- **Row menu:** name the button after the row ("Aksi untuk Royalti Oktober sudah masuk"). "Tandai dibaca" or "Tandai belum dibaca" first, then "Hapus" last, after a separator. Delete is optional: leave it out when the product can't delete notifications. After a delete, focus moves to the next row.
- **Hapus yang sudah dibaca** asks first in an [Alert Dialog](https://design.sosialoka.tech/components/alert-dialog/), since deleted notifications don't come back. It is off when nothing read is left.
- **Icons** name the category in neutral colors, never the brand color, so unread stays the only thing that stands out.
- **Time:** relative ("5 menit lalu", "Kemarin"). The full date and time show on hover and are read by screen readers.
- **More:** "Muat lagi" under the rows instead of page numbers; notifications are read newest first.
- **States:** an empty category says "Belum ada notifikasi di kategori ini." and an empty unread view says "Semua notifikasi sudah kamu baca.". Loading and errors follow [Empty, loading and error](https://design.sosialoka.tech/patterns/states/).

## Code

**React**
```tsx
import { useEffect, useRef, useState } from "react"
import {
  CheckCheckIcon,
  DiscIcon,
  FileCheckIcon,
  FileTextIcon,
  InfoIcon,
  MoreHorizontalIcon,
  WalletIcon,
  type LucideIcon,
} from "lucide-react"
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"

interface Notification {
  id: number
  category: Category
  title: string
  body: string
  /** Relative time shown in the row. */
  time: string
  /** Full date and time, shown as the tooltip of the relative time. */
  at: string
  /** ISO date for the <time> element. */
  iso: string
  group: "Hari ini" | "Sebelumnya"
  read: boolean
  /** The page the notification is about. Without one, a click only marks it read. */
  href?: string
}

const ICONS: Record<Category, LucideIcon> = {
  Pembayaran: WalletIcon,
  Clearance: FileCheckIcon,
  Laporan: FileTextIcon,
  Rilis: DiscIcon,
  Umum: InfoIcon,
}

const CATEGORIES: Category[] = ["Pembayaran", "Clearance", "Laporan", "Rilis", "Umum"]

const NOTIFICATIONS: Notification[] = [
  { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" },
  { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" },
  { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" },
  { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" },
  { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" },
  { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" },
  { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true },
  { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" },
  { id: 9, category: "Laporan", title: "Laporan royalti September siap", body: "Cek pendapatan tiap platform.", time: "14 Okt 2026", at: "14 Okt 2026, 10.00", iso: "2026-10-14T10:00", group: "Sebelumnya", read: true, href: "#laporan" },
  { id: 10, category: "Pembayaran", title: "Royalti September sudah masuk", body: "Rp980.000,00 masuk ke saldomu.", time: "13 Okt 2026", at: "13 Okt 2026, 15.10", iso: "2026-10-13T15:10", group: "Sebelumnya", read: true, href: "#saldo" },
]

/** Rows shown before "Muat lagi". */
const FIRST_PAGE = 8

/**
 * One notification: category icon, title (bold while unread), body, time and category, an unread dot, and a menu
 * beside the row. The row is a link when it has a target, otherwise a button that only marks it read.
 */
function NotificationRow({
  notification: n,
  onOpen,
  onToggleRead,
  onRemove,
}: {
  notification: Notification
  onOpen: () => void
  onToggleRead: () => void
  onRemove: () => void
}) {
  const Icon = ICONS[n.category]
  const content = (
    <>
      <span className="flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
        <Icon className="size-4" />
      </span>
      <span className="min-w-0 flex-1">
        <span className={n.read ? "block text-sm" : "block text-sm font-semibold"}>{n.title}</span>
        <span className="mt-0.5 line-clamp-2 block text-sm text-muted-foreground">{n.body}</span>
        <span className="mt-1 block text-xs text-muted-foreground">
          <time dateTime={n.iso} title={n.at}>
            {n.time}
          </time>
          <span className="sr-only">, {n.at}</span>
          {" · "}
          {n.category}
        </span>
      </span>
      {n.read ? null : (
        <>
          <span aria-hidden="true" className="mt-1.5 size-2 shrink-0 rounded-full bg-primary" />
          <span className="sr-only">Belum dibaca</span>
        </>
      )}
    </>
  )
  const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
  return (
    <li className={n.read ? "flex items-start gap-1 px-2 py-1" : "flex items-start gap-1 bg-muted/50 px-2 py-1"}>
      {n.href ? (
        <a href={n.href} data-notification={n.id} className={rowClass} onClick={onOpen}>
          {content}
        </a>
      ) : (
        <button type="button" data-notification={n.id} className={rowClass} onClick={onOpen}>
          {content}
        </button>
      )}
      <DropdownMenu>
        <DropdownMenuTrigger
          render={<Button variant="ghost" size="icon-sm" className="mt-1.5" aria-label={`Aksi untuk ${n.title}`} />}
        >
          <MoreHorizontalIcon />
        </DropdownMenuTrigger>
        <DropdownMenuContent align="end">
          <DropdownMenuItem onClick={onToggleRead}>{n.read ? "Tandai belum dibaca" : "Tandai dibaca"}</DropdownMenuItem>
          <DropdownMenuSeparator />
          <DropdownMenuItem variant="destructive" onClick={onRemove}>
            Hapus
          </DropdownMenuItem>
        </DropdownMenuContent>
      </DropdownMenu>
    </li>
  )
}

/**
 * The notifications page: the title and "Tandai semua dibaca" for the selected category, category chips with unread
 * counts, then a card with the Semua / Belum dibaca switch, the page menu, rows grouped by time and "Muat lagi".
 * Keep the category and the switch in the URL in a real product, as list filters do.
 */
export default function NotificationsPageDemo() {
  const [items, setItems] = useState(NOTIFICATIONS)
  const [visible, setVisible] = useState(FIRST_PAGE)
  const [category, setCategory] = useState<"semua" | Category>("semua")
  const [show, setShow] = useState<"semua" | "belum">("semua")
  const [confirmRemoveRead, setConfirmRemoveRead] = useState(false)
  /** After a delete, focus moves to the next row (or the previous one, or the empty text) instead of the page. */
  const [focusAfterRemove, setFocusAfterRemove] = useState<number | "empty" | null>(null)
  const emptyRef = useRef<HTMLParagraphElement>(null)
  /** A new filter starts again from the first page. */
  const pickCategory = (value: "semua" | Category) => {
    setCategory(value)
    setVisible(FIRST_PAGE)
  }
  const pickShow = (value: "semua" | "belum") => {
    setShow(value)
    setVisible(FIRST_PAGE)
  }

  const inCategory = (n: Notification) => category === "semua" || n.category === category
  const unread = (c: "semua" | Category) => items.filter((n) => !n.read && (c === "semua" || n.category === c)).length
  const update = (id: number, read: boolean) => setItems((all) => all.map((n) => (n.id === id ? { ...n, read } : n)))
  const markAllRead = () => setItems((all) => all.map((n) => (inCategory(n) ? { ...n, read: true } : n)))
  const readCount = items.filter((n) => n.read && inCategory(n)).length
  const removeRead = () => setItems((all) => all.filter((n) => !(n.read && inCategory(n))))

  // Filter first, then page: "Muat lagi" shows only while more of the filtered rows exist.
  const filtered = items.filter((n) => inCategory(n) && (show === "semua" || !n.read))
  const shown = filtered.slice(0, visible)
  const groups = (["Hari ini", "Sebelumnya"] as const)
    .map((label) => ({ label, rows: shown.filter((n) => n.group === label) }))
    .filter((g) => g.rows.length > 0)
  const empty = show === "belum" ? "Semua notifikasi sudah kamu baca." : "Belum ada notifikasi di kategori ini."

  const remove = (id: number) => {
    const at = shown.findIndex((n) => n.id === id)
    const next = shown[at + 1] ?? shown[at - 1]
    setFocusAfterRemove(next ? next.id : "empty")
    setItems((all) => all.filter((n) => n.id !== id))
  }
  useEffect(() => {
    if (focusAfterRemove === null) return
    // Wait a frame: the closing menu returns focus to its trigger first, and that trigger is gone.
    const frame = requestAnimationFrame(() => {
      const target =
        focusAfterRemove === "empty"
          ? emptyRef.current
          : document.querySelector<HTMLElement>(`[data-notification="${focusAfterRemove}"]`)
      target?.focus()
      setFocusAfterRemove(null)
    })
    return () => cancelAnimationFrame(frame)
  }, [focusAfterRemove])

  return (
    <div className="min-h-svh bg-background p-6 text-foreground">
      <div className="mx-auto grid max-w-3xl gap-6">
        <div className="flex flex-wrap items-start justify-between gap-4">
          <div>
            <h1 className="text-2xl font-semibold">Notifikasi</h1>
            <p className="mt-1 text-sm text-muted-foreground">Kabar terbaru soal akunmu.</p>
          </div>
          <Button variant="outline" disabled={unread(category) === 0} onClick={markAllRead}>
            <CheckCheckIcon />
            Tandai semua dibaca
          </Button>
        </div>

        <ToggleGroup
          variant="outline"
          spacing={2}
          aria-label="Filter kategori"
          // One line that scrolls sideways on phones; from sm the chips wrap.
          className="-mx-1 w-full min-w-0 flex-nowrap overflow-x-auto px-1 pb-1 sm:w-fit sm:flex-wrap sm:overflow-visible"
          value={[category]}
          // A category filter always has one value: clicking the active chip keeps it on.
          onValueChange={(value) => value.length > 0 && pickCategory(value[value.length - 1] as "semua" | Category)}
        >
          {(["semua", ...CATEGORIES] as const).map((c) => (
            <ToggleGroupItem
              key={c}
              value={c}
              // The count reads as words: "Pembayaran (1 belum dibaca)".
              aria-label={unread(c) > 0 ? `${c === "semua" ? "Semua" : c} (${unread(c)} belum dibaca)` : undefined}
            >
              {c === "semua" ? "Semua" : c}
              {unread(c) > 0 ? <span className="tabular-nums text-muted-foreground">{unread(c)}</span> : null}
            </ToggleGroupItem>
          ))}
        </ToggleGroup>

        <div className="rounded-xl border border-border bg-card">
          <div className="flex items-center justify-between gap-2 border-b border-border px-4 py-2">
            <ToggleGroup
              size="sm"
              aria-label="Tampilkan"
              value={[show]}
              onValueChange={(value) => value.length > 0 && pickShow(value[value.length - 1] as "semua" | "belum")}
            >
              <ToggleGroupItem value="semua">Semua</ToggleGroupItem>
              <ToggleGroupItem value="belum">Belum dibaca</ToggleGroupItem>
            </ToggleGroup>
            <DropdownMenu>
              <DropdownMenuTrigger render={<Button variant="ghost" size="icon-sm" aria-label="Opsi notifikasi" />}>
                <MoreHorizontalIcon />
              </DropdownMenuTrigger>
              <DropdownMenuContent align="end">
                <DropdownMenuItem render={<a href="#pengaturan-notifikasi" />}>Pengaturan notifikasi</DropdownMenuItem>
                <DropdownMenuSeparator />
                <DropdownMenuItem variant="destructive" disabled={readCount === 0} onClick={() => setConfirmRemoveRead(true)}>
                  Hapus yang sudah dibaca
                </DropdownMenuItem>
              </DropdownMenuContent>
            </DropdownMenu>
            <AlertDialog open={confirmRemoveRead} onOpenChange={setConfirmRemoveRead}>
              <AlertDialogContent>
                <AlertDialogHeader>
                  <AlertDialogTitle>Hapus {readCount} notifikasi yang sudah dibaca?</AlertDialogTitle>
                  <AlertDialogDescription>Notifikasi yang dihapus tidak bisa dikembalikan.</AlertDialogDescription>
                </AlertDialogHeader>
                <AlertDialogFooter>
                  <AlertDialogCancel autoFocus>Batal</AlertDialogCancel>
                  <AlertDialogAction
                    variant="destructive"
                    onClick={() => {
                      removeRead()
                      setConfirmRemoveRead(false)
                    }}
                  >
                    Hapus
                  </AlertDialogAction>
                </AlertDialogFooter>
              </AlertDialogContent>
            </AlertDialog>
          </div>

          {groups.length === 0 ? (
            <p ref={emptyRef} tabIndex={-1} className="px-4 py-12 text-center text-sm text-muted-foreground outline-none">
              {empty}
            </p>
          ) : (
            groups.map((g) => (
              <section key={g.label} aria-label={g.label} className="py-2">
                <h2 className="px-4 py-1 text-xs font-medium text-muted-foreground">{g.label}</h2>
                <ul>
                  {g.rows.map((n) => (
                    <NotificationRow
                      key={n.id}
                      notification={n}
                      onOpen={() => update(n.id, true)}
                      onToggleRead={() => update(n.id, !n.read)}
                      onRemove={() => remove(n.id)}
                    />
                  ))}
                </ul>
              </section>
            ))
          )}

          {filtered.length > visible ? (
            <div className="border-t border-border p-2 text-center">
              <Button variant="ghost" onClick={() => setVisible((v) => v + FIRST_PAGE)}>
                Muat lagi
              </Button>
            </div>
          ) : null}
        </div>
      </div>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { computed, nextTick, ref, type Component } from "vue"
import { CheckCheck, Disc, FileCheck, FileText, Info, MoreHorizontal, Wallet } from "@lucide/vue"
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

/**
 * The notifications page: the title and "Tandai semua dibaca" for the selected category, category chips with unread
 * counts, then a card with the Semua / Belum dibaca switch, the page menu, rows grouped by time and "Muat lagi".
 * Keep the category and the switch in the URL in a real product, as list filters do.
 */
type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"

interface Notification {
  id: number
  category: Category
  title: string
  body: string
  /** Relative time shown in the row. */
  time: string
  /** Full date and time, shown as the tooltip of the relative time. */
  at: string
  /** ISO date for the <time> element. */
  iso: string
  group: "Hari ini" | "Sebelumnya"
  read: boolean
  /** The page the notification is about. Without one, a click only marks it read. */
  href?: string
}

const ICONS: Record<Category, Component> = { Pembayaran: Wallet, Clearance: FileCheck, Laporan: FileText, Rilis: Disc, Umum: Info }
const CATEGORIES: Category[] = ["Pembayaran", "Clearance", "Laporan", "Rilis", "Umum"]

const NOTIFICATIONS: Notification[] = [
  { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" },
  { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" },
  { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" },
  { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" },
  { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" },
  { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" },
  { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true },
  { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" },
  { id: 9, category: "Laporan", title: "Laporan royalti September siap", body: "Cek pendapatan tiap platform.", time: "14 Okt 2026", at: "14 Okt 2026, 10.00", iso: "2026-10-14T10:00", group: "Sebelumnya", read: true, href: "#laporan" },
  { id: 10, category: "Pembayaran", title: "Royalti September sudah masuk", body: "Rp980.000,00 masuk ke saldomu.", time: "13 Okt 2026", at: "13 Okt 2026, 15.10", iso: "2026-10-13T15:10", group: "Sebelumnya", read: true, href: "#saldo" },
]

/** Rows shown before "Muat lagi". */
const FIRST_PAGE = 8

const items = ref(NOTIFICATIONS.map((n) => ({ ...n })))
const visible = ref(FIRST_PAGE)
const category = ref<"semua" | Category>("semua")
const show = ref<"semua" | "belum">("semua")
const confirmRemoveRead = ref(false)
const emptyText = ref<HTMLElement | null>(null)

const inCategory = (n: Notification) => category.value === "semua" || n.category === category.value
const unread = (c: "semua" | Category) => items.value.filter((n) => !n.read && (c === "semua" || n.category === c)).length
const update = (id: number, read: boolean) => {
  items.value = items.value.map((n) => (n.id === id ? { ...n, read } : n))
}
/** After a delete, focus moves to the next row (or the previous one, or the empty text) instead of the page. */
const remove = (id: number) => {
  const shown = filtered.value.slice(0, visible.value)
  const at = shown.findIndex((n) => n.id === id)
  const next = shown[at + 1] ?? shown[at - 1]
  items.value = items.value.filter((n) => n.id !== id)
  // Wait a frame: the closing menu returns focus to its trigger first, and that trigger is gone.
  nextTick(() =>
    requestAnimationFrame(() => {
      const target = next ? document.querySelector<HTMLElement>(`[data-notification="${next.id}"]`) : emptyText.value
      target?.focus()
    }),
  )
}
const markAllRead = () => {
  items.value = items.value.map((n) => (inCategory(n) ? { ...n, read: true } : n))
}
const readCount = computed(() => items.value.filter((n) => n.read && inCategory(n)).length)
const removeRead = () => {
  items.value = items.value.filter((n) => !(n.read && inCategory(n)))
  confirmRemoveRead.value = false
}
// A filter always has one value: clicking the active chip keeps it on.
// A new filter starts again from the first page.
function pickCategory(value: unknown) {
  if (typeof value === "string" && value) {
    category.value = value as "semua" | Category
    visible.value = FIRST_PAGE
  }
}
function pickShow(value: unknown) {
  if (typeof value === "string" && value) {
    show.value = value as "semua" | "belum"
    visible.value = FIRST_PAGE
  }
}

// Filter first, then page: "Muat lagi" shows only while more of the filtered rows exist.
const filtered = computed(() => items.value.filter((n) => inCategory(n) && (show.value === "semua" || !n.read)))
const groups = computed(() => {
  const shown = filtered.value.slice(0, visible.value)
  return (["Hari ini", "Sebelumnya"] as const)
    .map((label) => ({ label, rows: shown.filter((n) => n.group === label) }))
    .filter((g) => g.rows.length > 0)
})
const empty = computed(() => (show.value === "belum" ? "Semua notifikasi sudah kamu baca." : "Belum ada notifikasi di kategori ini."))
const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
</script>

<template>
  <div class="min-h-svh bg-background p-6 text-foreground">
    <div class="mx-auto grid max-w-3xl gap-6">
      <div class="flex flex-wrap items-start justify-between gap-4">
        <div>
          <h1 class="text-2xl font-semibold">Notifikasi</h1>
          <p class="mt-1 text-sm text-muted-foreground">Kabar terbaru soal akunmu.</p>
        </div>
        <Button variant="outline" :disabled="unread(category) === 0" @click="markAllRead">
          <CheckCheck />Tandai semua dibaca
        </Button>
      </div>

      <ToggleGroup
        type="single"
        variant="outline"
        :spacing="2"
        aria-label="Filter kategori"
        class="-mx-1 w-full min-w-0 flex-nowrap overflow-x-auto px-1 pb-1 sm:w-fit sm:flex-wrap sm:overflow-visible"
        :model-value="category"
        @update:model-value="pickCategory"
      >
        <!-- The count reads as words: "Pembayaran (1 belum dibaca)". -->
        <ToggleGroupItem
          v-for="c in ['semua', ...CATEGORIES]"
          :key="c"
          :value="c"
          :aria-label="unread(c as 'semua' | Category) > 0 ? `${c === 'semua' ? 'Semua' : c} (${unread(c as 'semua' | Category)} belum dibaca)` : undefined"
        >
          {{ c === "semua" ? "Semua" : c }}
          <span v-if="unread(c as 'semua' | Category) > 0" class="tabular-nums text-muted-foreground">{{ unread(c as "semua" | Category) }}</span>
        </ToggleGroupItem>
      </ToggleGroup>

      <div class="rounded-xl border border-border bg-card">
        <div class="flex items-center justify-between gap-2 border-b border-border px-4 py-2">
          <ToggleGroup type="single" size="sm" aria-label="Tampilkan" :model-value="show" @update:model-value="pickShow">
            <ToggleGroupItem value="semua">Semua</ToggleGroupItem>
            <ToggleGroupItem value="belum">Belum dibaca</ToggleGroupItem>
          </ToggleGroup>
          <DropdownMenu>
            <DropdownMenuTrigger as-child>
              <Button variant="ghost" size="icon-sm" aria-label="Opsi notifikasi"><MoreHorizontal /></Button>
            </DropdownMenuTrigger>
            <DropdownMenuContent align="end">
              <DropdownMenuItem as-child><a href="#pengaturan-notifikasi">Pengaturan notifikasi</a></DropdownMenuItem>
              <DropdownMenuSeparator />
              <DropdownMenuItem variant="destructive" :disabled="readCount === 0" @select="confirmRemoveRead = true">Hapus yang sudah dibaca</DropdownMenuItem>
            </DropdownMenuContent>
          </DropdownMenu>
          <AlertDialog v-model:open="confirmRemoveRead">
            <AlertDialogContent>
              <AlertDialogHeader>
                <AlertDialogTitle>Hapus {{ readCount }} notifikasi yang sudah dibaca?</AlertDialogTitle>
                <AlertDialogDescription>Notifikasi yang dihapus tidak bisa dikembalikan.</AlertDialogDescription>
              </AlertDialogHeader>
              <AlertDialogFooter>
                <AlertDialogCancel>Batal</AlertDialogCancel>
                <AlertDialogAction variant="destructive" @click="removeRead">Hapus</AlertDialogAction>
              </AlertDialogFooter>
            </AlertDialogContent>
          </AlertDialog>
        </div>

        <p v-if="groups.length === 0" ref="emptyText" tabindex="-1" class="px-4 py-12 text-center text-sm text-muted-foreground outline-none">{{ empty }}</p>
        <section v-for="g in groups" v-else :key="g.label" :aria-label="g.label" class="py-2">
          <h2 class="px-4 py-1 text-xs font-medium text-muted-foreground">{{ g.label }}</h2>
          <ul>
            <!-- One notification: the row is a link when it has a target, otherwise a button that only marks it read;
                 the menu sits beside it, never inside. -->
            <li
              v-for="n in g.rows"
              :key="n.id"
              :class="n.read ? 'flex items-start gap-1 px-2 py-1' : 'flex items-start gap-1 bg-muted/50 px-2 py-1'"
            >
              <component
                :is="n.href ? 'a' : 'button'"
                :href="n.href"
                :data-notification="n.id"
                :type="n.href ? undefined : 'button'"
                :class="rowClass"
                @click="update(n.id, true)"
              >
                <span class="flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
                  <component :is="ICONS[n.category]" class="size-4" />
                </span>
                <span class="min-w-0 flex-1">
                  <span :class="n.read ? 'block text-sm' : 'block text-sm font-semibold'">{{ n.title }}</span>
                  <span class="mt-0.5 line-clamp-2 block text-sm text-muted-foreground">{{ n.body }}</span>
                  <span class="mt-1 block text-xs text-muted-foreground">
                    <time :datetime="n.iso" :title="n.at">{{ n.time }}</time><span class="sr-only">, {{ n.at }}</span> · {{ n.category }}
                  </span>
                </span>
                <template v-if="!n.read">
                  <span aria-hidden="true" class="mt-1.5 size-2 shrink-0 rounded-full bg-primary" />
                  <span class="sr-only">Belum dibaca</span>
                </template>
              </component>
              <DropdownMenu>
                <DropdownMenuTrigger as-child>
                  <Button variant="ghost" size="icon-sm" class="mt-1.5" :aria-label="`Aksi untuk ${n.title}`"><MoreHorizontal /></Button>
                </DropdownMenuTrigger>
                <DropdownMenuContent align="end">
                  <DropdownMenuItem @select="update(n.id, !n.read)">{{ n.read ? "Tandai belum dibaca" : "Tandai dibaca" }}</DropdownMenuItem>
                  <DropdownMenuSeparator />
                  <DropdownMenuItem variant="destructive" @select="remove(n.id)">Hapus</DropdownMenuItem>
                </DropdownMenuContent>
              </DropdownMenu>
            </li>
          </ul>
        </section>

        <div v-if="filtered.length > visible" class="border-t border-border p-2 text-center">
          <Button variant="ghost" @click="visible += FIRST_PAGE">Muat lagi</Button>
        </div>
      </div>
    </div>
  </div>
</template>
```

**Flutter**
```dart
// The notifications page: the title and "Tandai semua dibaca" for the selected category, category chips with unread
// counts, then a card with the Semua / Belum dibaca switch, rows grouped by time and "Muat lagi".
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _categories = ['Pembayaran', 'Clearance', 'Laporan', 'Rilis', 'Umum'];
const _icons = {
  'Pembayaran': LucideIcons.wallet,
  'Clearance': LucideIcons.fileCheck,
  'Laporan': LucideIcons.fileText,
  'Rilis': LucideIcons.disc,
  'Umum': LucideIcons.info,
};

/// One notification. `time` is relative and `at` the full date and time for its tooltip. `href` is the page it is
/// about; without one, a tap only marks it read.
class _Notification {
  _Notification(
    this.id,
    this.category,
    this.title,
    this.body,
    this.time,
    this.today, {
    required this.at,
    this.read = true,
    this.href,
  });

  final int id;
  final String category, title, body, time, at;
  final bool today;
  final String? href;
  bool read;
}

List<_Notification> _notifications() => [
  _Notification(
    1,
    at: '17 Nov 2026, 14.20',
    'Pembayaran',
    'Royalti Oktober sudah masuk',
    'Rp1.250.000,00 masuk ke saldomu.',
    '5 menit lalu',
    true,
    read: false,
    href: '/saldo',
  ),
  _Notification(
    2,
    at: '17 Nov 2026, 13.25',
    'Clearance',
    'Clearance "Langit Jingga" disetujui',
    'Videomu siap tayang.',
    '1 jam lalu',
    true,
    read: false,
    href: '/clearance',
  ),
  _Notification(
    3,
    at: '17 Nov 2026, 11.05',
    'Laporan',
    'Laporan royalti Oktober siap',
    'Cek pendapatan tiap platform.',
    '3 jam lalu',
    true,
    read: false,
    href: '/laporan',
  ),
  _Notification(
    4,
    at: '16 Nov 2026, 19.40',
    'Rilis',
    '"Senja di Kota" tayang di Spotify',
    'Rilismu sudah bisa diputar.',
    'Kemarin',
    false,
    href: '/rilis',
  ),
  _Notification(
    5,
    at: '16 Nov 2026, 09.00',
    'Pembayaran',
    'Tagihan langganan November',
    'Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.',
    'Kemarin',
    false,
    href: '/tagihan',
  ),
  _Notification(
    6,
    at: '15 Nov 2026, 10.15',
    'Clearance',
    'Clearance "Kaset Pertama" perlu diperbaiki',
    'Cek catatan dari tim kami, lalu kirim ulang.',
    '2 hari lalu',
    false,
    href: '/clearance',
  ),
  _Notification(
    7,
    at: '14 Nov 2026, 08.30',
    'Umum',
    'Kata sandimu baru saja diganti',
    'Bukan kamu? Segera hubungi kami.',
    '3 hari lalu',
    false,
  ),
  _Notification(
    8,
    at: '13 Nov 2026, 16.45',
    'Rilis',
    '"Pulang Sore" dijadwalkan 28 Nov 2026',
    'Kami kirim ke semua platform di tanggal itu.',
    '4 hari lalu',
    false,
    href: '/rilis',
  ),
  _Notification(
    9,
    at: '14 Okt 2026, 10.00',
    'Laporan',
    'Laporan royalti September siap',
    'Cek pendapatan tiap platform.',
    '14 Okt 2026',
    false,
    href: '/laporan',
  ),
  _Notification(
    10,
    at: '13 Okt 2026, 15.10',
    'Pembayaran',
    'Royalti September sudah masuk',
    'Rp980.000,00 masuk ke saldomu.',
    '13 Okt 2026',
    false,
    href: '/saldo',
  ),
];

class NotificationsPageDemo extends StatefulWidget {
  const NotificationsPageDemo({super.key});

  @override
  State<NotificationsPageDemo> createState() => _NotificationsPageDemoState();
}

class _NotificationsPageDemoState extends State<NotificationsPageDemo> {
  static const _pageSize = 8;
  final _items = _notifications();
  final _pageMenu = ShadContextMenuController();
  var _visible = _pageSize;
  var _category = 'semua';
  var _unreadOnly = false;

  bool _inCategory(_Notification n) =>
      _category == 'semua' || n.category == _category;
  int _unread(String category) => _items
      .where((n) => !n.read && (category == 'semua' || n.category == category))
      .length;

  @override
  void dispose() {
    _pageMenu.dispose();
    super.dispose();
  }

  /// Deleting is final, so ask first. Cancel takes the focus; the destructive action sits last.
  Future<void> _confirmRemoveRead() async {
    _pageMenu.hide();
    final count = _items.where((n) => n.read && _inCategory(n)).length;
    final confirmed = await showShadDialog<bool>(
      context: context,
      builder: (context) => ShadDialog.alert(
        title: Text('Hapus $count notifikasi yang sudah dibaca?'),
        description: const Text(
          'Notifikasi yang dihapus tidak bisa dikembalikan.',
        ),
        actions: [
          ShadButton.outline(
            autofocus: true,
            child: const Text('Batal'),
            onPressed: () => Navigator.of(context).pop(false),
          ),
          ShadButton.destructive(
            child: const Text('Hapus'),
            onPressed: () => Navigator.of(context).pop(true),
          ),
        ],
      ),
    );
    if (confirmed == true) {
      setState(() => _items.removeWhere((n) => n.read && _inCategory(n)));
    }
  }

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    // Filter first, then page: "Muat lagi" shows only while more of the filtered rows exist.
    final filtered = _items
        .where((n) => _inCategory(n) && (!_unreadOnly || !n.read))
        .toList();
    final shown = filtered.take(_visible).toList();
    final groups = [
      ('Hari ini', shown.where((n) => n.today).toList()),
      ('Sebelumnya', shown.where((n) => !n.today).toList()),
    ].where((g) => g.$2.isNotEmpty);
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 720),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          Row(
            children: [
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text('Notifikasi', style: theme.textTheme.h3),
                    Text(
                      'Kabar terbaru soal akunmu.',
                      style: theme.textTheme.muted,
                    ),
                  ],
                ),
              ),
              ShadButton.outline(
                leading: const Icon(LucideIcons.checkCheck, size: 16),
                enabled: _unread(_category) > 0,
                onPressed: () => setState(() {
                  for (final n in _items.where(_inCategory)) {
                    n.read = true;
                  }
                }),
                child: const Text('Tandai semua dibaca'),
              ),
            ],
          ),
          const SizedBox(height: 16),
          // A category filter always has one value: allowDeselection keeps the active chip on. On phones the chips
          // scroll sideways.
          Semantics(
            label: 'Filter kategori',
            child: SingleChildScrollView(
              scrollDirection: Axis.horizontal,
              child: ShadToggleGroup<String>(
                initialValue: 'semua',
                allowDeselection: false,
                variant: ShadToggleVariant.outline,
                spacing: 8,
                // A new filter starts again from the first page.
                onChanged: (value) => setState(() {
                  _category = value ?? 'semua';
                  _visible = _pageSize;
                }),
                items: [
                  for (final c in ['semua', ..._categories])
                    ShadToggleGroupItem(
                      value: c,
                      // The count reads as words: "Pembayaran (1 belum dibaca)".
                      child: Semantics(
                        label: _unread(c) > 0
                            ? '${c == 'semua' ? 'Semua' : c} (${_unread(c)} belum dibaca)'
                            : null,
                        excludeSemantics: _unread(c) > 0,
                        child: Row(
                          mainAxisSize: MainAxisSize.min,
                          spacing: 6,
                          children: [
                            Text(c == 'semua' ? 'Semua' : c),
                            if (_unread(c) > 0)
                              Text(
                                '${_unread(c)}',
                                style: theme.textTheme.muted,
                              ),
                          ],
                        ),
                      ),
                    ),
                ],
              ),
            ),
          ),
          const SizedBox(height: 16),
          ShadCard(
            padding: EdgeInsets.zero,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                Padding(
                  padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
                  child: Row(
                    children: [
                      Expanded(
                        child: Semantics(
                          label: 'Tampilkan',
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: ShadToggleGroup<bool>(
                              initialValue: false,
                              allowDeselection: false,
                              size: ShadButtonSize.sm,
                              onChanged: (value) => setState(() {
                                _unreadOnly = value ?? false;
                                _visible = _pageSize;
                              }),
                              items: const [
                                ShadToggleGroupItem(
                                  value: false,
                                  child: Text('Semua'),
                                ),
                                ShadToggleGroupItem(
                                  value: true,
                                  child: Text('Belum dibaca'),
                                ),
                              ],
                            ),
                          ),
                        ),
                      ),
                      ShadContextMenu(
                        controller: _pageMenu,
                        items: [
                          // Opens the notification settings; call your router here.
                          const ShadContextMenuItem(
                            child: Text('Pengaturan notifikasi'),
                          ),
                          const ShadSeparator.horizontal(
                            margin: EdgeInsets.symmetric(vertical: 4),
                          ),
                          ShadContextMenuItem(
                            enabled: _items.any(
                              (n) => n.read && _inCategory(n),
                            ),
                            onPressed: _confirmRemoveRead,
                            child: Text(
                              'Hapus yang sudah dibaca',
                              style: TextStyle(
                                color: context.sosialoka.destructive,
                              ),
                            ),
                          ),
                        ],
                        child: Semantics(
                          label: 'Opsi notifikasi',
                          child: ShadIconButton.ghost(
                            icon: const Icon(LucideIcons.ellipsis),
                            onPressed: _pageMenu.toggle,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
                const ShadSeparator.horizontal(margin: EdgeInsets.zero),
                if (groups.isEmpty)
                  Padding(
                    padding: const EdgeInsets.symmetric(vertical: 48),
                    child: Text(
                      _unreadOnly
                          ? 'Semua notifikasi sudah kamu baca.'
                          : 'Belum ada notifikasi di kategori ini.',
                      textAlign: TextAlign.center,
                      style: theme.textTheme.muted,
                    ),
                  ),
                for (final (label, rows) in groups) ...[
                  Padding(
                    padding: const EdgeInsets.fromLTRB(16, 8, 16, 2),
                    child: Text(
                      label,
                      style: theme.textTheme.muted.copyWith(fontSize: 12),
                    ),
                  ),
                  for (final n in rows)
                    _NotificationRow(
                      notification: n,
                      onOpen: () => setState(() => n.read = true),
                      onToggleRead: () => setState(() => n.read = !n.read),
                      onRemove: () => setState(() => _items.remove(n)),
                    ),
                ],
                if (filtered.length > _visible)
                  Padding(
                    padding: const EdgeInsets.all(8),
                    child: Center(
                      child: ShadButton.ghost(
                        onPressed: () => setState(() => _visible += _pageSize),
                        child: const Text('Muat lagi'),
                      ),
                    ),
                  ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

/// One notification: category icon, title (bold while unread), body clamped to two lines, time and category, an
/// unread dot, and the row menu beside it.
class _NotificationRow extends StatefulWidget {
  const _NotificationRow({
    required this.notification,
    required this.onOpen,
    required this.onToggleRead,
    required this.onRemove,
  });

  final _Notification notification;
  final VoidCallback onOpen, onToggleRead, onRemove;

  @override
  State<_NotificationRow> createState() => _NotificationRowState();
}

class _NotificationRowState extends State<_NotificationRow> {
  final menu = ShadContextMenuController();
  var _focused = false;

  @override
  void dispose() {
    menu.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final n = widget.notification;
    return ColoredBox(
      color: n.read
          ? const Color(0x00000000)
          : theme.colorScheme.muted.withValues(alpha: 0.5),
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          spacing: 12,
          children: [
            Expanded(
              child: Semantics(
                // A row with a target opens it (call your router here); every row is marked read. Enter and Space
                // open a focused row, as a tap does.
                link: n.href != null,
                button: n.href == null,
                child: FocusableActionDetector(
                  mouseCursor: SystemMouseCursors.click,
                  onShowFocusHighlight: (value) =>
                      setState(() => _focused = value),
                  actions: {
                    ActivateIntent: CallbackAction<ActivateIntent>(
                      onInvoke: (_) => widget.onOpen(),
                    ),
                  },
                  child: GestureDetector(
                    behavior: HitTestBehavior.opaque,
                    onTap: widget.onOpen,
                    child: DecoratedBox(
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(8),
                        border: Border.all(
                          color: _focused
                              ? theme.colorScheme.ring
                              : const Color(0x00000000),
                          width: 2,
                        ),
                      ),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        spacing: 12,
                        children: [
                          Container(
                            width: 36,
                            height: 36,
                            decoration: BoxDecoration(
                              color: theme.colorScheme.muted,
                              shape: BoxShape.circle,
                            ),
                            child: Icon(
                              _icons[n.category],
                              size: 16,
                              color: theme.colorScheme.mutedForeground,
                            ),
                          ),
                          Expanded(
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              spacing: 2,
                              children: [
                                Text(
                                  n.title,
                                  style: theme.textTheme.small.copyWith(
                                    fontWeight: n.read
                                        ? FontWeight.w400
                                        : FontWeight.w600,
                                  ),
                                ),
                                Text(
                                  n.body,
                                  maxLines: 2,
                                  overflow: TextOverflow.ellipsis,
                                  style: theme.textTheme.muted,
                                ),
                                Row(
                                  children: [
                                    ShadTooltip(
                                      builder: (context) => Text(n.at),
                                      child: Text(
                                        n.time,
                                        style: theme.textTheme.muted.copyWith(
                                          fontSize: 12,
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Text(
                                        ' · ${n.category}',
                                        maxLines: 1,
                                        overflow: TextOverflow.ellipsis,
                                        style: theme.textTheme.muted.copyWith(
                                          fontSize: 12,
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                          if (!n.read)
                            Semantics(
                              label: 'Belum dibaca',
                              child: Container(
                                margin: const EdgeInsets.only(top: 6),
                                width: 8,
                                height: 8,
                                decoration: BoxDecoration(
                                  color: theme.colorScheme.primary,
                                  shape: BoxShape.circle,
                                ),
                              ),
                            ),
                        ],
                      ),
                    ),
                  ),
                ),
              ),
            ),
            ShadContextMenu(
              controller: menu,
              items: [
                ShadContextMenuItem(
                  onPressed: widget.onToggleRead,
                  child: Text(n.read ? 'Tandai belum dibaca' : 'Tandai dibaca'),
                ),
                const ShadSeparator.horizontal(
                  margin: EdgeInsets.symmetric(vertical: 4),
                ),
                ShadContextMenuItem(
                  onPressed: widget.onRemove,
                  child: Text(
                    'Hapus',
                    style: TextStyle(color: context.sosialoka.destructive),
                  ),
                ),
              ],
              child: Semantics(
                label: 'Aksi untuk ${n.title}',
                child: ShadIconButton.ghost(
                  icon: const Icon(LucideIcons.ellipsis),
                  onPressed: menu.toggle,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
```

## Panel

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/notifications/_

**React**
```tsx
import { useState } from "react"
import {
  BellIcon,
  DiscIcon,
  FileCheckIcon,
  FileTextIcon,
  InfoIcon,
  MoreHorizontalIcon,
  WalletIcon,
  type LucideIcon,
} from "lucide-react"
import { DashboardIconButton } from "@/components/blocks/dashboard-shell"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "@/components/ui/popover"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"

interface Notification {
  id: number
  category: Category
  title: string
  body: string
  /** Relative time shown in the row. */
  time: string
  /** Full date and time, shown as the tooltip of the relative time. */
  at: string
  /** ISO date for the <time> element. */
  iso: string
  group: "Hari ini" | "Sebelumnya"
  read: boolean
  /** The page the notification is about. Without one, a click only marks it read. */
  href?: string
}

const ICONS: Record<Category, LucideIcon> = {
  Pembayaran: WalletIcon,
  Clearance: FileCheckIcon,
  Laporan: FileTextIcon,
  Rilis: DiscIcon,
  Umum: InfoIcon,
}

/** The newest notifications; the panel shows at most 8, the page shows the rest. */
const NOTIFICATIONS: Notification[] = [
  { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" },
  { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" },
  { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" },
  { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" },
  { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" },
  { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" },
  { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true },
  { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" },
]

/** The most rows the panel shows; "Lihat semua notifikasi" opens the page for the rest. */
const PANEL_ROWS = 8

/**
 * One notification: category icon, title (bold while unread), body, time and category, an unread dot, and a menu
 * beside the row. The row is a link when it has a target, otherwise a button that only marks it read.
 */
function NotificationRow({
  notification: n,
  onOpen,
  onToggleRead,
  onRemove,
}: {
  notification: Notification
  onOpen: () => void
  onToggleRead: () => void
  onRemove: () => void
}) {
  const Icon = ICONS[n.category]
  const content = (
    <>
      <span className="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
        <Icon className="size-4" />
      </span>
      <span className="min-w-0 flex-1">
        <span className={n.read ? "block text-sm" : "block text-sm font-semibold"}>{n.title}</span>
        <span className="mt-0.5 line-clamp-2 block text-xs text-muted-foreground">{n.body}</span>
        <span className="mt-1 block text-xs text-muted-foreground">
          <time dateTime={n.iso} title={n.at}>
            {n.time}
          </time>
          <span className="sr-only">, {n.at}</span>
          {" · "}
          {n.category}
        </span>
      </span>
      {n.read ? null : (
        <>
          <span aria-hidden="true" className="mt-1.5 size-2 shrink-0 rounded-full bg-primary" />
          <span className="sr-only">Belum dibaca</span>
        </>
      )}
    </>
  )
  const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
  return (
    <li className={n.read ? "flex items-start gap-1 px-2 py-0.5" : "flex items-start gap-1 bg-muted/50 px-2 py-0.5"}>
      {n.href ? (
        <a href={n.href} className={rowClass} onClick={onOpen}>
          {content}
        </a>
      ) : (
        <button type="button" className={rowClass} onClick={onOpen}>
          {content}
        </button>
      )}
      <DropdownMenu>
        <DropdownMenuTrigger
          render={<Button variant="ghost" size="icon-sm" className="mt-1.5" aria-label={`Aksi untuk ${n.title}`} />}
        >
          <MoreHorizontalIcon />
        </DropdownMenuTrigger>
        <DropdownMenuContent align="end">
          <DropdownMenuItem onClick={onToggleRead}>{n.read ? "Tandai belum dibaca" : "Tandai dibaca"}</DropdownMenuItem>
          <DropdownMenuSeparator />
          <DropdownMenuItem variant="destructive" onClick={onRemove}>
            Hapus
          </DropdownMenuItem>
        </DropdownMenuContent>
      </DropdownMenu>
    </li>
  )
}

/**
 * The bell panel: the Dashboard header's bell with the unread count opens a 360px popover with "Tandai semua
 * dibaca", the Semua / Belum dibaca switch, at most 8 rows grouped by time, and a link to the notifications page.
 * On phones, let the bell open the page instead.
 */
export default function NotificationPanelDemo() {
  const [items, setItems] = useState(NOTIFICATIONS)
  const [show, setShow] = useState<"semua" | "belum">("semua")

  const unread = items.filter((n) => !n.read).length
  const update = (id: number, read: boolean) => setItems((all) => all.map((n) => (n.id === id ? { ...n, read } : n)))

  // Filter first, then cap at 8 rows.
  const shown = items.filter((n) => show === "semua" || !n.read).slice(0, PANEL_ROWS)
  const groups = (["Hari ini", "Sebelumnya"] as const)
    .map((label) => ({ label, rows: shown.filter((n) => n.group === label) }))
    .filter((g) => g.rows.length > 0)

  return (
    <div className="flex justify-end p-4">
      <Popover>
        <PopoverTrigger
          render={
            <DashboardIconButton label="Notifikasi" badge={unread}>
              <BellIcon />
            </DashboardIconButton>
          }
        />
        <PopoverContent align="end" className="w-[360px] max-w-[calc(100vw-2rem)] gap-0 p-0">
          <div className="flex items-center justify-between gap-2 border-b border-border px-4 py-3">
            <PopoverTitle className="text-sm font-semibold">Notifikasi</PopoverTitle>
            <Button
              variant="link"
              size="xs"
              disabled={unread === 0}
              onClick={() => setItems((all) => all.map((n) => ({ ...n, read: true })))}
            >
              Tandai semua dibaca
            </Button>
          </div>
          <div className="border-b border-border px-4 py-2">
            <ToggleGroup
              size="sm"
              aria-label="Tampilkan"
              value={[show]}
              onValueChange={(value) => value.length > 0 && setShow(value[value.length - 1] as "semua" | "belum")}
            >
              <ToggleGroupItem value="semua">Semua</ToggleGroupItem>
              <ToggleGroupItem value="belum" aria-label={unread > 0 ? `Belum dibaca (${unread})` : undefined}>
                Belum dibaca
                {unread > 0 ? <span className="tabular-nums text-muted-foreground">{unread}</span> : null}
              </ToggleGroupItem>
            </ToggleGroup>
          </div>
          <div className="max-h-[420px] overflow-y-auto">
            {groups.length === 0 ? (
              <p className="px-4 py-10 text-center text-sm text-muted-foreground">Semua notifikasi sudah kamu baca.</p>
            ) : (
              groups.map((g) => (
                <section key={g.label} aria-label={g.label} className="py-1.5">
                  <h3 className="px-4 py-1 text-xs font-medium text-muted-foreground">{g.label}</h3>
                  <ul>
                    {g.rows.map((n) => (
                      <NotificationRow
                        key={n.id}
                        notification={n}
                        onOpen={() => update(n.id, true)}
                        onToggleRead={() => update(n.id, !n.read)}
                        onRemove={() => setItems((all) => all.filter((x) => x.id !== n.id))}
                      />
                    ))}
                  </ul>
                </section>
              ))
            )}
          </div>
          <a
            href="#notifikasi"
            className="block border-t border-border px-4 py-3 text-center text-sm font-medium text-primary-text hover:underline"
          >
            Lihat semua notifikasi
          </a>
        </PopoverContent>
      </Popover>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { computed, ref, type Component } from "vue"
import { Bell, Disc, FileCheck, FileText, Info, MoreHorizontal, Wallet } from "@lucide/vue"
import { DashboardIconButton } from "@/components/blocks/dashboard-shell"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import { TooltipProvider } from "@/components/ui/tooltip"

/**
 * The bell panel: the Dashboard header's bell with the unread count opens a 360px popover with "Tandai semua
 * dibaca", the Semua / Belum dibaca switch, at most 8 rows grouped by time, and a link to the notifications page.
 * On phones, let the bell open the page instead.
 */
type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"

interface Notification {
  id: number
  category: Category
  title: string
  body: string
  /** Relative time shown in the row. */
  time: string
  /** Full date and time, shown as the tooltip of the relative time. */
  at: string
  /** ISO date for the <time> element. */
  iso: string
  group: "Hari ini" | "Sebelumnya"
  read: boolean
  /** The page the notification is about. Without one, a click only marks it read. */
  href?: string
}

const ICONS: Record<Category, Component> = { Pembayaran: Wallet, Clearance: FileCheck, Laporan: FileText, Rilis: Disc, Umum: Info }

/** The newest notifications; the panel shows at most 8, the page shows the rest. */
const NOTIFICATIONS: Notification[] = [
  { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" },
  { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" },
  { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" },
  { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" },
  { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" },
  { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" },
  { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true },
  { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" },
]

/** The most rows the panel shows; "Lihat semua notifikasi" opens the page for the rest. */
const PANEL_ROWS = 8

const items = ref(NOTIFICATIONS.map((n) => ({ ...n })))
const show = ref<"semua" | "belum">("semua")

const unread = computed(() => items.value.filter((n) => !n.read).length)
const update = (id: number, read: boolean) => {
  items.value = items.value.map((n) => (n.id === id ? { ...n, read } : n))
}
const remove = (id: number) => {
  items.value = items.value.filter((n) => n.id !== id)
}
const markAllRead = () => {
  items.value = items.value.map((n) => ({ ...n, read: true }))
}
function pickShow(value: unknown) {
  if (typeof value === "string" && value) show.value = value as "semua" | "belum"
}

const groups = computed(() => {
  // Filter first, then cap at 8 rows.
  const shown = items.value.filter((n) => show.value === "semua" || !n.read).slice(0, PANEL_ROWS)
  return (["Hari ini", "Sebelumnya"] as const)
    .map((label) => ({ label, rows: shown.filter((n) => n.group === label) }))
    .filter((g) => g.rows.length > 0)
})
const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
</script>

<template>
  <!-- The Dashboard shell already provides tooltips; this demo shows the bell on its own. -->
  <TooltipProvider>
    <div class="flex justify-end p-4">
      <Popover>
        <PopoverTrigger as-child>
          <DashboardIconButton label="Notifikasi" :badge="unread"><Bell /></DashboardIconButton>
        </PopoverTrigger>
        <PopoverContent align="end" class="w-[360px] max-w-[calc(100vw-2rem)] p-0">
          <div class="flex items-center justify-between gap-2 border-b border-border px-4 py-3">
            <h2 class="text-sm font-semibold">Notifikasi</h2>
            <Button variant="link" size="xs" :disabled="unread === 0" @click="markAllRead">Tandai semua dibaca</Button>
          </div>
          <div class="border-b border-border px-4 py-2">
            <ToggleGroup type="single" size="sm" aria-label="Tampilkan" :model-value="show" @update:model-value="pickShow">
              <ToggleGroupItem value="semua">Semua</ToggleGroupItem>
              <ToggleGroupItem value="belum" :aria-label="unread > 0 ? `Belum dibaca (${unread})` : undefined">
                Belum dibaca
                <span v-if="unread > 0" class="tabular-nums text-muted-foreground">{{ unread }}</span>
              </ToggleGroupItem>
            </ToggleGroup>
          </div>
          <div class="max-h-[420px] overflow-y-auto">
            <p v-if="groups.length === 0" class="px-4 py-10 text-center text-sm text-muted-foreground">Semua notifikasi sudah kamu baca.</p>
            <section v-for="g in groups" v-else :key="g.label" :aria-label="g.label" class="py-1.5">
              <h3 class="px-4 py-1 text-xs font-medium text-muted-foreground">{{ g.label }}</h3>
              <ul>
                <!-- One notification: the row is a link when it has a target, otherwise a button that only marks it read;
                     the menu sits beside it, never inside. -->
                <li
                  v-for="n in g.rows"
                  :key="n.id"
                  :class="n.read ? 'flex items-start gap-1 px-2 py-0.5' : 'flex items-start gap-1 bg-muted/50 px-2 py-0.5'"
                >
                  <component
                    :is="n.href ? 'a' : 'button'"
                    :href="n.href"
                    :type="n.href ? undefined : 'button'"
                    :class="rowClass"
                    @click="update(n.id, true)"
                  >
                    <span class="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
                      <component :is="ICONS[n.category]" class="size-4" />
                    </span>
                    <span class="min-w-0 flex-1">
                      <span :class="n.read ? 'block text-sm' : 'block text-sm font-semibold'">{{ n.title }}</span>
                      <span class="mt-0.5 line-clamp-2 block text-xs text-muted-foreground">{{ n.body }}</span>
                      <span class="mt-1 block text-xs text-muted-foreground">
                        <time :datetime="n.iso" :title="n.at">{{ n.time }}</time><span class="sr-only">, {{ n.at }}</span> · {{ n.category }}
                      </span>
                    </span>
                    <template v-if="!n.read">
                    <span aria-hidden="true" class="mt-1.5 size-2 shrink-0 rounded-full bg-primary" />
                    <span class="sr-only">Belum dibaca</span>
                  </template>
                  </component>
                  <DropdownMenu>
                    <DropdownMenuTrigger as-child>
                      <Button variant="ghost" size="icon-sm" class="mt-1.5" :aria-label="`Aksi untuk ${n.title}`"><MoreHorizontal /></Button>
                    </DropdownMenuTrigger>
                    <DropdownMenuContent align="end">
                      <DropdownMenuItem @select="update(n.id, !n.read)">{{ n.read ? "Tandai belum dibaca" : "Tandai dibaca" }}</DropdownMenuItem>
                      <DropdownMenuSeparator />
                      <DropdownMenuItem variant="destructive" @select="remove(n.id)">Hapus</DropdownMenuItem>
                    </DropdownMenuContent>
                  </DropdownMenu>
                </li>
              </ul>
            </section>
          </div>
          <a
            href="#notifikasi"
            class="block border-t border-border px-4 py-3 text-center text-sm font-medium text-primary-text hover:underline"
          >Lihat semua notifikasi</a>
        </PopoverContent>
      </Popover>
    </div>
  </TooltipProvider>
</template>
```

**Flutter**
```dart
// The bell panel for tablets and desktop: the bell with the unread count opens a 360-wide popover with
// "Tandai semua dibaca", the Semua / Belum dibaca switch, at most 8 rows grouped by time, and a link to the page.
// On phones, let the bell open the notifications page instead.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _icons = {
  'Pembayaran': LucideIcons.wallet,
  'Clearance': LucideIcons.fileCheck,
  'Laporan': LucideIcons.fileText,
  'Rilis': LucideIcons.disc,
  'Umum': LucideIcons.info,
};

/// One notification. `time` is relative and `at` the full date and time for its tooltip. `href` is the page it is
/// about; without one, a tap only marks it read.
class _Notification {
  _Notification(
    this.category,
    this.title,
    this.body,
    this.time,
    this.today, {
    required this.at,
    this.read = true,
    this.href,
  });

  final String category, title, body, time, at;
  final bool today;
  final String? href;
  bool read;
}

/// The newest notifications; the panel shows at most 8, the page shows the rest.
List<_Notification> _notifications() => [
  _Notification(
    'Pembayaran',
    at: '17 Nov 2026, 14.20',
    'Royalti Oktober sudah masuk',
    'Rp1.250.000,00 masuk ke saldomu.',
    '5 menit lalu',
    true,
    read: false,
    href: '/saldo',
  ),
  _Notification(
    'Clearance',
    at: '17 Nov 2026, 13.25',
    'Clearance "Langit Jingga" disetujui',
    'Videomu siap tayang.',
    '1 jam lalu',
    true,
    read: false,
    href: '/clearance',
  ),
  _Notification(
    'Laporan',
    at: '17 Nov 2026, 11.05',
    'Laporan royalti Oktober siap',
    'Cek pendapatan tiap platform.',
    '3 jam lalu',
    true,
    read: false,
    href: '/laporan',
  ),
  _Notification(
    'Rilis',
    at: '16 Nov 2026, 19.40',
    '"Senja di Kota" tayang di Spotify',
    'Rilismu sudah bisa diputar.',
    'Kemarin',
    false,
    href: '/rilis',
  ),
  _Notification(
    'Pembayaran',
    at: '16 Nov 2026, 09.00',
    'Tagihan langganan November',
    'Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.',
    'Kemarin',
    false,
    href: '/tagihan',
  ),
  _Notification(
    'Clearance',
    at: '15 Nov 2026, 10.15',
    'Clearance "Kaset Pertama" perlu diperbaiki',
    'Cek catatan dari tim kami, lalu kirim ulang.',
    '2 hari lalu',
    false,
    href: '/clearance',
  ),
  _Notification(
    'Umum',
    at: '14 Nov 2026, 08.30',
    'Kata sandimu baru saja diganti',
    'Bukan kamu? Segera hubungi kami.',
    '3 hari lalu',
    false,
  ),
  _Notification(
    'Rilis',
    at: '13 Nov 2026, 16.45',
    '"Pulang Sore" dijadwalkan 28 Nov 2026',
    'Kami kirim ke semua platform di tanggal itu.',
    '4 hari lalu',
    false,
    href: '/rilis',
  ),
];

class NotificationPanelDemo extends StatefulWidget {
  const NotificationPanelDemo({super.key});

  @override
  State<NotificationPanelDemo> createState() => _NotificationPanelDemoState();
}

class _NotificationPanelDemoState extends State<NotificationPanelDemo> {
  final popover = ShadPopoverController();
  final _items = _notifications();
  var _unreadOnly = false;

  int get _unread => _items.where((n) => !n.read).length;

  @override
  void dispose() {
    popover.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    return ShadPopover(
      controller: popover,
      padding: EdgeInsets.zero,
      popover: (context) => StatefulBuilder(
        builder: (context, setPanelState) {
          void update(VoidCallback change) {
            setPanelState(change);
            setState(() {});
          }

          // Filter first, then cap at 8 rows.
          final shown = _items
              .where((n) => !_unreadOnly || !n.read)
              .take(8)
              .toList();
          final groups = [
            ('Hari ini', shown.where((n) => n.today).toList()),
            ('Sebelumnya', shown.where((n) => !n.today).toList()),
          ].where((g) => g.$2.isNotEmpty);
          return SizedBox(
            width: 360,
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                Padding(
                  padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
                  child: Row(
                    children: [
                      Expanded(
                        child: Text('Notifikasi', style: theme.textTheme.large),
                      ),
                      ShadButton.link(
                        size: ShadButtonSize.sm,
                        enabled: _unread > 0,
                        onPressed: () => update(() {
                          for (final n in _items) {
                            n.read = true;
                          }
                        }),
                        child: const Text('Tandai semua dibaca'),
                      ),
                    ],
                  ),
                ),
                const ShadSeparator.horizontal(margin: EdgeInsets.zero),
                Padding(
                  padding: const EdgeInsets.symmetric(
                    horizontal: 16,
                    vertical: 8,
                  ),
                  child: Semantics(
                    label: 'Tampilkan',
                    child: Align(
                      alignment: Alignment.centerLeft,
                      child: ShadToggleGroup<bool>(
                        initialValue: _unreadOnly,
                        allowDeselection: false,
                        size: ShadButtonSize.sm,
                        onChanged: (value) =>
                            update(() => _unreadOnly = value ?? false),
                        items: [
                          const ShadToggleGroupItem(
                            value: false,
                            child: Text('Semua'),
                          ),
                          ShadToggleGroupItem(
                            value: true,
                            child: Semantics(
                              label: _unread > 0
                                  ? 'Belum dibaca ($_unread)'
                                  : null,
                              excludeSemantics: _unread > 0,
                              child: Text(
                                _unread > 0
                                    ? 'Belum dibaca $_unread'
                                    : 'Belum dibaca',
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
                const ShadSeparator.horizontal(margin: EdgeInsets.zero),
                ConstrainedBox(
                  constraints: const BoxConstraints(maxHeight: 420),
                  child: groups.isEmpty
                      ? Padding(
                          padding: const EdgeInsets.symmetric(vertical: 40),
                          child: Text(
                            'Semua notifikasi sudah kamu baca.',
                            textAlign: TextAlign.center,
                            style: theme.textTheme.muted,
                          ),
                        )
                      : ListView(
                          shrinkWrap: true,
                          children: [
                            for (final (label, rows) in groups) ...[
                              Padding(
                                padding: const EdgeInsets.fromLTRB(
                                  16,
                                  10,
                                  16,
                                  4,
                                ),
                                child: Text(
                                  label,
                                  style: theme.textTheme.muted.copyWith(
                                    fontSize: 12,
                                  ),
                                ),
                              ),
                              for (final n in rows)
                                _PanelRow(
                                  notification: n,
                                  onOpen: () => update(() => n.read = true),
                                  onToggleRead: () =>
                                      update(() => n.read = !n.read),
                                  onRemove: () =>
                                      update(() => _items.remove(n)),
                                ),
                            ],
                          ],
                        ),
                ),
                const ShadSeparator.horizontal(margin: EdgeInsets.zero),
                // Opens the notifications page; call your router here.
                ShadButton.ghost(
                  onPressed: popover.hide,
                  child: const Text('Lihat semua notifikasi'),
                ),
              ],
            ),
          );
        },
      ),
      child: Semantics(
        label: _unread > 0 ? 'Notifikasi ($_unread)' : 'Notifikasi',
        button: true,
        child: Stack(
          clipBehavior: Clip.none,
          children: [
            ShadIconButton.ghost(
              icon: const Icon(LucideIcons.bell),
              onPressed: popover.toggle,
            ),
            if (_unread > 0)
              Positioned(
                top: 2,
                right: 2,
                child: ExcludeSemantics(
                  child: Container(
                    padding: const EdgeInsets.symmetric(horizontal: 4),
                    constraints: const BoxConstraints(
                      minWidth: 16,
                      minHeight: 16,
                    ),
                    decoration: BoxDecoration(
                      color: theme.colorScheme.destructive,
                      borderRadius: BorderRadius.circular(6),
                    ),
                    alignment: Alignment.center,
                    child: Text(
                      _unread > 99 ? '99+' : '$_unread',
                      style: TextStyle(
                        fontSize: 10,
                        fontWeight: FontWeight.w600,
                        color: theme.colorScheme.destructiveForeground,
                      ),
                    ),
                  ),
                ),
              ),
          ],
        ),
      ),
    );
  }
}

/// A panel row: category icon, title (bold while unread), body clamped to two lines, time and category, the unread
/// dot, and the row menu beside it.
class _PanelRow extends StatefulWidget {
  const _PanelRow({
    required this.notification,
    required this.onOpen,
    required this.onToggleRead,
    required this.onRemove,
  });

  final _Notification notification;
  final VoidCallback onOpen, onToggleRead, onRemove;

  @override
  State<_PanelRow> createState() => _PanelRowState();
}

class _PanelRowState extends State<_PanelRow> {
  final menu = ShadContextMenuController();
  var _focused = false;

  @override
  void dispose() {
    menu.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final n = widget.notification;
    return ColoredBox(
      color: n.read
          ? const Color(0x00000000)
          : theme.colorScheme.muted.withValues(alpha: 0.5),
      child: Padding(
        padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          spacing: 8,
          children: [
            Expanded(
              child: Semantics(
                // A row with a target opens it (call your router here); every row is marked read. Enter and Space
                // open a focused row, as a tap does.
                link: n.href != null,
                button: n.href == null,
                child: FocusableActionDetector(
                  mouseCursor: SystemMouseCursors.click,
                  onShowFocusHighlight: (value) =>
                      setState(() => _focused = value),
                  actions: {
                    ActivateIntent: CallbackAction<ActivateIntent>(
                      onInvoke: (_) => widget.onOpen(),
                    ),
                  },
                  child: GestureDetector(
                    behavior: HitTestBehavior.opaque,
                    onTap: widget.onOpen,
                    child: DecoratedBox(
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(8),
                        border: Border.all(
                          color: _focused
                              ? theme.colorScheme.ring
                              : const Color(0x00000000),
                          width: 2,
                        ),
                      ),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        spacing: 12,
                        children: [
                          Container(
                            width: 32,
                            height: 32,
                            decoration: BoxDecoration(
                              color: theme.colorScheme.muted,
                              shape: BoxShape.circle,
                            ),
                            child: Icon(
                              _icons[n.category],
                              size: 16,
                              color: theme.colorScheme.mutedForeground,
                            ),
                          ),
                          Expanded(
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              spacing: 2,
                              children: [
                                Text(
                                  n.title,
                                  style: theme.textTheme.small.copyWith(
                                    fontWeight: n.read
                                        ? FontWeight.w400
                                        : FontWeight.w600,
                                  ),
                                ),
                                Text(
                                  n.body,
                                  maxLines: 2,
                                  overflow: TextOverflow.ellipsis,
                                  style: theme.textTheme.muted.copyWith(
                                    fontSize: 12,
                                  ),
                                ),
                                Row(
                                  children: [
                                    ShadTooltip(
                                      builder: (context) => Text(n.at),
                                      child: Text(
                                        n.time,
                                        style: theme.textTheme.muted.copyWith(
                                          fontSize: 12,
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Text(
                                        ' · ${n.category}',
                                        maxLines: 1,
                                        overflow: TextOverflow.ellipsis,
                                        style: theme.textTheme.muted.copyWith(
                                          fontSize: 12,
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                          if (!n.read)
                            Semantics(
                              label: 'Belum dibaca',
                              child: Container(
                                margin: const EdgeInsets.only(top: 6),
                                width: 8,
                                height: 8,
                                decoration: BoxDecoration(
                                  color: theme.colorScheme.primary,
                                  shape: BoxShape.circle,
                                ),
                              ),
                            ),
                        ],
                      ),
                    ),
                  ),
                ),
              ),
            ),
            ShadContextMenu(
              controller: menu,
              items: [
                ShadContextMenuItem(
                  onPressed: widget.onToggleRead,
                  child: Text(n.read ? 'Tandai belum dibaca' : 'Tandai dibaca'),
                ),
                const ShadSeparator.horizontal(
                  margin: EdgeInsets.symmetric(vertical: 4),
                ),
                ShadContextMenuItem(
                  onPressed: widget.onRemove,
                  child: Text(
                    'Hapus',
                    style: TextStyle(color: context.sosialoka.destructive),
                  ),
                ),
              ],
              child: Semantics(
                label: 'Aksi untuk ${n.title}',
                child: ShadIconButton.ghost(
                  icon: const Icon(LucideIcons.ellipsis),
                  onPressed: menu.toggle,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
```

## Built from

[Toggle Group](https://design.sosialoka.tech/components/toggle-group/), [Dropdown Menu](https://design.sosialoka.tech/components/dropdown-menu/), [Alert Dialog](https://design.sosialoka.tech/components/alert-dialog/), [Popover](https://design.sosialoka.tech/components/popover/), [Button](https://design.sosialoka.tech/components/button/), [Tooltip](https://design.sosialoka.tech/components/tooltip/) and the [Dashboard](https://design.sosialoka.tech/patterns/dashboard/) block's `DashboardIconButton`.

## Flutter

The category chips are a `ShadToggleGroup` with `allowDeselection: false`, in a horizontal scroll so they fit a phone. On phones the bell opens the page; on tablets and desktop it opens a `ShadPopover`. Open the row actions from a `ShadContextMenu` and give the button a semantic label.


---

# Artist page

> The My Loka Link artist page. It is a 440px column with a hero and a call to action in the artist's accent.

Fans open an artist's My Loka Link page on their phones, so the page is one 440px column. The artist's color comes from a tenant accent preset, and everything else stays on the My Loka Link theme.

## When to use

- Use it for public pages that belong to one artist or tenant, in My Loka Link and Ruang Loka Musik.
- Don't use a tenant accent in admin screens.

_Live preview of the React and Vue versions: https://design.sosialoka.tech/patterns/artist-page/_

## Anatomy

1. **Hero** on `tenant-accent-soft`: the avatar, the artist's name in the brand display font, and one sentence of bio.
2. **Main call to action** on `tenant-accent`, as wide as the column.
3. **Links** as full-width outline rows with a Lucide icon and a chevron.
4. **Schedule card** with dates and places.
5. **Footer:** "from Sosialoka".

## Rules

- **Accent only on the hero and the main call to action.** Links, cards and text use the brand theme.
- **Text on the hero** uses `foreground` or `tenant-accent-text`. `muted-foreground` drops under 4.5:1 on some presets.
- **Presets:** set `data-tenant-accent` to `blue`, `orange`, `teal` or `red` on the page root. Every preset passes the contrast checks in light and dark. See [Color](https://design.sosialoka.tech/foundations/color/).
- **Icons:** Lucide for the interface. Don't use third-party platform logos.
- **Column:** max 440px, centered, also on desktop.

## Code

**React**
```tsx
import { CalendarIcon, ChevronRightIcon, DiscIcon, PlayIcon, ShirtIcon, VideoIcon } from "lucide-react"
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"

const links = [
  { label: "Rilis terbaru", icon: DiscIcon },
  { label: "Video", icon: VideoIcon },
  { label: "Jadwal manggung", icon: CalendarIcon },
  { label: "Merchandise", icon: ShirtIcon },
]

const shows = [
  { date: "Sab, 22 Nov 2026", place: "Kafe Lentera, Bandung" },
  { date: "Jum, 5 Des 2026", place: "Ruang Dengar, Yogyakarta" },
]

/**
 * A My Loka Link artist page: a 440px column on the artist's accent (data-tenant-accent). The accent colors
 * only the hero and the main call to action; everything else stays on the brand theme.
 */
export default function ArtistPageDemo() {
  return (
    <div data-tenant-accent="orange" className="mx-auto min-h-svh max-w-[440px] bg-background text-foreground">
      <header className="flex flex-col items-center gap-3 bg-tenant-accent-soft px-6 pt-10 pb-8 text-center">
        <Avatar className="size-24">
          <AvatarFallback className="bg-tenant-accent text-2xl text-tenant-accent-foreground">NS</AvatarFallback>
        </Avatar>
        <h1
          className="text-3xl"
          style={{
            fontFamily: "var(--font-brand)",
            fontWeight: "var(--font-brand-weight)",
            letterSpacing: "var(--font-brand-tracking)",
          }}
        >
          Nadia Senja
        </h1>
        <p className="text-sm text-foreground">Penyanyi folk dari Bandung. Lagu tentang kota dan pulang.</p>
        <a
          href="#"
          className="mt-2 inline-flex h-10 w-full items-center justify-center gap-2 rounded-md bg-tenant-accent px-4 text-sm font-medium text-tenant-accent-foreground outline-none hover:bg-tenant-accent/90 focus-visible:ring-[3px] focus-visible:ring-ring/50"
        >
          <PlayIcon className="size-4 fill-current" />
          Dengarkan rilis terbaru
        </a>
      </header>

      <nav aria-label="Tautan" className="grid gap-2 px-4 py-6">
        {links.map((link) => (
          <a
            key={link.label}
            href="#"
            className="flex h-12 items-center gap-3 rounded-lg border border-border bg-card px-4 text-sm font-medium outline-none hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50"
          >
            <link.icon className="size-4 text-muted-foreground" />
            <span className="flex-1">{link.label}</span>
            <ChevronRightIcon className="size-4 text-muted-foreground" />
          </a>
        ))}
      </nav>

      <div className="px-4">
        <Card>
          <CardHeader>
            <CardTitle>Jadwal manggung</CardTitle>
          </CardHeader>
          <CardContent className="grid gap-3">
            {shows.map((show) => (
              <div key={show.date} className="grid gap-0.5">
                <span className="text-sm font-medium">{show.date}</span>
                <span className="text-sm text-muted-foreground">{show.place}</span>
              </div>
            ))}
          </CardContent>
        </Card>
      </div>

      <footer className="flex items-center justify-center gap-1.5 py-8 text-xs text-muted-foreground">
        <span>from</span> <img src="/brand/sosialoka.png" alt="" className="size-4" />{" "}
        <span className="font-semibold text-foreground">Sosialoka</span>
      </footer>
    </div>
  )
}
```

**Vue**
```vue
<script setup lang="ts">
import { Calendar, ChevronRight, Disc, Play, Shirt, Video } from "@lucide/vue"
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"

/**
 * A My Loka Link artist page: a 440px column on the artist's accent (data-tenant-accent). The accent colors
 * only the hero and the main call to action; everything else stays on the brand theme.
 */
const links = [
  { label: "Rilis terbaru", icon: Disc },
  { label: "Video", icon: Video },
  { label: "Jadwal manggung", icon: Calendar },
  { label: "Merchandise", icon: Shirt },
]

/** The Sosialoka mark; a binding, so the SFC compiler leaves the URL alone instead of importing it. */
const markSrc = "/brand/sosialoka.png"

const shows = [
  { date: "Sab, 22 Nov 2026", place: "Kafe Lentera, Bandung" },
  { date: "Jum, 5 Des 2026", place: "Ruang Dengar, Yogyakarta" },
]
</script>

<template>
  <div data-tenant-accent="orange" class="mx-auto min-h-svh max-w-[440px] bg-background text-foreground">
    <header class="flex flex-col items-center gap-3 bg-tenant-accent-soft px-6 pt-10 pb-8 text-center">
      <Avatar class="size-24">
        <AvatarFallback class="bg-tenant-accent text-2xl text-tenant-accent-foreground">NS</AvatarFallback>
      </Avatar>
      <h1
        class="text-3xl"
        style="font-family: var(--font-brand); font-weight: var(--font-brand-weight); letter-spacing: var(--font-brand-tracking)"
      >
        Nadia Senja
      </h1>
      <p class="text-sm text-foreground">Penyanyi folk dari Bandung. Lagu tentang kota dan pulang.</p>
      <a
        href="#"
        class="mt-2 inline-flex h-10 w-full items-center justify-center gap-2 rounded-md bg-tenant-accent px-4 text-sm font-medium text-tenant-accent-foreground outline-none hover:bg-tenant-accent/90 focus-visible:ring-[3px] focus-visible:ring-ring/50"
      >
        <Play class="size-4 fill-current" />
        Dengarkan rilis terbaru
      </a>
    </header>

    <nav aria-label="Tautan" class="grid gap-2 px-4 py-6">
      <a
        v-for="link in links"
        :key="link.label"
        href="#"
        class="flex h-12 items-center gap-3 rounded-lg border border-border bg-card px-4 text-sm font-medium outline-none hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50"
      >
        <component :is="link.icon" class="size-4 text-muted-foreground" />
        <span class="flex-1">{{ link.label }}</span>
        <ChevronRight class="size-4 text-muted-foreground" />
      </a>
    </nav>

    <div class="px-4">
      <Card>
        <CardHeader>
          <CardTitle>Jadwal manggung</CardTitle>
        </CardHeader>
        <CardContent class="grid gap-3">
          <div v-for="show in shows" :key="show.date" class="grid gap-0.5">
            <span class="text-sm font-medium">{{ show.date }}</span>
            <span class="text-sm text-muted-foreground">{{ show.place }}</span>
          </div>
        </CardContent>
      </Card>
    </div>

    <footer class="flex items-center justify-center gap-1.5 py-8 text-xs text-muted-foreground">
      <span>from</span> <img :src="markSrc" alt="" class="size-4"> <span class="font-semibold text-foreground">Sosialoka</span>
    </footer>
  </div>
</template>
```

**Flutter**
```dart
// A My Loka Link artist page: a 440 px column on the artist's accent. The accent colors only the hero and
// the main call to action. sosialoka_ui has no tenant parameter yet, so read the preset from
// SosialokaColors.tenant for the current mode.
import 'package:flutter/widgets.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:sosialoka_ui/sosialoka_ui.dart';

const _links = [
  ('Rilis terbaru', LucideIcons.disc),
  ('Video', LucideIcons.video),
  ('Jadwal manggung', LucideIcons.calendar),
  ('Merchandise', LucideIcons.shirt),
];

class ArtistPageDemo extends StatelessWidget {
  const ArtistPageDemo({super.key, this.accent = 'orange'});

  /// One of the tenant presets: blue, orange, teal or red.
  final String accent;

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);
    final mode = theme.brightness == Brightness.dark ? 'dark' : 'light';
    final tenant = SosialokaColors.tenant[accent]![mode]!;
    return ConstrainedBox(
      constraints: const BoxConstraints(maxWidth: 440),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          ColoredBox(
            color: tenant['tenant-accent-soft']!,
            child: Padding(
              padding: const EdgeInsets.fromLTRB(24, 32, 24, 24),
              child: Column(
                children: [
                  ShadAvatar(
                    '',
                    size: const Size.square(96),
                    backgroundColor: tenant['tenant-accent'],
                    placeholder: Text('NS', style: TextStyle(color: tenant['tenant-accent-foreground'], fontSize: 24)),
                  ),
                  const SizedBox(height: 12),
                  Text('Nadia Senja', style: theme.textTheme.h2),
                  const SizedBox(height: 4),
                  Text(
                    'Penyanyi folk dari Bandung. Lagu tentang kota dan pulang.',
                    // foreground, not muted: muted text drops under 4.5:1 on some tenant presets.
                    style: theme.textTheme.p.copyWith(color: theme.colorScheme.foreground),
                    textAlign: TextAlign.center,
                  ),
                  const SizedBox(height: 16),
                  ShadButton(
                    width: double.infinity,
                    backgroundColor: tenant['tenant-accent'],
                    foregroundColor: tenant['tenant-accent-foreground'],
                    leading: const Icon(LucideIcons.play, size: 16),
                    onPressed: () {},
                    child: const Text('Dengarkan rilis terbaru'),
                  ),
                ],
              ),
            ),
          ),
          const SizedBox(height: 16),
          for (final (label, icon) in _links)
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
              child: ShadButton.outline(
                height: 48,
                mainAxisAlignment: MainAxisAlignment.start,
                leading: Icon(icon, size: 16),
                trailing: const Icon(LucideIcons.chevronRight, size: 16),
                onPressed: () {},
                child: Expanded(child: Text(label)),
              ),
            ),
        ],
      ),
    );
  }
}
```

## Built from

[Avatar](https://design.sosialoka.tech/components/avatar/) and [Card](https://design.sosialoka.tech/components/card/), with the tenant accent tokens.

## Flutter

`sosialoka_ui` has no tenant option yet. Read the preset from `SosialokaColors.tenant[accent][mode]`, and pass its colors to the hero and the main button.


---

# Content

> How the copy in Sosialoka products reads. It uses "kamu", short active sentences, no legal terms, and error messages that come from the backend.

These rules cover every piece of interface copy in every product and role: labels, titles, hints, tooltips, toasts, error messages, empty states, dialogs, notifications and email. Legal documents, such as agreement templates, are not interface copy.

## Voice

- **Talk to people as "kamu" / "-mu",** never "Anda". For example: "Akunmu sedang kami periksa."
- **The company is "kami"** only on screens clients read. On admin screens the readers are our own staff, so name the product ("Cover Clearance"), or leave the owner out.
- **Friendly, not over the top.** A light nudge is fine ("Simpan dulu, lanjutkan kapan saja."). Avoid heavy slang such as "gak", "banget", or "yuk" in every sentence.

## Sentences

- Short and active, one idea per sentence.
- Say what the control does, not how the feature works.
- No article numbers, legal terms or "perjanjian" in everyday copy. Write what it is for.

| Don't | Do |
| --- | --- |
| Ke mana surat dan pemberitahuan terkait perjanjian dikirim. | Ke sini kami kirim surat dan kabar penting untukmu. |
| Mohon maaf, data yang Anda masukkan tidak valid. | Format email-nya belum pas. |

## Hints and tooltips

- A field hint is one practical sentence: what to fill in, an example, or a limit.
- A tooltip is one sentence. It names a control; it doesn't explain the policy behind it.

## Error messages

- **The backend writes them.** It validates every field and returns the message, so web and mobile show the same words.
- **The client only gates the button,** for example by disabling "Kirim" until the required fields have a value. It never shows its own error text.
- **Say what to fix,** in the "kamu" voice: "Email-nya belum diisi.", "Judul lagunya belum diisi."

## Numbers and dates

- Rupiah has two decimals: `Rp4.812.500,00`.
- Dates read `14 Nov 2026`; add the day for schedules: `Sab, 22 Nov 2026`.
- Use `tabular-nums` for numbers in tables and stats.

## Common buttons

| Indonesian | English |
| --- | --- |
| Simpan | Save |
| Batal | Cancel |
| Kirim | Send |
| Hapus | Delete |
| Coba lagi | Try again |
| Keluar | Sign out |

## English copy

The English copy uses the same casual voice: "you" and "your", short sentences, and no legal terms in everyday copy.
