Shared UI lives in packages/ui and is imported as @workspace/ui/... by the web and desktop apps. It is built on shadcn/ui (Radix UI and Tailwind CSS 4).
Layout
packages/ui/src/
├── components/
│ ├── shadcn/ shadcn/ui primitives (button, dialog, form, sidebar, table, ...)
│ ├── aceternity/ animated marketing components
│ ├── auth/ sign-in and sign-up forms
│ ├── home/ settings dialog, account, sessions, sidebar user
│ ├── dashboard/ download wizard pieces (open-source repository)
│ ├── admin/ admin screens' building blocks
│ ├── payments/ balance, credits purchase, transaction history (Billing)
│ ├── organizations/ workspace switcher, team settings (Organizations)
│ ├── ai/ chat UI (AI Platform)
│ ├── mdx/ Markdown renderer
│ ├── sidebar/ app sidebar
│ └── misc/ loading, error and guest banners
├── blocks/ whole screens composed from components (auth, admin, dashboard)
├── hooks/
├── lib/ utilities (cn, env parsing, wizard logic, constants)
├── providers/ theme provider
├── styles/ globals.css and the theme files
└── typography/ fonts and type components
package.json exports these subpaths:
import { Button } from "@workspace/ui/components/shadcn/button";
import LoadingState from "@workspace/ui/components/misc/LoadingState";
import { ThemeProvider } from "@workspace/ui/providers/theme-provider";
import { cn } from "@workspace/ui/lib/utils";
import "@workspace/ui/globals.css";
If you add a new top-level folder that apps import, add its subpath to exports in packages/ui/package.json.
Adding shadcn components
pnpm dlx shadcn@latest add dialog -c packages/ui
Components land in packages/ui/src/components/shadcn/. They are your code: edit them freely.
Components vs blocks
- Components are pieces: a card, a form field, a table. They never import blocks (
pnpm arch:checkenforces this). - Blocks are screens: the sign-in screen, the settings dialog. They take data and callbacks as props, so the web app and the desktop app can wire them to their own data fetching.
Nothing in packages/ui imports the database. Pass data in as props.
Styling
Tailwind CSS 4 with CSS variables. Use semantic tokens so components follow the theme and dark mode:
<div className="rounded-xl border border-border bg-card p-6 text-card-foreground">
<p className="text-muted-foreground">Uses the active theme</p>
<Button variant="secondary">Action</Button>
</div>
cn() merges class names and resolves Tailwind conflicts:
<div className={cn("p-4", isActive && "bg-accent", className)} />
Themes are set by NEXT_PUBLIC_THEME and defined in packages/ui/src/styles/shadcn-<color>.css: see Branding & Themes.
Forms
Forms use React Hook Form with Zod and the shadcn Form components:
const schema = z.object({ title: z.string().min(1, "Required") });
const form = useForm<z.infer<typeof schema>>({ resolver: zodResolver(schema), defaultValues: { title: "" } });
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<FormField control={form.control} name="title" render={({ field }) => (
<FormItem>
<FormLabel>Title</FormLabel>
<FormControl><Input {...field} /></FormControl>
<FormMessage />
</FormItem>
)} />
</form>
</Form>
Validate on the server too; the client schema is for feedback only.
Feedback
- Toasts:
import { toast } from "sonner", thentoast.success("Saved"). The<Toaster />is mounted in the root layout. - Loading and errors:
LoadingStateandErrorStatefromcomponents/misc, withSuspenseandreact-error-boundaryas the layouts do.
Mobile
The mobile app does not use packages/ui: React Native needs native components. It uses NativeWind (Tailwind classes for React Native) with its own components in apps/mobile/components.
