\bin\mongod.cfg`
+
+### Common Configuration Options
+```yaml
+# Network interfaces
+net:
+ port: 27017
+ bindIp: 127.0.0.1 # Only localhost
+
+# Storage
+dbPath: /data/db
+
+# Security
+security:
+ authorization: enabled # Enable authentication
+
+# Replication (for replica sets)
+replication:
+ replSetName: "rs0"
+
+# Performance
+storage:
+ journal:
+ enabled: true
+ wiredTiger:
+ engineConfig:
+ cacheSizeGB: 1 # Adjust based on available RAM
+```
+
+## Authentication
+
+### Create Admin User
+```javascript
+use admin
+db.createUser({
+ user: 'admin',
+ pwd: 'your-secure-password',
+ roles: [ { role: 'userAdminAnyDatabase', db: 'admin' } ]
+})
+```
+
+### Connect with Authentication
+```javascript
+const uri = 'mongodb://admin:your-secure-password@localhost:27017/admin';
+const client = new MongoClient(uri);
+```
+
+## Backup and Restore
+
+### Create Backup
+```bash
+mongodump --uri="mongodb://localhost:27017" --out=/backup/$(date +%Y%m%d)
+```
+
+### Restore from Backup
+```bash
+mongorestore --uri="mongodb://localhost:27017" /backup/20231015/mydb
+```
+
+## Monitoring
+
+### Basic Stats
+```javascript
+db.serverStatus()
+
+db.stats()
+
+// Collection stats
+db.collection.stats()
+
+// Current operations
+db.currentOp()
+```
+
+### Enable Profiling
+```javascript
+// Set profiling level (0=off, 1=slow, 2=all)
+db.setProfilingLevel(1, { slowms: 100 })
+
+// View profile data
+db.system.profile.find().pretty()
+```
diff --git a/docs/ui/bootstrap.md b/docs/ui/bootstrap.md
new file mode 100644
index 0000000..9d00bc8
--- /dev/null
+++ b/docs/ui/bootstrap.md
@@ -0,0 +1,529 @@
+# Bootstrap 5 Documentation
+
+## Table of Contents
+1. [Getting Started](#getting-started)
+2. [Layout](#layout)
+3. [Components](#components)
+4. [Utilities](#utilities)
+5. [Forms](#forms)
+6. [Icons](#icons)
+7. [Theming](#theming)
+8. [Customization](#customization)
+9. [Best Practices](#best-practices)
+
+## Getting Started
+
+### Installation
+
+#### CDN (Quick Start)
+```html
+
+
+
+
+
+```
+
+#### NPM
+```bash
+npm install bootstrap@5.3.0
+```
+
+#### Basic HTML Template
+```html
+
+
+
+
+
+ Bootstrap 5
+
+
+
+ Hello, Bootstrap 5!
+
+
+
+```
+
+## Layout
+
+### Container
+```html
+
+
+
+
+
+
+
+
+
+100% wide until small breakpoint
+100% wide until medium breakpoint
+100% wide until large breakpoint
+100% wide until extra large breakpoint
+100% wide until extra extra large breakpoint
+```
+
+### Grid System
+```html
+
+
+
Column 1
+
Column 2
+
Column 3
+
+
+
+
Main content (8/12)
+
Sidebar (4/12)
+
+
+
+
+
+```
+
+### Breakpoints
+| Breakpoint | Class Infix | Dimensions |
+|-------------|------------|------------|
+| X-Small | None | <576px |
+| Small | `sm` | ≥576px |
+| Medium | `md` | ≥768px |
+| Large | `lg` | ≥992px |
+| Extra large | `xl` | ≥1200px |
+| Extra extra large | `xxl` | ≥1400px |
+
+## Components
+
+### Buttons
+```html
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+### Cards
+```html
+
+

+
+
Card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
Go somewhere
+
+
+
+
+
+
+
+
Special title treatment
+
With supporting text below as a natural lead-in to additional content.
+
Go somewhere
+
+
+
+```
+
+### Navbar
+```html
+
+```
+
+### Modal
+```html
+
+
+
+
+
+
+
+
+
+
Modal body text goes here.
+
+
+
+
+
+```
+
+## Utilities
+
+### Spacing
+```html
+
+Margin all around (0.25rem)
+Margin top (1rem)
+Padding all around (1.5rem)
+Padding left and right (3rem)
+
+
+Responsive margin
+```
+
+### Text
+```html
+Start aligned text
+Center aligned text
+End aligned text
+
+Primary text
+Success text
+Danger text
+
+Bold text
+Italic text
+Uppercase text
+Truncated text with an ellipsis...
+```
+
+### Colors
+```html
+
+.text-primary
+.text-secondary
+.text-success
+.text-danger
+.text-warning
+.text-info
+.text-light
+.text-dark
+.text-muted
+
+
+.bg-primary
+.bg-success
+```
+
+## Forms
+
+### Basic Form
+```html
+
+```
+
+### Form Controls
+```html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+### Form Validation
+```html
+
+```
+
+## Icons
+
+### Bootstrap Icons
+```html
+
+
+
+
+
+
+```
+
+## Theming
+
+### Color Modes
+```html
+
+
+
+
+
+
+```
+
+### Custom Colors
+```scss
+// Custom.scss
+// Override default variables before the import
+$body-bg: #000;
+$body-color: #fff;
+$primary: #0d6efd;
+$secondary: #6c757d;
+$success: #198754;
+
+// Import Bootstrap and its default variables
+@import '~bootstrap/scss/bootstrap';
+```
+
+## Customization
+
+### SASS Variables
+```scss
+// Customize colors
+$primary: #0074d9;
+$secondary: #6c757d;
+$success: #28a745;
+$info: #17a2b8;
+$warning: #ffc107;
+$danger: #dc3545;
+$light: #f8f9fa;
+$dark: #343a40;
+
+// Customize spacing
+$spacer: 1rem;
+$spacers: (
+ 0: 0,
+ 1: $spacer * .25,
+ 2: $spacer * .5,
+ 3: $spacer,
+ 4: $spacer * 1.5,
+ 5: $spacer * 3,
+ 6: $spacer * 4,
+ 7: $spacer * 5,
+ 8: $spacer * 6,
+);
+
+// Customize container sizes
+$container-max-widths: (
+ sm: 540px,
+ md: 720px,
+ lg: 960px,
+ xl: 1140px,
+ xxl: 1320px
+);
+```
+
+## Best Practices
+
+### Responsive Images
+```html
+
+
+
+```
+
+### Display Property
+```html
+d-inline
+d-inline
+
+d-block
+d-block
+
+
+Hide on screens wider than lg
+Hide on screens smaller than lg
+```
+
+### Flexbox
+```html
+I'm a flexbox container!
+
+...
+...
+...
+...
+...
+
+...
+...
+...
+```
+
+### Visibility
+```html
+...
+...
+
+
+Visible on all viewport sizes
+Visible on medium and larger viewports
+Hidden on medium and larger viewports
+```
+
+## JavaScript Components
+
+### Tooltips
+```html
+
+
+
+
+```
+
+### Popovers
+```html
+
+
+
+
+```
+
+### Carousel
+```html
+
+
+
+
+
+```
+
+## Resources
+
+- [Official Documentation](https://getbootstrap.com/docs/5.3/getting-started/introduction/)
+- [Bootstrap Icons](https://icons.getbootstrap.com/)
+- [Bootstrap Examples](https://getbootstrap.com/docs/5.3/examples/)
+- [GitHub Repository](https://github.com/twbs/bootstrap)
+- [Bootstrap Blog](https://blog.getbootstrap.com/)
diff --git a/docs/ui/css-tricks.md b/docs/ui/css-tricks.md
new file mode 100644
index 0000000..4be1bf7
--- /dev/null
+++ b/docs/ui/css-tricks.md
@@ -0,0 +1,581 @@
+# CSS Tricks and Tips
+
+## Layout
+
+### Flexbox Centering
+Center elements both horizontally and vertically:
+```css
+.container {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-height: 100vh; /* Optional: for full viewport height */
+}
+```
+
+### CSS Grid Layout
+Create a responsive grid with auto-fill:
+```css
+.grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
+ gap: 1rem;
+}
+```
+
+### Sticky Footer
+Keep footer at the bottom of the page:
+```css
+body {
+ display: flex;
+ flex-direction: column;
+ min-height: 100vh;
+}
+
+main {
+ flex: 1;
+}
+```
+
+## Effects
+
+### Smooth Scrolling
+```css
+html {
+ scroll-behavior: smooth;
+}
+```
+
+### Custom Scrollbar
+```css
+/* WebKit (Chrome, Safari, newer Edge) */
+::-webkit-scrollbar {
+ width: 10px;
+}
+
+::-webkit-scrollbar-track {
+ background: #f1f1f1;
+}
+
+::-webkit-scrollbar-thumb {
+ background: #888;
+ border-radius: 5px;
+}
+
+/* Firefox */
+html {
+ scrollbar-width: thin;
+ scrollbar-color: #888 #f1f1f1;
+}
+```
+
+### Hover Effects
+```css
+.button {
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
+}
+
+.button:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+}
+```
+
+## Typography
+
+### Text Overflow Ellipsis
+```css
+.ellipsis {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 100%;
+}
+
+/* Multi-line ellipsis (3 lines) */
+.multi-line-ellipsis {
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+```
+
+### System Font Stack
+```css
+body {
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
+ "Helvetica Neue", Arial, sans-serif;
+}
+```
+
+## Responsive Design
+
+### Mobile-First Media Queries
+```css
+/* Base styles (mobile) */
+.container {
+ padding: 1rem;
+}
+
+/* Tablet */
+@media (min-width: 768px) {
+ .container {
+ padding: 2rem;
+ }
+}
+
+/* Desktop */
+@media (min-width: 1024px) {
+ .container {
+ max-width: 1200px;
+ margin: 0 auto;
+ }
+}
+```
+
+### Responsive Images
+```css
+.responsive-img {
+ max-width: 100%;
+ height: auto;
+ display: block;
+}
+
+/* Art direction with picture element */
+
+
+
+
+
+```
+
+## Animations
+
+### Keyframe Animation
+```css
+@keyframes fadeIn {
+ from { opacity: 0; transform: translateY(20px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+
+.animate-fade-in {
+ animation: fadeIn 0.6s ease-out forwards;
+}
+```
+
+### Hover Underline Animation
+```css
+.hover-underline {
+ position: relative;
+ text-decoration: none;
+}
+
+.hover-underline::after {
+ content: '';
+ position: absolute;
+ width: 0;
+ height: 2px;
+ bottom: -2px;
+ left: 0;
+ background-color: currentColor;
+ transition: width 0.3s ease;
+}
+
+.hover-underline:hover::after {
+ width: 100%;
+}
+```
+
+## Forms
+
+### Custom Checkbox/Radio
+```css
+.custom-checkbox {
+ position: relative;
+ padding-left: 30px;
+ cursor: pointer;
+}
+
+.custom-checkbox input {
+ position: absolute;
+ opacity: 0;
+ cursor: pointer;
+ height: 0;
+ width: 0;
+}
+
+.checkmark {
+ position: absolute;
+ top: 0;
+ left: 0;
+ height: 20px;
+ width: 20px;
+ background-color: #eee;
+ border: 2px solid #ddd;
+ border-radius: 4px;
+}
+
+.custom-checkbox:hover input ~ .checkmark {
+ background-color: #ccc;
+}
+
+.custom-checkbox input:checked ~ .checkmark {
+ background-color: #2196F3;
+ border-color: #2196F3;
+}
+
+.checkmark:after {
+ content: "";
+ position: absolute;
+ display: none;
+}
+
+.custom-checkbox input:checked ~ .checkmark:after {
+ display: block;
+}
+
+.custom-checkbox .checkmark:after {
+ left: 6px;
+ top: 2px;
+ width: 5px;
+ height: 10px;
+ border: solid white;
+ border-width: 0 2px 2px 0;
+ transform: rotate(45deg);
+}
+```
+
+## Variables and Theming
+
+### CSS Custom Properties
+```css
+:root {
+ --primary-color: #3498db;
+ --secondary-color: #2ecc71;
+ --spacing-unit: 1rem;
+ --border-radius: 4px;
+ --transition: all 0.3s ease;
+}
+
+.button {
+ background-color: var(--primary-color);
+ padding: calc(var(--spacing-unit) * 2);
+ border-radius: var(--border-radius);
+ transition: var(--transition);
+}
+
+/* Dark mode theming */
+@media (prefers-color-scheme: dark) {
+ :root {
+ --primary-color: #2980b9;
+ --secondary-color: #27ae60;
+ }
+}
+```
+
+## Performance
+
+### Will-Change Property
+```css
+.optimize {
+ will-change: transform, opacity;
+}
+```
+
+### Content Visibility
+```css
+.long-content {
+ content-visibility: auto;
+ contain-intrinsic-size: 0 500px; /* Estimated height */
+}
+```
+
+## Browser Compatibility
+
+### Feature Queries
+```css
+@supports (display: grid) {
+ .container {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ }
+}
+
+@supports not (display: grid) {
+ .container {
+ display: flex;
+ flex-wrap: wrap;
+ }
+
+ .container > * {
+ flex: 1 1 250px;
+ margin: 0.5rem;
+ }
+}
+```
+
+### Vendor Prefixes
+```css
+.gradient-bg {
+ background: #1e5799; /* Fallback */
+ background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 100%);
+ background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 100%);
+ background: linear-gradient(to bottom, #1e5799 0%,#2989d8 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient(
+ startColorstr='#1e5799',
+ endColorstr='#2989d8',
+ GradientType=0
+ );
+}
+```
+
+## Debugging
+
+### Debugging Layout
+```css
+/* Add to any element to debug */
+.debug {
+ outline: 1px solid red;
+ background: rgba(255, 0, 0, 0.1);
+}
+
+/* Debug all elements */
+* { outline: 1px solid rgba(255, 0, 0, 0.2); }
+* * { outline: 1px solid rgba(0, 255, 0, 0.2); }
+* * * { outline: 1px solid rgba(0, 0, 255, 0.2); }
+* * * * { outline: 1px solid rgba(255, 0, 255, 0.2); }
+* * * * * { outline: 1px solid rgba(0, 255, 255, 0.2); }
+```
+
+### Print Styles
+```css
+@media print {
+ /* Hide elements when printing */
+ .no-print {
+ display: none !important;
+ }
+
+ /* Page breaks */
+ .page-break {
+ page-break-before: always;
+ }
+
+ /* Prevent text from breaking across pages */
+ p, h1, h2, h3, h4, h5, h6 {
+ page-break-inside: avoid;
+ }
+
+ /* Set page margins */
+ @page {
+ margin: 2cm;
+ }
+}
+```
+
+## Modern CSS
+
+### Aspect Ratio
+```css
+.aspect-ratio-box {
+ aspect-ratio: 16 / 9;
+ background: #f0f0f0;
+}
+```
+
+### CSS Grid Subgrid
+```css
+.grid-container {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1rem;
+}
+
+.grid-item {
+ display: grid;
+ grid-template-rows: subgrid;
+ grid-row: span 3; /* Number of rows this item spans */
+}
+```
+
+### Container Queries
+```css
+.component {
+ container-type: inline-size;
+}
+
+@container (min-width: 400px) {
+ .component .content {
+ display: flex;
+ gap: 1rem;
+ }
+}
+```
+
+## Accessibility
+
+### Screen Reader Only
+```css
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ white-space: nowrap;
+ border-width: 0;
+}
+
+/* For interactive elements that need to be visible on focus */
+.sr-only.focusable:focus {
+ position: static;
+ width: auto;
+ height: auto;
+ padding: 0.5em;
+ margin: 0;
+ overflow: visible;
+ clip: auto;
+ white-space: normal;
+}
+```
+
+### Reduced Motion
+```css
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ scroll-behavior: auto !important;
+ }
+}
+```
+
+## Bonus: CSS Reset
+```css
+/* Box sizing rules */
+*,
+*::before,
+*::after {
+ box-sizing: border-box;
+}
+
+/* Remove default margin and padding */
+html,
+body,
+h1, h2, h3, h4, h5, h6,
+p, blockquote, pre,
+dl, dd, ol, ul,
+figure,
+fieldset, legend,
+textarea,
+pre, iframe,
+hr {
+ margin: 0;
+ padding: 0;
+}
+
+/* Set core body defaults */
+body {
+ min-height: 100vh;
+ scroll-behavior: smooth;
+ text-rendering: optimizeSpeed;
+ line-height: 1.5;
+}
+
+/* Remove list styles on ul, ol elements */
+ul[class],
+ol[class] {
+ list-style: none;
+}
+
+/* Make images easier to work with */
+img,
+picture,
+video,
+canvas,
+svg {
+ max-width: 100%;
+ display: block;
+}
+
+/* Inherit fonts for inputs and buttons */
+input,
+button,
+textarea,
+select {
+ font: inherit;
+}
+
+/* Remove all animations and transitions for people that prefer not to see them */
+@media (prefers-reduced-motion: reduce) {
+ * {
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ scroll-behavior: auto !important;
+ }
+}
+```
+
+## CSS Variables for Theming
+```css
+:root {
+ /* Colors */
+ --color-primary: #2563eb;
+ --color-secondary: #7c3aed;
+ --color-success: #10b981;
+ --color-warning: #f59e0b;
+ --color-danger: #ef4444;
+
+ /* Typography */
+ --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ --font-mono: 'Fira Code', 'Courier New', monospace;
+
+ /* Spacing */
+ --space-xs: 0.25rem;
+ --space-sm: 0.5rem;
+ --space-md: 1rem;
+ --space-lg: 2rem;
+ --space-xl: 4rem;
+
+ /* Border radius */
+ --radius-sm: 0.25rem;
+ --radius-md: 0.5rem;
+ --radius-lg: 1rem;
+ --radius-full: 9999px;
+
+ /* Shadows */
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
+ --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
+ --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
+ --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
+
+ /* Transitions */
+ --transition-fast: 150ms ease;
+ --transition-normal: 300ms ease;
+ --transition-slow: 500ms ease;
+}
+
+/* Dark mode */
+@media (prefers-color-scheme: dark) {
+ :root {
+ --color-primary: #3b82f6;
+ --color-secondary: #8b5cf6;
+ --color-success: #10b981;
+ --color-warning: #f59e0b;
+ --color-danger: #ef4444;
+
+ --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
+ --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
+ --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
+ --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
+ }
+}
+```
+
+This CSS tricks guide covers a wide range of techniques from basic to advanced, including layout, animations, responsive design, accessibility, and modern CSS features. Each example is ready to use and includes comments for better understanding.
diff --git a/docs/ui/shadcn.md b/docs/ui/shadcn.md
new file mode 100644
index 0000000..8249a94
--- /dev/null
+++ b/docs/ui/shadcn.md
@@ -0,0 +1,580 @@
+# shadcn/ui Documentation
+
+## Introduction
+
+shadcn/ui is a collection of beautifully designed, accessible, and customizable React components that you can copy and paste into your apps. It's built on top of Radix UI and Tailwind CSS.
+
+## Installation
+
+### 1. Create a new Next.js project
+```bash
+npx create-next-app@latest my-app --typescript --tailwind --eslint
+cd my-app
+```
+
+### 2. Install shadcn/ui
+```bash
+npx shadcn-ui@latest init
+```
+
+### 3. Configure your `components.json`
+```json
+{
+ "$schema": "https://ui.shadcn.com/schema.json",
+ "style": "default",
+ "rsc": true,
+ "tsx": true,
+ "tailwind": {
+ "config": "tailwind.config.js",
+ "css": "app/globals.css",
+ "baseColor": "zinc",
+ "cssVariables": true
+ },
+ "aliases": {
+ "components": "@/components",
+ "utils": "@/lib/utils"
+ }
+}
+```
+
+## Adding Components
+
+### Add a component
+```bash
+npx shadcn-ui@latest add button
+npx shadcn-ui@latest add dropdown-menu
+npx shadcn-ui@latest add card
+```
+
+### Available Components
+- `accordion`
+- `alert`
+- `alert-dialog`
+- `aspect-ratio`
+- `avatar`
+- `badge`
+- `button`
+- `calendar`
+- `card`
+- `checkbox`
+- `collapsible`
+- `command`
+- `context-menu`
+- `dialog`
+- `dropdown-menu`
+- `form`
+- `hover-card`
+- `input`
+- `label`
+- `menubar`
+- `navigation-menu`
+- `popover`
+- `progress`
+- `radio-group`
+- `scroll-area`
+- `select`
+- `separator`
+- `sheet`
+- `skeleton`
+- `slider`
+- `switch`
+- `table`
+- `tabs`
+- `textarea`
+- `toast`
+- `toaster`
+- `toggle`
+- `tooltip`
+
+## Basic Usage
+
+### Button Component
+```tsx
+import { Button } from "@/components/ui/button"
+
+export function ButtonDemo() {
+ return (
+
+ )
+}
+```
+
+### Card Component
+```tsx
+import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card"
+import { Button } from "@/components/ui/button"
+
+export function CardDemo() {
+ return (
+
+
+ Create project
+ Deploy your new project in one-click.
+
+
+
+
+
+
+
+
+
+ )
+}
+```
+
+## Form Components
+
+### Form with Validation
+```tsx
+"use client"
+
+import { zodResolver } from "@hookform/resolvers/zod"
+import { useForm } from "react-hook-form"
+import * as z from "zod"
+
+import { Button } from "@/components/ui/button"
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form"
+import { Input } from "@/components/ui/input"
+
+const formSchema = z.object({
+ username: z.string().min(2, {
+ message: "Username must be at least 2 characters.",
+ }),
+ email: z.string().email({
+ message: "Please enter a valid email address.",
+ }),
+})
+
+export function ProfileForm() {
+ const form = useForm>({
+ resolver: zodResolver(formSchema),
+ defaultValues: {
+ username: "",
+ email: "",
+ },
+ })
+
+ function onSubmit(values: z.infer) {
+ console.log(values)
+ }
+
+ return (
+
+
+ )
+}
+```
+
+## Dark Mode
+
+### Theme Provider
+```tsx
+// app/providers.tsx
+"use client"
+
+import * as React from "react"
+import { ThemeProvider as NextThemesProvider } from "next-themes"
+import { type ThemeProviderProps } from "next-themes/dist/types"
+
+export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
+ return {children}
+}
+
+// app/layout.tsx
+import { ThemeProvider } from "@/app/providers"
+
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+
+
+ {children}
+
+
+
+ )
+}
+
+// components/theme-toggle.tsx
+"use client"
+
+import { Moon, Sun } from "lucide-react"
+import { useTheme } from "next-themes"
+
+import { Button } from "@/components/ui/button"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
+
+export function ModeToggle() {
+ const { setTheme } = useTheme()
+
+ return (
+
+
+
+
+
+ setTheme("light")}>
+ Light
+
+ setTheme("dark")}>
+ Dark
+
+ setTheme("system")}>
+ System
+
+
+
+ )
+}
+```
+
+## Customization
+
+### Customizing Theme
+```ts
+// tailwind.config.js
+const { fontFamily } = require('tailwindcss/defaultTheme')
+
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ darkMode: ["class"],
+ theme: {
+ container: {
+ center: true,
+ padding: "2rem",
+ screens: {
+ "2xl": "1400px",
+ },
+ },
+ extend: {
+ colors: {
+ border: "hsl(var(--border))",
+ input: "hsl(var(--input))",
+ ring: "hsl(var(--ring))",
+ background: "hsl(var(--background))",
+ foreground: "hsl(var(--foreground))",
+ primary: {
+ DEFAULT: "hsl(var(--primary))",
+ foreground: "hsl(var(--primary-foreground))",
+ },
+ secondary: {
+ DEFAULT: "hsl(var(--secondary))",
+ foreground: "hsl(var(--secondary-foreground))",
+ },
+ destructive: {
+ DEFAULT: "hsl(var(--destructive))",
+ foreground: "hsl(var(--destructive-foreground))",
+ },
+ muted: {
+ DEFAULT: "hsl(var(--muted))",
+ foreground: "hsl(var(--muted-foreground))",
+ },
+ accent: {
+ DEFAULT: "hsl(var(--accent))",
+ foreground: "hsl(var(--accent-foreground))",
+ },
+ popover: {
+ DEFAULT: "hsl(var(--popover))",
+ foreground: "hsl(var(--popover-foreground))",
+ },
+ card: {
+ DEFAULT: "hsl(var(--card))",
+ foreground: "hsl(var(--card-foreground))",
+ },
+ },
+ borderRadius: {
+ lg: `var(--radius)`,
+ md: `calc(var(--radius) - 2px)`,
+ sm: "calc(var(--radius) - 4px)",
+ },
+ fontFamily: {
+ sans: ["var(--font-sans)", ...fontFamily.sans],
+ },
+ keyframes: {
+ "accordion-down": {
+ from: { height: 0 },
+ to: { height: "var(--radix-accordion-content-height)" },
+ },
+ "accordion-up": {
+ from: { height: "var(--radix-accordion-content-height)" },
+ to: { height: 0 },
+ },
+ },
+ animation: {
+ "accordion-down": "accordion-down 0.2s ease-out",
+ "accordion-up": "accordion-up 0.2s ease-out",
+ },
+ },
+ },
+ plugins: [require("tailwindcss-animate")],
+}
+```
+
+## Advanced Usage
+
+### Custom Component with Variants
+```tsx
+import { cva, type VariantProps } from "class-variance-authority"
+import { Loader2 } from "lucide-react"
+import * as React from "react"
+
+import { cn } from "@/lib/utils"
+
+const buttonVariants = cva(
+ "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
+ {
+ variants: {
+ variant: {
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
+ destructive:
+ "bg-destructive text-destructive-foreground hover:bg-destructive/90",
+ outline:
+ "border border-input hover:bg-accent hover:text-accent-foreground",
+ secondary:
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",
+ ghost: "hover:bg-accent hover:text-accent-foreground",
+ link: "underline-offset-4 hover:underline text-primary",
+ },
+ size: {
+ default: "h-10 py-2 px-4",
+ sm: "h-9 px-3 rounded-md",
+ lg: "h-11 px-8 rounded-md",
+ icon: "h-10 w-10",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ }
+)
+
+export interface ButtonProps
+ extends React.ButtonHTMLAttributes,
+ VariantProps {
+ isLoading?: boolean
+}
+
+const Button = React.forwardRef(
+ ({ className, variant, size, isLoading, children, ...props }, ref) => {
+ return (
+
+ )
+ }
+)
+Button.displayName = "Button"
+
+export { Button, buttonVariants }
+```
+
+## Best Practices
+
+1. **Component Composition**
+ - Compose smaller components to build complex UIs
+ - Use the `asChild` prop for flexible component composition
+
+2. **Performance**
+ - Use dynamic imports for large components
+ - Implement proper loading states
+ - Use `React.memo` for expensive components
+
+3. **Accessibility**
+ - All components are built with accessibility in mind
+ - Use proper ARIA attributes
+ - Ensure keyboard navigation works
+
+4. **Theming**
+ - Use CSS variables for theming
+ - Support both light and dark modes
+ - Provide proper contrast ratios
+
+## Common Patterns
+
+### Data Table with Sorting
+```tsx
+"use client"
+
+import {
+ ColumnDef,
+ ColumnFiltersState,
+ SortingState,
+ VisibilityState,
+ flexRender,
+ getCoreRowModel,
+ getFilteredRowModel,
+ getPaginationRowModel,
+ getSortedRowModel,
+ useReactTable,
+} from "@tanstack/react-table"
+
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/components/ui/table"
+
+interface DataTableProps {
+ columns: ColumnDef[]
+ data: TData[]
+}
+
+export function DataTable({
+ columns,
+ data,
+}: DataTableProps) {
+ const [sorting, setSorting] = React.useState([])
+ const [columnFilters, setColumnFilters] = React.useState([])
+ const [columnVisibility, setColumnVisibility] = React.useState({})
+ const [rowSelection, setRowSelection] = React.useState({})
+
+ const table = useReactTable({
+ data,
+ columns,
+ state: {
+ sorting,
+ columnFilters,
+ columnVisibility,
+ rowSelection,
+ },
+ onSortingChange: setSorting,
+ onColumnFiltersChange: setColumnFilters,
+ onColumnVisibilityChange: setColumnVisibility,
+ onRowSelectionChange: setRowSelection,
+ getCoreRowModel: getCoreRowModel(),
+ getPaginationRowModel: getPaginationRowModel(),
+ getSortedRowModel: getSortedRowModel(),
+ getFilteredRowModel: getFilteredRowModel(),
+ })
+
+ return (
+
+
+
+ {table.getHeaderGroups().map((headerGroup) => (
+
+ {headerGroup.headers.map((header) => {
+ return (
+
+ {header.isPlaceholder
+ ? null
+ : flexRender(
+ header.column.columnDef.header,
+ header.getContext()
+ )}
+
+ )
+ })}
+
+ ))}
+
+
+ {table.getRowModel().rows?.length ? (
+ table.getRowModel().rows.map((row) => (
+
+ {row.getVisibleCells().map((cell) => (
+
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
+
+ ))}
+
+ ))
+ ) : (
+
+
+ No results.
+
+
+ )}
+
+
+
+ )
+}
+```
+
+## Resources
+
+- [Official Documentation](https://ui.shadcn.com/)
+- [GitHub Repository](https://github.com/shadcn/ui)
+- [Radix UI Primitives](https://www.radix-ui.com/)
+- [Tailwind CSS](https://tailwindcss.com/)
+- [Class Variance Authority](https://github.com/joe-bell/cva)