Communitygithub.com

仪表盘设计

布局网格、KPI卡片、带排序/筛选的数据表格、侧边栏导航和响应式断点。

仪表盘设计 是什么?

该技能为AI代理提供了一套完整的仪表盘设计规则和模式,专注于构建企业级数据可视化界面。它涵盖了从侧边栏+主内容的固定布局到KPI卡片响应式网格的宏观结构,再到数据表格的排序、筛选、分页等微观交互。技能明确推荐使用 `@tanstack/react-table` 和 shadcn/ui 组件,确保开发效率和一致性。同时,它强制要求响应式断点(侧边栏在 `md` 断点处折叠)、加载状态(骨架屏避免布局偏移)和空状态(包含行动号召),以提升用户体验。该技能适用于Claude Code、Cursor等支持SKILL.md的AI编码代理,帮助它们生成符合现代仪表盘设计标准的React代码。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/dashboard-design

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

仪表盘设计 是做什么的?

规则

  • 侧边栏 + 主内容布局:固定侧边栏(w-64),主内容区域流式填充并带有内边距
  • 侧边栏导航:图标 + 标签链接,高亮激活状态,移动端可折叠
  • 顶部KPI卡片行:响应式网格中的3-4张卡片——包含指标名称、数值、趋势(上升/下降百分比),可选迷你趋势图
  • 数据表格:可排序列,可筛选(通过搜索/状态),分页(默认每页10-25行)
  • 使用 @tanstack/react-table 实现无头表格逻辑——搭配 shadcn/ui 的表格组件
  • 响应式:侧边栏在 md 断点处折叠为汉堡菜单,卡片堆叠为1-2列
  • 加载状态:与卡片/表格形状匹配的骨架占位符——绝不引起布局偏移
  • 日期范围选择器用于筛选仪表盘数据——默认最近30天

布局结构

┌──────────┬────────────────────────────┐
│ 侧边栏   │  头部 / 面包屑导航          │
│          ├────────────────────────────┤
│ 导航链接 │  KPI 卡片 (3-4 列网格)      │
│          ├────────────────────────────┤
│          │  图表 / 图形               │
│          ├────────────────────────────┤
│          │  数据表格                  │
└──────────┴────────────────────────────┘

模式

// KPI 卡片
function KPICard({ title, value, change }: { title: string; value: string; change: number }) {
  return (
    <Card>
      <CardHeader className="pb-2">
        <CardTitle className="text-sm font-medium text-muted-foreground">{title}</CardTitle>
      </CardHeader>
      <CardContent>
        <div className="text-2xl font-bold">{value}</div>
        <p className={cn("text-xs", change >= 0 ? "text-green-600" : "text-red-600")}>
          {change >= 0 ? "+" : ""}{change}% 较上期
        </p>
      </CardContent>
    </Card>
  );
}

避免

  • 固定宽度的主内容——始终使用流式布局填充可用空间
  • 没有分页的表格——大数据集会损害性能和可用性
  • 缺少加载/空状态——始终显示骨架屏或“无数据”提示
  • 无法折叠的侧边栏——移动端用户需要全屏宽度
  • 使用加载旋转器进行局部页面更新——应为特定部分使用骨架屏
  • 塞入过多KPI——高亮3-5个关键指标,其余放在可展开区域
  • 从头开始自定义侧边栏——使用 shadcn 的侧边栏组件
  • 没有操作的空白状态——始终包含行动号召(“暂无活动。创建第一个 →”)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Tenant isolation (row-level vs schema), subdomain routing, per-tenant config, and data partitioning.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相关技能