--- name: designing-nextjs-ui description: | Create professional, attractive, and visually striking user interfaces in Next.js. Use when building beautiful websites, landing pages, dashboards, or any UI that needs to stand out. Covers Tailwind CSS utilities, typography, animations, visual effects, responsive layouts, and modern design patterns. Includes gradient text, glass morphism, hover effects, and comprehensive spacing/layout systems. NOT when doing basic HTML/CSS without a framework. --- # Designing Professional Next.js UIs Create visually stunning and highly functional interfaces using modern design patterns and Tailwind CSS. ## Design Philosophy **Avoid generic aesthetics.** Every interface should have a clear visual identity: - Choose distinctive fonts (avoid overused Inter, Roboto, Arial) - Commit to a bold aesthetic direction (minimalist, maximalist, editorial, etc.) - Use intentional color palettes with purpose - Add visual depth through shadows, gradients, and effects - Create memorable layouts that break from standard patterns **Balance beauty with function.** Beautiful design serves the user experience: - Maintain clear hierarchy and readability - Use animations purposefully, not gratuitously - Ensure accessibility (contrast, semantic HTML, screen readers) - Optimize for performance (next/font, proper image handling) ## The "Gold Standard" Stack Don't reinvent the wheel. Use this proven combination for consistency and speed. 1. **Tailwind CSS**: For utility-first styling. 2. **Shadcn UI**: For copy-paste accessible components (based on Radix UI). 3. **Framer Motion**: For declarative animations. 4. **Lucide React**: For consistent, clean iconography. ## Visual Hierarchy & Typography ### Fonts (`next/font`) Use `next/font/google` to eliminate layout shift. * **Primary:** `Inter` or `Geist Sans` (clean, modern legibility). * **Headings (Optional):** `Playfair Display` or `Merriweather` (for "classy" contrast). ```tsx import { Inter, Playfair_Display } from 'next/font/google' const inter = Inter({ subsets: ['latin'], variable: '--font-inter' }) const playfair = Playfair_Display({ subsets: ['latin'], variable: '--font-playfair' }) export default function RootLayout({ children }) { return (
{children} ) } ``` ## Data Presentation Patterns ### 1. KPI / Metric Cards Isolate key numbers. Use the "Label (Muted) -> Value (Bold) -> Context (Color)" hierarchy. ```tsx // See references/ui-patterns.md for full component code+20.1% from last month
Normal text with highlighted words
``` **Gradient Text:** ```tsx Vibrant text ``` **Background Highlight:** ```tsx marked text ``` **Weight & Size Contrast:** - Mix `font-light` with `font-bold` in same paragraph - Use large numbers (`text-6xl`) with small labels (`text-xs`) - Vary letter spacing: `tracking-tight`, `tracking-wide`, `tracking-widest` **See references/typography-advanced.md** for font loading, hierarchy systems, responsive typography, and dark mode patterns. ## Responsive Layouts ### Mobile-First Approach Always design for mobile first, then enhance for larger screens: ```tsx