Tailwind CSS v4 and shadcn/ui: Building a Decent Admin UI on Your Own
Without a designer, you have to handle interaction design yourself, and mature components plus a design system are what let you build a professional interface quickly.
Core concepts
- Tailwind CSS: utility-first CSS where styles are composed from class names. The biggest change in v4 (released 2025-01) is that configuration moved from JS to CSS:
@import "tailwindcss";in your CSS and define design tokens (colors, fonts, spacing) with@theme { ... }. You usually no longer needtailwind.config.js. - shadcn/ui: not an npm component library; it copies component source code into your project (
npx shadcn@latest add button), built on unstyled accessible primitives such as Radix UI + Tailwind. You own the code and can change it freely. - Design tokens: shadcn defines themes with CSS variables (
--background,--primary, etc.), so switching to dark mode is just switching variables.
How it works: why this combination suits "designing on your own"
- Accessibility and interaction details (keyboard navigation, focus management, ARIA) are handled by underlying primitives such as Radix.
- Consistency comes from tokens: use only preset spacing, radii and colors and the UI is naturally coherent.
- The source is yours: you're never boxed in by a component library's API.
In practice
Theme configuration in v4
css
/* app/globals.css */
@import "tailwindcss";
@theme {
--color-brand: oklch(0.55 0.22 290);
--font-sans: "Inter", "PingFang SC", sans-serif;
}After that you can use class names such as bg-brand and text-brand directly.
Common component combinations for a review console
| Screen | shadcn components |
|---|---|
| Task list | Data Table (built on TanStack Table), Badge (status), Pagination |
| Task details | Tabs, Card, Separator, Skeleton (loading state) |
| Human review | Form + Input + Select, Dialog (confirmation), Sonner (toasts) |
| Side-by-side source view | Resizable (split panes), ScrollArea |
Interaction design checklist (when there's no designer)
- Every page has an empty state, loading state, error state and no-permission state
- Destructive actions ask for confirmation; long actions show progress and can be cancelled
- Forms: field-level error messages, the button disabled while submitting, clear feedback on success
- Keyboard friendly: sensible Tab order, Esc closes dialogs
Common pitfalls
- Configuring v4 from a v3 tutorial: the
tailwind.config.jsapproach is no longer the default in v4. - Styles lost through class name concatenation: Tailwind scans source code for complete class names, so dynamically built names like
bg-${color}-500are never generated. - Editing shadcn components directly and then being unable to upgrade: by design you own the source, so upgrades mean merging by hand. Accept that trade-off up front.
Common interview questions
- What are the main differences between Tailwind v4 and v3?
- What's the fundamental difference between shadcn/ui and component libraries such as MUI / Ant Design?
- Without a designer, how do you make sure the UI is consistent and easy to use?
- Why do dynamically concatenated Tailwind class names stop working?
Sources
- Tailwind CSS Blog: Tailwind CSS v4.0 — CSS-first configuration
- Tailwind CSS Docs: Theme variables (@theme)
- Tailwind CSS Docs: Detecting classes in source files — the dynamic class name problem
- shadcn/ui Docs: Introduction · Tailwind v4
- Radix Primitives
