
Use Topbar
Install and wire the @aura/topbar shadcn registry top bar with theming and composition—without falling back to a custom bar when the registry install fails.
Install
npx skills add https://github.com/cognitedata/builder-skills --skill use-topbarWhat is this skill?
- Mandatory @aura/topbar install via shadcn CLI only—no npm/pnpm add workaround
- Registers the @aura registry in components.json before add
- Requires tailwind.config darkMode: 'class' for theme switching
- Interview-driven flow (INTERVIEW.md) before install steps
- Stops and surfaces blockers if install fails instead of custom components
Adoption & trust: 1k installs on skills.sh; 4 GitHub stars; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Frontend Designanthropics/skills
Vercel React Best Practicesvercel-labs/agent-skills
Remotion Best Practicesremotion-dev/skills
Vercel Composition Patternsvercel-labs/agent-skills
Develop Userscriptsxixu-me/skills
Next Best Practicesvercel-labs/next-skills
Journey fit
Common Questions / FAQ
Is Use Topbar safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Use Topbar
# Topbar Implementation Install, theme-hook wiring, and composition for `@aura/topbar`. Run the interview ([INTERVIEW.md](INTERVIEW.md)) first. --- ## Step 3 — Install **Installation is mandatory.** If `@aura/topbar` cannot be installed, stop and surface the blocker. Do not build a custom component or any workaround. ### 3a — Check if already installed Check `package.json` for `@aura/topbar`. If present, skip to Step 3d. ### 3b — Determine install method `@aura/topbar` is a **shadcn registry component** — not on npm. The only valid install path is the shadcn CLI (`pnpm dlx shadcn@latest add`). Do not use `npm install`, `pnpm add`, or `yarn add`. Before running the install: 1. **Ensure `components.json` has the `@aura` registry.** If absent or missing the entry, add: ```json { "registries": { "@aura": "https://cognitedata.github.io/aura/r/{name}.json" } } ``` If `components.json` does not exist at all, run `pnpm dlx shadcn@latest init` first, then add the entry. 2. **Detect the package manager:** - `pnpm-lock.yaml` → pnpm - `yarn.lock` → yarn - `package-lock.json` → npm ### 3c — Install ```bash pnpm dlx shadcn@latest add @aura/topbar ``` > **If this fails**, stop. Tell the user exactly what failed and ask them to resolve the blocker. Do not proceed with a workaround. ### 3d — Tailwind check Confirm `tailwind.config` has `darkMode: 'class'`. Add it if missing. --- ## Step 4 — Dark mode hook Always implement theme switching (light / dark). Check for an existing theme system first: - Search for `useDarkMode`, `useTheme`, `useColorScheme`, or a `ThemeProvider` in `src/` - If found, wire into it and skip creating a new hook. If none exists, create `src/hooks/use-theme-mode.ts` (or extend your existing hook) so the Topbar menu can **set** light or dark explicitly: ```ts import { useEffect, useState } from 'react'; export type ThemeMode = 'light' | 'dark'; export function useThemeMode() { const [mode, setMode] = useState<ThemeMode>(() => { const stored = localStorage.getItem('theme'); if (stored === 'dark' || stored === 'light') return stored; return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; }); useEffect(() => { const isDark = mode === 'dark'; document.documentElement.classList.toggle('dark', isDark); localStorage.setItem('theme', isDark ? 'dark' : 'light'); }, [mode]); return { mode, isDark: mode === 'dark', setTheme: (next: ThemeMode) => setMode(next), }; } ``` Apply the initial class on page load in `main.tsx` / `index.tsx`: ```ts const stored = localStorage.getItem('theme'); const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; if (stored === 'dark' || (!stored && prefersDark)) { document.documentElement.classList.add('dark'); } ``` The Topbar **theme** trigger should open a **Menu** whose items call `setTheme('light')` and `setTheme('dark')` and show a **checkmark** on the active row. --- ## Step 5 — Implement the Topbar **Always check Storybook for exact prop names before writing code.** The names below are illustrative — verify against the current `@aura/topbar` package. ```tsx import { Topbar } from '@aura/topbar'; import { Breadcrumb, BreadcrumbItem } from '@aura/topbar'; // adjust to actual exports // App + user Avatar: import from the Aura package / path Storybook documents for Topbar. import { useThemeMode } from '@/hooks/use-theme-mode'; export function AppShell({ children }: { children: React.ReactNode }) { const { mode, setTheme } = useThemeMode(); return ( <> <Topbar // Left — application mark: Avatar small, fjord (verify Storybook props) applicationIcon={ <Avatar size="small" colorway="fjord" src={appMarkSrc} alt="" /> } breadcrumbs={ <Breadcrumb> <BreadcrumbItem label="Application Name" href="/" /> {/* <BreadcrumbItem label={objectName} ... d