Style Catalog/Fixed Sidebar

Fixed Sidebar

固定侧边栏布局

C
69/100Fair
Rate this style

Application layout with a fixed sidebar navigation and scrollable main content area. Ideal for admin dashboards, documentation sites, dashboards, and SaaS applications.

fixed sidebar layoutsidebar navigationadmin dashboard layoutapp shelldashboard uiside menupersistent navigationdocs sidebartwo-column layoutSaaS dashboardcollapsible sidebar
View Full Showcase →
Templates

Best For

fixed sidebar layout / sidebar navigation / admin dashboard layout

Primary Move

Sidebar uses fixed or sticky positioning

Watch Out

Do not make sidebar too wide affecting main content area

AI Implementation

Copy the Hard Prompt first, then use the spec when needed

Use the Hard Prompt by default to generate UI. Use the Design Spec to understand, modify, and review the style. Use the Creative Brief for early exploration.

Hard Prompt

Use this by default: copy it, append the concrete requirement, and let AI generate consistent production UI.

When to use

  • When AI should generate UI directly
  • When repeated outputs must stay consistent
  • When style drift is the main risk

How to use

  • Copy the full prompt
  • Append the concrete requirement
  • Review against forbidden rules and UI states
STYLEKIT_STYLE_REFERENCE
style_name: Fixed Sidebar
style_slug: sidebar-fixed
style_source: /styles/sidebar-fixed

# Hard Prompt

## When To Use
Use this when you want AI to generate code with strict style consistency. It is the safest default for production UI.

## How To Use
- Copy the full prompt into ChatGPT, Claude, Cursor, or another coding assistant.
- Append the concrete product/page requirement after the prompt.
- After generation, check the forbidden rules and interaction states before accepting the output.

Strictly follow the style rules below and maintain consistency. No style drift allowed.

## Requirements

- Prioritize style consistency first, then creative extension.
- When conflicts arise, treat prohibitions as the highest priority.
- Self-check before output: verify colors, typography, spacing, and interactions still match this style.

## Style Rules

You are a frontend expert specializing in Fixed Sidebar layout. All generated code must strictly follow these constraints:

## Absolute Prohibitions

- Do NOT make sidebar too wide (max 280px)
- Do NOT keep sidebar expanded on mobile
- Do NOT forget current page indicator
- Do NOT create overly deep navigation
- Do NOT ignore sidebar overflow scroll

## Must Follow

- Sidebar: fixed top-0 left-0 w-64 h-screen
- Main content: ml-64 (matches sidebar width)
- Mobile: sidebar hidden, hamburger menu trigger
- Active state: highlight current page
- Overflow: sidebar nav scrollable if needed

## Structure

Sidebar (top to bottom):
1. Logo/Brand area
2. Search (optional)
3. Main navigation (scrollable)
4. Secondary nav or settings
5. User profile/account

Main content:
- Left margin matches sidebar width
- Own scrolling context
- Header area for page title
- Content area below

## Responsive

Desktop (1024px+):
- Full sidebar visible
- Main content with left margin

Tablet/Mobile (< 1024px):
- Sidebar as off-canvas drawer
- Hamburger menu button
- Overlay when sidebar open
- Main content full width

## Navigation

- Group related items
- Use icons + labels
- Highlight active item
- Support nested items (accordion)
- Tooltips when collapsed

## Animation & Interaction Rules

- Frictionless Utility: High-interaction areas uniformly use duration-150, avoiding flashy effects that interrupt efficiency.
- Magnetic Icon Shift: On hover, icons slightly shift right (translate-x-0.5), guiding the eye toward the main content area.
- Solid Active State: Current item maintains a stable anchor (left accent line or bold border), avoiding floating feel.
- Content Lift: Main area cards hover only allows -translate-y-0.5 and lightweight shadow, ensuring reading stability.

## Self-Check

After generating code, verify:
1. Sidebar is fixed position
2. Main content has correct margin
3. Mobile has hamburger menu
4. Current page is highlighted
5. Sidebar scrolls if content overflows

---

# Fixed Sidebar Design System

> Application layout with a fixed sidebar navigation and scrollable main content area. Ideal for admin dashboards, documentation sites, dashboards, and SaaS applications.

## Design Philosophy

Fixed Sidebar is a classic layout for application-type interfaces, providing persistent visible navigation while maximizing content display space.

Core principles:
- Persistent navigation: Important entry points are always accessible
- Content priority: Maximize the main area utilization
- Clear hierarchy: The sidebar reflects information architecture
- Responsive adaptation: Gracefully collapse on small screens

---

## Token Dictionary (exact class mapping)

### Border
```
Width: border
Color: border-zinc-200
Radius: rounded-lg
```

### Shadow
```
sm: shadow-sm
md: shadow-sm
lg: shadow-md
hover: hover:shadow-md
focus: focus:shadow-sm
```

### Interaction
```
Hover translate: (none)
Hover scale: (none)
Hover opacity: hover:opacity-90
Transition: transition-colors duration-200
Active: active:scale-95
```

### Typefaces
```
Heading: font-semibold tracking-tight
Body: font-sans
Mono: font-mono
```

### Type scale
```
Hero: text-2xl md:text-3xl
H1: text-xl md:text-2xl
H2: text-lg md:text-xl
H3: text-base md:text-lg
Body: text-sm
Small: text-xs
```

### Spacing
```
Section: py-6 md:py-8
Container: px-4 md:px-6 lg:px-8
Card: p-4 md:p-6
Gap sm: gap-2 md:gap-3
Gap md: gap-4 md:gap-6
Gap lg: gap-6 md:gap-8
```

### Color roles
```
Background primary: bg-zinc-50
Background secondary: bg-white
Background accent: bg-blue-500, bg-emerald-500, bg-amber-500, bg-red-500
Text primary: text-zinc-900
Text secondary: text-zinc-600
Text muted: text-zinc-400
Button primary: bg-blue-500 text-white
Button secondary: bg-zinc-100 text-zinc-700
```

---

## [FORBIDDEN]

These classes are banned in this style. Check for them before returning code:

### Banned classes
- `rounded-2xl`
- `rounded-3xl`
- `rounded-full`
- `shadow-2xl`
- `font-black`
- `font-extrabold`
- `text-4xl`
- `text-5xl`
- `text-6xl`

### Banned patterns
- matches `^rounded-(?:2xl|3xl|full)`
- matches `^shadow-2xl`
- matches `^text-[456]xl`

### Why they are banned
- `rounded-2xl`: Sidebar Fixed uses compact rounded-lg for functional UI elements
- `shadow-2xl`: Sidebar Fixed uses subtle shadows for a clean dashboard feel
- `text-5xl`: Sidebar Fixed uses compact typography appropriate for data-dense layouts

> WARNING: if your code contains any of the above, replace it before shipping.

---

## [REQUIRED]

### Every button must include
```
rounded-lg
text-sm font-medium
transition-colors
```

### Every card must include
```
bg-white
rounded-xl
border border-zinc-200
shadow-sm
```

### Every input must include
```
bg-zinc-100
border-0
rounded-lg
text-sm
focus:outline-none focus:ring-2 focus:ring-blue-500/30
```

---

## [COMPARE] Fixed Sidebar wrong vs right

The wrong examples below stand for generic library defaults that were never adapted to this style. Do not read them as visual suggestions.

### Button

[WRONG] **Wrong** (generic component library default, do not copy):
```html
<button class="{GENERIC_LIBRARY_BUTTON_DEFAULT}">
 Click me
</button>
```

[CORRECT] **Right** (uses this style's tokens):
```html
<button class="rounded-lg text-sm font-medium transition-colors bg-blue-500 text-white">
 Click me
</button>
```

### Card

[WRONG] **Wrong** (generic card, not adapted to this style):
```html
<div class="{GENERIC_LIBRARY_CARD_DEFAULT}">
 <h3>{TITLE}</h3>
</div>
```

[CORRECT] **Right** (uses this style's card tokens):
```html
<div class="bg-white rounded-xl border border-zinc-200 shadow-sm p-4 md:p-6">
 <h3 class="font-semibold tracking-tight text-base md:text-lg">{TITLE}</h3>
</div>
```

### Input

[WRONG] **Wrong** (generic input, not adapted to this style):
```html
<input class="{GENERIC_LIBRARY_INPUT_DEFAULT}" />
```

[CORRECT] **Right** (uses this style's input tokens):
```html
<input class="bg-zinc-100 border-0 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30" placeholder="{PLACEHOLDER}" />
```

---

## [TEMPLATES] Fixed Sidebar page skeletons

These skeletons use this style's tokens only. Replace `{PLACEHOLDER}` values, but keep every token in place:

### Navigation
```html
<nav class="bg-zinc-50 text-zinc-900 border border-zinc-200 px-4 md:px-6 lg:px-8">
 <div class="flex items-center justify-between max-w-6xl mx-auto gap-4 md:gap-6">
 <a href="/" class="font-semibold tracking-tight text-base md:text-lg">
 {LOGO_TEXT}
 </a>
 <div class="flex gap-4 md:gap-6 font-sans text-xs">
 {NAV_LINKS}
 </div>
 </div>
</nav>
```

### Hero section
```html
<section class="bg-blue-500 text-zinc-900 py-6 md:py-8 px-4 md:px-6 lg:px-8">
 <div class="max-w-4xl mx-auto">
 <h1 class="font-semibold tracking-tight text-2xl md:text-3xl">
 {HEADLINE}
 </h1>
 <p class="font-sans text-sm max-w-xl">
 {SUBHEADLINE}
 </p>
 <button class="rounded-lg text-sm font-medium transition-colors bg-blue-500 text-white">
 {CTA_TEXT}
 </button>
 </div>
</section>
```

### Card grid
```html
<section class="bg-zinc-50 text-zinc-900 py-6 md:py-8 px-4 md:px-6 lg:px-8">
 <div class="max-w-6xl mx-auto">
 <h2 class="font-semibold tracking-tight text-lg md:text-xl">{SECTION_TITLE}</h2>
 <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6">
 <!-- Card template - repeat for each card -->
 <div class="bg-white rounded-xl border border-zinc-200 shadow-sm p-4 md:p-6">
 <h3 class="font-semibold tracking-tight text-base md:text-lg">{CARD_TITLE}</h3>
 <p class="font-sans text-sm text-zinc-400">{CARD_DESCRIPTION}</p>
 </div>
 </div>
 </div>
</section>
```

### Form input
```html
<input class="bg-zinc-100 border-0 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30" placeholder="{PLACEHOLDER}" />
```

### Footer
```html
<footer class="bg-white text-zinc-600 py-6 md:py-8 px-4 md:px-6 lg:px-8">
 <div class="max-w-6xl mx-auto">
 <div class="grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-8">
 <div>
 <span class="font-semibold tracking-tight text-base md:text-lg">{LOGO_TEXT}</span>
 <p class="font-sans text-xs">{TAGLINE}</p>
 </div>
 <div>
 <h4 class="font-semibold tracking-tight text-base md:text-lg">{COLUMN_TITLE}</h4>
 <ul class="font-sans text-xs">
 {FOOTER_LINKS}
 </ul>
 </div>
 </div>
 </div>
</footer>
```

---

## [CHECKLIST] Fixed Sidebar post-generation self check

**Before returning code, verify every token and rule below. Fix any violation before delivering:**

### Token check
- [ ] Button includes: `rounded-lg text-sm font-medium transition-colors`
- [ ] Card includes: `bg-white rounded-xl border border-zinc-200 shadow-sm`
- [ ] Input includes: `bg-zinc-100 border-0 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30`

### Forbidden check
- [ ] Not using `rounded-2xl`
- [ ] Not using `rounded-3xl`
- [ ] Not using `rounded-full`
- [ ] Not using `shadow-2xl`
- [ ] Not using `font-black`
- [ ] Not using `font-extrabold`
- [ ] Not using `text-4xl`
- [ ] Not using `text-5xl`

### Style rule check
- [ ] Sidebar uses fixed or sticky positioning
- [ ] Main content area sets left margin ml-64 or pl-64
- [ ] Mobile sidebar collapses to drawer or hamburger menu
- [ ] Provide expand/collapse sidebar controls
- [ ] Sidebar width unified at w-64 (256px) or w-72 (288px)

### Style drift check
- [ ] Does not violate: Do not make sidebar too wide affecting main content area
- [ ] Does not violate: Do not keep sidebar expanded on mobile
- [ ] Does not violate: Do not ignore current page state indication
- [ ] Does not violate: Do not create overly deep navigation levels
- [ ] Does not violate: Do not let sidebar content overflow without scrolling

### Delivery check
- [ ] Responsive layout holds on phone, tablet and desktop with no horizontal overflow
- [ ] Every interactive element has a visible focus state, an accessible name and a reduced-motion path
- [ ] Text contrast meets WCAG AA and colour alone never carries state
- [ ] The result is still recognizable at a glance as Fixed Sidebar

---

## [EXAMPLES] Example prompts

### 1. 

```
Create an admin dashboard with fixed sidebar:
1. Fixed sidebar with logo, search, navigation, user
2. Navigation groups: Dashboard, Content, Users, Settings
3. Active page highlighted in nav
4. Main area with header and content grid
5. Mobile: hamburger menu, slide-out sidebar
6. Collapsible sidebar option (icons only)
7. User dropdown at bottom of sidebar
Professional look with blue accent color
```

### 2. 

```
Create a documentation site with fixed sidebar:
1. Sidebar with doc sections (Getting Started, API, Examples)
2. Nested navigation with accordion expand
3. Search at top of sidebar
4. Main content area with article
5. Right sidebar with table of contents (optional)
6. Previous/Next article navigation at bottom
7. Mobile: slide-out sidebar menu
Clean minimal design focused on readability
```

### 3. SaaS 

SaaS 

```
Create a SaaS application shell with fixed sidebar:
1. Sidebar with workspace switcher at top
2. Main nav: Home, Projects, Team, Reports
3. Secondary nav at bottom: Settings, Help
4. Notification badge on nav item
5. Main content with toolbar and data table
6. Mobile: slide-out navigation
7. Collapsible sidebar with keyboard shortcut hint
Modern SaaS aesthetic with subtle shadows
```

## Absolute Bans (Match and Refuse)

If any of the following patterns appear, it is a style violation — rewrite without exception.

- make sidebar too wide affecting main content area
- keep sidebar expanded on mobile
- ignore current page state indication
- create overly deep navigation levels
- let sidebar content overflow without scrolling
- use bouncy, spinning, or flashy animations for sidebar menus
- leave active items without a clear visual anchor

## Self-Check (Verify Before Shipping)

If any item fails, the style has drifted — fix before shipping.

- [ ] No purple-to-blue gradients
- [ ] No overused fonts (Inter, Roboto, Geist, Fraunces, Plus Jakarta Sans)
- [ ] No nested cards (cards inside cards)
- [ ] No gray text on colored backgrounds
- [ ] Body text contrast meets WCAG AA (>= 4.5:1)
- [ ] No bounce or elastic easing curves
- [ ] Animations have a prefers-reduced-motion fallback
- [ ] Body text line length capped at 65-75 characters
- [ ] No side-stripe accent borders (border-left/right > 1px)
- [ ] No gradient text (background-clip: text)
- [ ] No glassmorphism used as the default surface treatment
- [ ] No tiny uppercase tracked eyebrow labels above every section heading
- [ ] do not make sidebar too wide affecting main content area
- [ ] do not keep sidebar expanded on mobile
- [ ] do not ignore current page state indication
- [ ] do not create overly deep navigation levels
- [ ] do not let sidebar content overflow without scrolling

More prompt libraries: All UI Prompts · Tailwind UI Prompts · Dark Mode UI Prompts

Community

Ratings & Feedback

No ratings yet - be the firstSign in to rate

Loading comments…

Component Templates

Component Preview

侧边栏按钮

侧边栏中的操作按钮

Frontend Readiness

Dark Mode, States, Motion, and Accessibility

This layer tracks whether the style is ready for real websites: theme modes, state feedback, keyboard access, and performance constraints.

Overall

51%

Fallback

Dark Mode

0%

Missing

UI States

79%

Partial

Motion

70%

Partial

A11y

70%

Partial

Performance

35%

Fallback

Key State Coverage

light
HoverFocus VisibleDisabledLoadingEmptyErrorSuccess

Button

Default / Hover / Focus Visible / Active / Disabled

Input

Default / Hover / Focus Visible / Disabled / Error

Card

Default / Hover / Focus Visible / Loading / Skeleton

Form

Default / Focus Visible / Disabled / Loading / Error

Implementation Notes

  • No curated dark-mode contract exists yet.
  • Check contrast in both light and dark modes.
  • Check heavy shadows, blur, large media, and scroll-linked effects manually.
  • No style-specific performance cost profile has been curated yet.

FAQ

Fixed Sidebar — Frequently Asked Questions

What is the Fixed Sidebar design style?
Application layout with a fixed sidebar navigation and scrollable main content area. Ideal for admin dashboards, documentation sites, dashboards, and SaaS applications. Its core principle: Fixed Sidebar is a classic layout for application-type interfaces, providing persistent visible navigation while maximizing content display space.
What colors does Fixed Sidebar use?
Fixed Sidebar uses #1e293b as its primary color and #f8fafc as its secondary color, with accent colors #3b82f6, #10b981, #f59e0b, #ef4444. Every hex value can be copied from the palette on this page.
How do I apply Fixed Sidebar correctly?
Key practices: Sidebar uses fixed or sticky positioning. Main content area sets left margin ml-64 or pl-64. Mobile sidebar collapses to drawer or hamburger menu.
What are common mistakes with Fixed Sidebar?
Avoid: Do not make sidebar too wide affecting main content area. Do not keep sidebar expanded on mobile. Do not ignore current page state indication.
How do I prompt AI to generate Fixed Sidebar UI?
Copy the ready-made AI prompt on this page — it bundles the design tokens and component rules — and paste it into ChatGPT, Claude, Claude Code, or Codex. Effective prompts include the keywords: fixed sidebar layout, sidebar navigation, admin dashboard layout, app shell.
Global Styles

Global CSS

css
/* Fixed Sidebar Global Styles */

/* Sidebar base */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 16rem; /* 256px */
  height: 100vh;
  background: white;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.3s ease;
}

/* Main content offset */
.main-content {
  margin-left: 16rem;
  min-height: 100vh;
}

/* Mobile sidebar hidden by default */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Collapsed sidebar variant */
.sidebar-collapsed {
  width: 4rem; /* 64px */
}

.sidebar-collapsed .sidebar-label {
  display: none;
}

.sidebar-collapsed + .main-content {
  margin-left: 4rem;
}

/* Navigation item active state */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #64748b;
  transition: all 0.2s;
}

.nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}
/* Fixed Sidebar Design Tokens */
:root {
  --sidebar-fixed-primary: #1e293b;
  --sidebar-fixed-secondary: #f8fafc;
  --sidebar-fixed-accent: #3b82f6;
  --sidebar-fixed-glow: rgba(30, 41, 59, 0.3);
}

@keyframes sidebar-fixed-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sidebar-fixed-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.sidebar-fixed-card {
  position: relative;
  overflow: hidden;
}

.sidebar-fixed-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.05), transparent);
  pointer-events: none;
}

.sidebar-fixed-card:hover::before {
  opacity: 1;
}

.sidebar-fixed-gradient {
  background: linear-gradient(135deg, #1e293b, #3b82f6);
}

.sidebar-fixed-gradient-text {
  background: linear-gradient(135deg, #1e293b, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-fixed-frosted {
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  background: rgba(30, 41, 59, 0.08);
}

.sidebar-fixed-accent-corner {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 2rem), calc(100% - 2rem) 100%, 0 100%);
}

.sidebar-fixed-animate-in {
  animation: sidebar-fixed-fade-in 0.5s ease-out both;
}

Compatible Visual Styles

Try Pairing

Fixed Sidebar is a layout pattern that can be paired with the following visual styles.

IDE Integration

IDE Configuration Export

Download configuration files for AI coding assistants to generate code in this style.

Style Pack

Export Style Pack

Get complete machine-readable style assets including design tokens, Tailwind presets, CSS variables, and shadcn/ui themes.

Metadata

Style metadata including version information

Design Tokens

Compatible with Figma / Style Dictionary / Tokens Studio

Tailwind Preset

Tailwind CSS theme preset, import directly in config

Global CSS

CSS variables and base styles

shadcn Theme

shadcn/ui theme configuration

CSS Variables

Pure CSS variables, works with any project

SKILL.md

Loadable skill pack for Cursor / Claude Code / VS Code

Design Philosophy

Fixed Sidebar is a classic layout for application-type interfaces, providing persistent visible navigation while maximizing content display space.

Accessibility

Accessibility Score

WCAG 2.1 compliance analysis based on color contrast and typography readability.

69

Overall Score

Grade: C - Fair

Contrast Ratios

Score: 73/100Average Ratio: 7.69:1
AA FailAAA Fail
ContextColorsRatioAAAAA
Text on secondary background
/#18181b / #ffffff
17.72:1
Button primary
/#ffffff / #3b82f6
3.68:1
Text on accent 1
/#18181b / #3b82f6
4.82:1
Text on accent 2
/#18181b / #10b981
6.98:1
Text on accent 3
/#18181b / #f59e0b
8.25:1
Text on accent 4
/#18181b / #ef4444
4.71:1

Readability

Score

58/100

Font Size

text-sm

Font Weight

font-semibold tracking-tight

Line Height

default

Scoring is based on WCAG 2.1 standards. AA requires 4.5:1 contrast for normal text, 3:1 for large text; AAA requires 7:1 for normal text, 4.5:1 for large text.