AppShell 应用外壳
系统布局
应用外壳 — 系统级布局外壳,用于后台/仪表盘/认证等整页布局。
何时使用
应用外壳,提供顶部导航、侧边栏、主区域布局。
代码示例
基础用法
tsx
import { AppShell } from "@/components/layout/app-shell"
export function Basic() {
return <AppShell />
}API / Props
AppShell
| Prop | Type | Default | 说明 |
|---|---|---|---|
className | string | — | 自定义样式类名 |
header | React.ReactNode | — | |
sidebar | React.ReactNode | — | |
aside | React.ReactNode | — | |
footer | React.ReactNode | — | |
sidebarWidth | number | 240 | |
asideWidth | number | 280 | |
sidebarCollapsible | boolean | true | |
defaultCollapsed | boolean | false | |
variant | "default" | "floating" | "sticky" | default | 样式变体 |
| ...rest | React.ComponentProps<"div"> | — | 透传 <div> 原生属性 |
注意事项
- Client Component: 使用
"use client",依赖 React hooks/状态,需在客户端渲染。 - 原生属性: 继承所有
<div>原生 HTML 属性。
📘 完整交互式示例与控件属性请查看 Storybook 文档。