{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ui-rules",
  "title": "UI Rules for AI agents",
  "description": "ikas-ui.md design rules for AI coding agents; reference it from AGENTS.md or CLAUDE.md.",
  "files": [
    {
      "path": "registry/rules/ikas-ui.md",
      "content": "# ikas App UI rules\n\nThese rules apply to every screen of this ikas app. The app opens inside the ikas admin panel;\nits screens must use the same type scale, density and surfaces as the panel and must not look\nlike generic AI output. Follow these rules whenever you write or change UI code.\n\n## You are inside the panel\n\nThe panel's top bar is already there: back button, app logo, app name and \"Manage plan\". The app draws\nnone of these: no logo, no app name, no top bar of its own, no sidebar, no plan/subscription button.\nThe `PageHeader` title is the name of the screen or section (\"Shipments\", \"Settings\"), not the app's name.\nAn app with several sections switches between them with `PageNav` (the first child of `Page`, at most 6 sections).\n\n## 1. Use the building blocks, don't reinvent them\n\n| Need | Use | Never |\n| --- | --- | --- |\n| Screen wrapper + title + actions | `Page` + `PageHeader` from `@/components/ikas/page` | A custom `<div className=\"container\">` with an `<h1>` |\n| Switching sections (multi-section app) | `PageNav` from `@/components/ikas/page-nav` (`href` with a router, `value` + `onValueChange` on a single page) | A sidebar, a top bar of its own, a logo + app name header |\n| The path to a deep record (list → record → sub-record) | `Breadcrumb` above `PageHeader` (last item `BreadcrumbPage`, `BreadcrumbEllipsis` in the middle of a long path) | Links joined with `/` by hand, a path starting with the app's name |\n| Switching views inside a card or table | `SegmentedControl` (`size=\"sm\"` in a card header) or `Tabs` | Two nested rows of pill tabs |\n| Columns | `Layout` / `LayoutColumn` (`columns=\"main-aside\"`, `\"half\"`, `\"third\"`) | Hand-written `grid-cols-*` on every page |\n| Settings forms | `SettingsGroup` (`label`, `hint`, `index` on long pages) + `Card` + `Field` | One huge form in a single centered card |\n| Record list | `RecordTable` | A grid of cards for tabular data |\n| Nothing to show | `EmptyState` | A grey \"No data\" line |\n| Feature outside the plan (locked) | `FeatureGate` (`variant=\"overlay\"` over a list/card, `\"banner\"`, `\"inline\"`, `\"action\"` for a single button; `plan`, `onUpgrade`) | An `EmptyState` saying \"Upgrade to Pro\", a custom lock card, a grey `disabled` button |\n| Data is loading | The component's `loading` (`RecordTable`, `BarChart`, `AreaChart`); otherwise wrap the real content in `<Skeleton loading>` | A spinner in the middle of the page, grey boxes sized by hand |\n| An action is running (save, install, retry) | `Button loading` on that action's button | A loading screen that locks the whole page, a separate spinner next to the button |\n| A list or section failed to load | `RecordTable error` + `onRetry`; in a section, `EmptyState status=\"danger\"` + `onRetry` | An empty table, plain red text |\n| Persistent feedback | `Banner` with `status` | Colored `<div>`s, emoji, alert() |\n| Transient feedback | `toast` from the `sonner` package; `Toaster` from `@/components/ui/sonner` once at the root | A banner for \"Saved!\" |\n| Transient feedback, island style (a single stack at the top) | `island()` from `@/components/ui/island-toast`; `IslandToaster` once at the root (`tone`, `position`). An app uses either this or `Toaster`, never both | Two toasters side by side, a color per toast |\n| Unsaved form changes | `UnsavedBar` | A Save button at the bottom of a long form |\n| Status | `Badge` with `status` (+ `dot` for live states) | Custom colored pill labels |\n| Changing status (pending → syncing → done) | `AnimatedBadge` (`status`, `media=\"dot\"` + `pulse` for live) | A blinking `Badge`, custom keyframes |\n| Actions | `Button` with `variant` + `color` | Custom `<button>` styles, extra shadows |\n| Icon-only button | `Button size=\"icon\"` + `aria-label` + `Tooltip` (`TooltipContent shortcut` when there is a shortcut), one `TooltipProvider` at the root | An unlabelled icon, a `title` attribute, an arrow or custom delay on the tooltip |\n| Key numbers | `StatCard` | Huge hero numbers with gradient text |\n| Key/value details | `DescriptionList` | Hand-aligned flex rows |\n| A single on/off setting | `SettingRow` | A label + switch in an ad-hoc flex |\n| Color input | `ColorPicker` inside a `Field` (`value`/`onValueChange` give hex; saved colors with `swatches`) | `<input type=\"color\">`, a hand-written hex field |\n| An order the user sets (priority, a work list inside a card) | `SortableStack` (move by handle and keyboard, `SortableStackUndo`; save a persistent order with `onItemsChange`) | Up/down arrow buttons, making the whole row draggable, hand-written drag and drop |\n| Light/dark appearance choice | `ThemeSwitch` (`theme`, `onThemeChange`, `transition`) | A hand-written sun/moon button, a custom page transition |\n| Toggleable feature + its settings | `ToggleSection` | A settings form always visible next to the switch |\n| Onboarding steps | `Launchpad` (`eta` per step, `requires` when order matters); `layout=\"checklist\"` + `onStepToggle` when the user ticks steps off | \"Do this first\" banners scattered across the screen |\n| Sequential wizard (3–6 steps) | `Steps` (`orientation=\"horizontal\"`, `\"compact\"` when the header has no room, `\"vertical\"` for a long flow with descriptions); errors go in the step's `error` | Hand-numbered circles, settling for a \"Step 2 of 5\" line |\n| Work of known size (import, sync) | `ProgressBar` (`value`/`max`, `indeterminate` while the total is unknown, `variant=\"segments\"` for a few equal steps) | A fake bar with made-up percentages, a spinner in the middle of the page |\n| Score, readiness score | `RadialMeter variant=\"gauge\"` + `bands` | A ring that tells status by color alone |\n| Step marker shape | `StepMarkerProvider shape` once at the root (`diamond` by default; `circle`, `square`, `pill`) | A different shape on each component |\n| Install/update/remove a storefront script | `ScriptInstaller` | A hand-written install button, removal without confirmation |\n| Chart frame (title, value, range) | `ChartCard` | A custom card header for each chart |\n\nBefore writing your own, install the missing piece with `npx shadcn@latest add @ikas/<name>`.\n\n## 2. Visual rules\n\n- **Colors come only from tokens.** Use `bg-card`, `text-muted-foreground`,\n  `bg-success-subtle`, `border-border` and so on. Never write hex values, `bg-blue-500`,\n  `text-gray-600` or any raw Tailwind palette color in app code.\n- **Depth comes from the components.** Solid buttons ship with an inner highlight and a soft glow;\n  cards and outline buttons ship with layered thin shadows. Never add your own gradients, glows,\n  `shadow-lg`/`shadow-2xl`, gradient text or colored backgrounds.\n- **No decorative emoji:** not in headings, buttons, badges or empty states. Use lucide icons.\n- **One solid button per screen section.** Other actions are `outline`, `soft` or `ghost`.\n  The solid button is the last item in the action group.\n- **Neutral by default.** Buttons are `color=\"neutral\"` unless the color carries meaning:\n  `red` for irreversible confirmations, a single accent color (e.g. `blue`) for the app's main call to action.\n  Never mix more than one accent color on the same screen.\n- **Status colors have meaning.** `status` values: `success` = done/healthy,\n  `warning` = needs attention soon, `danger` = broken/blocked/irreversible, `info` = informational,\n  `neutral` = no status. Don't use them for decoration.\n- **Don't color toasts; the status does.** `toast.success/info/warning/error` is enough: the icon (plus a thin\n  border on warning and error) carries the status. For more prominent toasts, use `<Toaster variant=\"soft\" />` in one place; never\n  color individual toasts with `className`.\n- **Don't color banner actions; the banner does.** Don't give `color` to buttons in `Banner` `actions`:\n  in a soft banner, default-colored buttons take the status color on their own (solid → status fill,\n  outline/soft/ghost → tinted). Don't add classes like `text-amber-*` or `bg-red-*` to the text or buttons by hand.\n- **Surfaces:** light theme first. Page background is `bg-background`; content sits on a `Card`\n  (white, layered thin shadow). No `backdrop-blur`, glassmorphism or colored card backgrounds.\n- **Corner radius:** use the component defaults. Don't add `rounded-2xl`/`rounded-3xl`.\n- **Typography:** `PageHeader` sets the page title (20px semibold). Card titles are 15px semibold.\n  Body is 14px. Never use `text-4xl`+ anywhere in the app; no ALL CAPS labels and no `tracking-widest`.\n- **Density:** this is an admin tool. Controls are 36px (`h-9`). Don't inflate spacing\n  (`p-10`, `py-24`) and don't build landing-page-style hero sections.\n- **Navigation hierarchy:** level 1 is `PageNav` (underlined bar at the top of the page), level 2 is\n  `SegmentedControl` / `Tabs` (pills) in a card header or toolbar. Never nest two pill rows or two underlined bars.\n  If you need a third level, change the design: split into separate screens, use `Collapse` or `Select`.\n- **Icons:** lucide-react; 16px in controls, at most 20px elsewhere. Icons support text;\n  they never replace the label on the main action.\n\n## 3. Copy rules\n\n- Sentence case everywhere: \"Create campaign\", not \"Create Campaign\".\n- Button copy says what will happen: \"Save settings\", \"Export orders\". Never write a bare \"Submit\",\n  \"OK\" or \"Click here\".\n- An empty state says why there is nothing on the screen and offers a single next step. No jokes, no \"Oops!\".\n- Error copy gives the consequence first (what wasn't saved, what wasn't sent), then the fix. Never show\n  merchants a raw error object or stack trace; if an error code is needed, add it in monospace.\n- Write for merchants in the app's language (Turkish apps: Turkish copy; format numbers and\n  currency with `Intl.NumberFormat` and `tr-TR`).\n\n## 4. States are not optional\n\nEvery data-driven screen covers: **loading** (rules below), **empty** (`EmptyState`), **error**\n(in place, as in section 1; `Banner status=\"danger\"` with a retry action if the rest of the page works)\nand **success** (`toast`).\n\n**Loading** works the same way in every component:\n\n- While an action is pending, use `Button loading` on that action's button. Spinners appear only in buttons, toasts\n  and inline states (`AnimatedBadge`); never in the middle of a page or section.\n- While data with a known shape is pending, use a skeleton: use the component's own `loading` if it has one\n  (`RecordTable`, `BarChart`, `AreaChart`). Otherwise wrap the real content:\n  `<Skeleton loading={isLoading}><span>{formatMoney(total)}</span></Skeleton>`. The content is invisible but\n  keeps its place, so nothing shifts when it loads. A hand-sized `<Skeleton className=\"h-4 w-20\" />`\n  is only for when there is no content to wrap yet (e.g. a list whose rows are unknown).\n- Things that don't come from data stay real: title, tabs, filters, column names. Buttons, inputs,\n  toasts, menus and the modal itself never become skeletons.\n- The skeleton look (`pulse` or `shimmer`) is chosen once per app: `<SkeletonProvider variant=\"...\">` at the\n  root. Tables, charts and wrapped content follow it; don't pass `variant` one by one.\n- On reloads (filter, page change, retry) use `useDelayedLoading(isLoading)`:\n  on a fast load the skeleton never shows, and if it shows it doesn't flicker. On the first load pass `loading` directly.\n- Put `aria-busy` once on the pending region, not on every block.\n**Locked** is not empty: a feature outside the plan is locked with `FeatureGate`, not explained with `EmptyState`;\nthe content stays visible but can't be clicked.\n\n## 5. Page recipes\n\n- **Multi-section app:** `Page` → `PageNav` at the top (≤ 6 sections) → `PageHeader` (the section's name) →\n  the section's content (one of the recipes below). No sidebar, no app name.\n- **List page:** `Page width=\"wide\"` → `PageHeader` (title, main action) →\n  `RecordTable` with a toolbar (search + filters), pagination and bulk actions.\n- **Detail page:** `Page` → `Breadcrumb` when deeper than two levels → `PageHeader` (`back`, `badges`, actions) →\n  `Layout columns=\"main-aside\"` → main column: content cards; side column: `DescriptionList` cards.\n- **Settings page:** `Page width=\"narrow\"` → `PageHeader` → stacked `SettingsGroup`s, each holding\n  a single `Card` → `UnsavedBar` bound to the form's dirty state. With more than four groups,\n  `Page` + a sticky section menu on the left and numbers like `index=\"01\"` on the groups.\n- **App home (onboarding):** `Page width=\"wide\"` → `PageHeader` → `Launchpad` at the top\n  → metrics and an `EmptyState` for the first record. Once every step is done it can be removed with `onDismiss`.\n- **Dashboard:** `Page width=\"wide\"` → `Layout columns=\"third\"` of `StatCard`s → tables / cards.\n\n## 6. Motion\n\n- Don't hand-write springs or curves: use `@/lib/motion` (`SPRING`, `ICON_SPRING`, `EASE_*`, `springOrInstant`)\n  or tokens like `ease-(--ease-out)` in CSS.\n- A bouncy spring belongs only to `IslandToaster`, via `ISLAND_SPRING`; don't use bounce in any other component.\n- Hover 150ms, content enter 150ms / exit 100ms, overlay 300/200ms. Exit is shorter than enter.\n- `transition-all` is banned. In Tailwind v4, for `translate-*` / `scale-*` list\n  `translate` and `scale` in the transition property (not `transform`).\n- For icon micro-animations, give the icon `data-anim=\"spin|nudge|lift|drop|ring|wiggle|bounce|pop\"`;\n  don't write your own keyframes.\n- For a badge whose status changes, use `AnimatedBadge`; the label and icon flow on their own. It doesn't play on first render.\n- Use `PageNav` for sections, `SegmentedControl` for in-card tabs / single choice, `NumberStepper` for number input,\n  `Collapse` for expandable sections, `ConfirmButton` for inline destructive confirmation.\n- Every animation needs a reduced-motion fallback (`springOrInstant(useReducedMotion())`, `motion-reduce:*`).\n\n## 7. Charts\n\n- Build charts with `AreaChart`, `BarChart`, `DonutChart`, `BarList`, `Sparkline`, `Meter`.\n- A single series uses `--chart-ink`; multiple series use `--chart-1…6` in order. Don't pick colors by hand or cycle them;\n  more than 6 series are grouped under \"Other\". Status colors are not series colors.\n- One y-axis. Two measures on different scales get two charts.\n- Thin marks: 2px lines, ≤ 24px bars, 4px rounded ends, thin horizontal grid. Values and labels use text tokens.\n- A legend is required for 2+ series. Don't label every point; provide a tooltip and, when needed, a table view.\n- If you need a single headline number, use a `StatCard`, not a chart.\n",
      "type": "registry:file",
      "target": "~/ikas-ui.md"
    }
  ],
  "docs": "https://builders.ikas.com/tr/docs/app-development/ui-kit/ai-agent",
  "categories": [
    "ai"
  ],
  "type": "registry:file"
}