# responsive
## When to Use
Use this command when you want to:
- Implement responsive/mobile design using DaisyUI components
- Make existing components mobile-friendly with DaisyUI patterns
- Create beautiful, modern responsive layouts following DaisyUI documentation
- Optimize UI for different screen sizes using DaisyUI's responsive features
## Prerequisites
- Component or page file open or specified
- Tailwind CSS configured
- DaisyUI installed and configured
- Reference to DaisyUI documentation: https://daisyui.com/components/
- Understanding of the component's current structure
## Execution Steps
### Step 1: Analyze Current Component
Read the component file to understand its structure:
**If file is open in editor:**
- Use the currently open file
**If file path provided:**
- Read the file: `cat [file-path]`
**Analyze:**
- Current layout structure (grid, flex, etc.)
- Existing responsive classes (if any)
- Component complexity and nesting
- Content that needs to be responsive (tables, forms, charts, cards)
### Step 2: Identify Responsive Requirements
Determine what needs to be responsive:
**Common responsive patterns:**
- **Navigation**: Mobile hamburger menu, desktop horizontal nav
- **Tables**: Horizontal scroll on mobile, full table on desktop
- **Forms**: Stacked inputs on mobile, side-by-side on desktop
- **Cards/Grids**: Single column on mobile, multi-column on desktop
- **Charts**: Smaller on mobile, larger on desktop
- **Modals**: Full screen on mobile, centered on desktop
- **Text**: Smaller on mobile, larger on desktop
- **Spacing**: Tighter on mobile, more spacious on desktop
**Identify:**
- Which elements need responsive behavior
- Breakpoints where layout should change
- Mobile vs desktop content differences
### Step 3: Apply Mobile-First Responsive Design
Implement responsive design using Tailwind's mobile-first approach:
#### 3.1: Breakpoint Strategy
**Tailwind breakpoints (mobile-first):**
- Base (default): Mobile (< 640px)
- `sm:` - Small devices (≥ 640px)
- `md:` - Medium devices (≥ 768px)
- `lg:` - Large devices (≥ 1024px)
- `xl:` - Extra large (≥ 1280px)
- `2xl:` - 2X Extra large (≥ 1536px)
**Pattern:** Start with mobile styles, then add larger breakpoints:
```tsx
// Mobile first: base styles are for mobile
// Option 3: Card layout on mobile, table on desktop
{/* DaisyUI cards for mobile */}
{/* Card content matching table data */}
{/* Table for desktop */}
```
#### 3.5: Form Patterns (DaisyUI Form)
**DaisyUI Form Patterns** (https://daisyui.com/components/form/):
```tsx
// DaisyUI form-control with responsive grid
```
#### 3.6: Typography Patterns
**Responsive Text:**
```tsx
// Smaller on mobile, larger on desktop
Title
Content
```
#### 3.7: Spacing Patterns
**Responsive Spacing:**
```tsx
// Tighter on mobile, more spacious on desktop
{/* Content */}
// Responsive gaps
{/* Items */}
```
#### 3.8: Modal/Dialog Patterns (DaisyUI Modal)
**DaisyUI Modal Patterns** (https://daisyui.com/components/modal/):
```tsx
// Full screen on mobile, centered on desktop
// Responsive modal with different sizes
```
#### 3.9: Chart/Visualization Patterns
**Responsive Charts:**
```tsx
// Responsive chart container
// Or use aspect ratio
```
### Step 4: Reference DaisyUI Documentation
**Before implementing any component, check DaisyUI documentation:**
- Open or reference: https://daisyui.com/components/
- Find the component you need (navbar, card, table, modal, etc.)
- Review the component's responsive examples and classes
- Use the exact DaisyUI classes and patterns from the docs
**DaisyUI Documentation Structure:**
- Each component page shows examples
- Copy the exact class names and structure
- Adapt the examples to your use case with responsive breakpoints
### Step 5: Apply DaisyUI Responsive Components
Use DaisyUI components following official documentation: https://daisyui.com/components/
**DaisyUI Responsive Components (from docs):**
1. **Navbar** (https://daisyui.com/components/navbar/):
- Use `navbar` with `navbar-start`, `navbar-center`, `navbar-end`
- Mobile hamburger: `btn btn-ghost lg:hidden`
- Desktop nav: `hidden lg:flex`
```tsx
{/* Desktop nav items */}
```
2. **Drawer** (https://daisyui.com/components/drawer/):
- Use `drawer` with `drawer-side` for mobile sidebar
- Toggle with `drawer-open` class
```tsx
{/* Sidebar content */}
```
3. **Card** (https://daisyui.com/components/card/):
- Use `card` with `card-body` for responsive cards
- Responsive grid: `grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3`
```tsx
Title
Content
```
4. **Table** (https://daisyui.com/components/table/):
- Wrap in `overflow-x-auto` for mobile scroll
- Use `table-xs` for mobile, `table` for desktop
```tsx
{/* Table content */}
```
5. **Modal** (https://daisyui.com/components/modal/):
- Use `modal` with `modal-box` for responsive modals
- Full screen mobile: `w-full max-w-none md:max-w-2xl`
```tsx
```
6. **Form** (https://daisyui.com/components/form/):
- Use `form-control` with responsive grid
- Inputs: `input input-bordered w-full`
```tsx
```
7. **Bottom Navigation** (https://daisyui.com/components/bottom-navigation/):
- Use `btm-nav` for mobile bottom navigation
```tsx
```
8. **Tabs** (https://daisyui.com/components/tabs/):
- Use `tabs` with responsive layout
- Mobile: `tabs tabs-boxed`, Desktop: `tabs tabs-lifted`
```tsx