Styledex
← Index

Fixed Sidebar

固定侧边栏布局

stylekitMITSaaS / B2B · saasDashboard · dashboardProfessional · professionalLight · lightMedium · mediumBlue · blueMedium · mediumSerif · serif

固定位置的侧边导航栏与可滚动主内容区的应用布局,适合后台管理、文档站点、仪表盘、SaaS 应用。

NNorthwind
Product · Pricing
Specimen
Make the work feel finished

One interface, dressed in this style. Compare type, color, radius, and density.

128
Active
4.8
Score
12ms
Edge

Attribution

"Fixed Sidebar" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86.

https://github.com/AnxForever/stylekit · api/styles/sidebar-fixed · bfa7da909e86 · © AnxForever

Do

  • 侧边栏使用 fixed 或 sticky 定位
  • 主内容区设置左边距 ml-64 或 pl-64
  • 移动端侧边栏可收起为抽屉或汉堡菜单
  • 提供展开/收起侧边栏的控制
  • 侧边栏宽度统一 w-64 (256px) 或 w-72 (288px)
  • 当前页面在侧边栏中高亮显示
  • 侧边栏可以包含品牌 logo、导航、用户信息
  • 导航项交互保持快速克制(duration-150),优先颜色和轻微图标位移反馈

Don't

  • 禁止侧边栏过宽影响主内容区
  • 禁止移动端仍保持展开侧边栏
  • 禁止忽略当前页面状态指示
  • 禁止导航层级过深难以操作
  • 禁止侧边栏内容溢出无滚动
  • 禁止侧边栏菜单使用弹跳、旋转等花哨动画
  • 禁止激活项缺少清晰视觉锚点

Prompt

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

---
"Fixed Sidebar" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86.
powered by Styledex — https://styledex.dev

Tokens

DTCG

{
  "$schema": "https://www.designtokens.org/schemas/2025.10/format.json",
  "$description": "Fixed Sidebar. \"Fixed Sidebar\" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86.",
  "$extensions": {
    "dev.styledex": {
      "id": "stylekit-sidebar-fixed",
      "license": "MIT",
      "attribution": "\"Fixed Sidebar\" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86.",
      "banner": "powered by Styledex — https://styledex.dev"
    }
  },
  "color": {
    "background": {
      "$type": "color",
      "$value": "#fafafa"
    },
    "foreground": {
      "$type": "color",
      "$value": "#18181b"
    },
    "card": {
      "$type": "color",
      "$value": "#fafafa"
    },
    "card-foreground": {
      "$type": "color",
      "$value": "#18181b"
    },
    "primary": {
      "$type": "color",
      "$value": "#1e293b"
    },
    "primary-foreground": {
      "$type": "color",
      "$value": "#fafaf9"
    },
    "secondary": {
      "$type": "color",
      "$value": "#f8fafc"
    },
    "secondary-foreground": {
      "$type": "color",
      "$value": "#18181b"
    },
    "accent": {
      "$type": "color",
      "$value": "#3b82f6"
    },
    "accent-foreground": {
      "$type": "color",
      "$value": "#fafaf9"
    },
    "muted": {
      "$type": "color",
      "$value": "#ebebeb"
    },
    "muted-foreground": {
      "$type": "color",
      "$value": "#69696b"
    },
    "border": {
      "$type": "color",
      "$value": "#d7d7d7"
    },
    "destructive": {
      "$type": "color",
      "$value": "#dc2626"
    },
    "ring": {
      "$type": "color",
      "$value": "#1e293b"
    }
  },
  "font": {
    "sans": {
      "$type": "fontFamily",
      "$value": [
        "ui-sans-serif",
        "system-ui",
        "sans-serif"
      ]
    },
    "serif": {
      "$type": "fontFamily",
      "$value": [
        "ui-serif",
        "Georgia",
        "serif"
      ]
    },
    "mono": {
      "$type": "fontFamily",
      "$value": [
        "ui-monospace",
        "SFMono-Regular",
        "Menlo",
        "monospace"
      ]
    }
  },
  "radius": {
    "base": {
      "$type": "dimension",
      "$value": "0.5rem"
    }
  },
  "spacing": {
    "base": {
      "$type": "dimension",
      "$value": "1rem"
    }
  },
  "shadow": {
    "base": {
      "$type": "shadow",
      "$value": "0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04)"
    }
  }
}

CSS

/* powered by Styledex — https://styledex.dev */
/* "Fixed Sidebar" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86. */
:root {
  --background: #fafafa;
  --foreground: #18181b;
  --card: #fafafa;
  --card-foreground: #18181b;
  --primary: #1e293b;
  --primary-foreground: #fafaf9;
  --secondary: #f8fafc;
  --secondary-foreground: #18181b;
  --accent: #3b82f6;
  --accent-foreground: #fafaf9;
  --muted: #ebebeb;
  --muted-foreground: #69696b;
  --border: #d7d7d7;
  --destructive: #dc2626;
  --ring: #1e293b;
  --radius: 0.5rem;
  --font-sans: ui-sans-serif, system-ui, sans-serif;
  --font-serif: ui-serif, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --spacing: 1rem;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
}

Tailwind

/* powered by Styledex — https://styledex.dev */
/* "Fixed Sidebar" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86. */
/** Tailwind theme extend for Fixed Sidebar (stylekit-sidebar-fixed) */
module.exports = {
  "theme": {
    "extend": {
      "colors": {
        "background": "#fafafa",
        "foreground": "#18181b",
        "card": "#fafafa",
        "primary": "#1e293b",
        "primary-foreground": "#fafaf9",
        "secondary": "#f8fafc",
        "accent": "#3b82f6",
        "muted": "#ebebeb",
        "border": "#d7d7d7",
        "destructive": "#dc2626",
        "ring": "#1e293b"
      },
      "borderRadius": {
        "lg": "0.5rem"
      },
      "fontFamily": {
        "sans": [
          "ui-sans-serif",
          "system-ui",
          "sans-serif"
        ],
        "serif": [
          "ui-serif",
          "Georgia",
          "serif"
        ],
        "mono": [
          "ui-monospace",
          "SFMono-Regular",
          "Menlo",
          "monospace"
        ]
      },
      "boxShadow": {
        "styledex": "0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04)"
      }
    }
  }
};

shadcn

/* powered by Styledex — https://styledex.dev */
/* "Fixed Sidebar" from https://github.com/AnxForever/stylekit (MIT). © AnxForever. api/styles/sidebar-fixed @ bfa7da909e86. */
@layer base {
:root {
  --background: #fafafa;
  --foreground: #18181b;
  --card: #fafafa;
  --card-foreground: #18181b;
  --primary: #1e293b;
  --primary-foreground: #fafaf9;
  --secondary: #f8fafc;
  --secondary-foreground: #18181b;
  --accent: #3b82f6;
  --accent-foreground: #fafaf9;
  --muted: #ebebeb;
  --muted-foreground: #69696b;
  --border: #d7d7d7;
  --destructive: #dc2626;
  --ring: #1e293b;
  --radius: 0.5rem;
  --font-sans: ui-sans-serif, system-ui, sans-serif;
  --font-serif: ui-serif, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --spacing: 1rem;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
}
}