← 返回 Skills 市场
wpank

Design System Components

作者 wpank · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
1050
总下载
2
收藏
4
当前安装
1
版本数
在 OpenClaw 中安装
/install design-system-components
功能描述
Patterns for building design system components using Surface primitives, CVA variants, and consistent styling. Use when building reusable UI components that follow design token architecture. Triggers on Surface component, CVA, class-variance-authority, component variants, design tokens.
使用说明 (SKILL.md)

Design System Components

Build reusable components that leverage design tokens with Surface primitives and CVA (class-variance-authority).


When to Use

  • Building component libraries with design tokens
  • Need variant-based styling (size, color, state)
  • Creating layered UI with consistent surfaces
  • Want type-safe component APIs

Pattern 1: Surface Primitive

Single component for all layered surfaces:

import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/lib/utils';

const surfaceVariants = cva(
  'rounded-lg backdrop-blur-sm transition-colors',
  {
    variants: {
      layer: {
        panel: 'bg-tone-cadet/40 border border-tone-jordy/10 shadow-card',
        tile: 'bg-tone-midnight/60 border border-tone-jordy/5',
        chip: 'bg-tone-cyan/10 border border-tone-cyan/20 rounded-full',
        deep: 'bg-tone-void/80',
        metric: 'bg-tone-cadet/20 border border-tone-jordy/8',
        glass: 'bg-glass-bg backdrop-blur-lg border border-glass-border',
      },
      interactive: {
        true: 'cursor-pointer hover:bg-tone-cadet/50 active:scale-[0.98]',
        false: '',
      },
      glow: {
        true: 'shadow-glow',
        false: '',
      },
    },
    defaultVariants: {
      layer: 'tile',
      interactive: false,
      glow: false,
    },
  }
);

interface SurfaceProps
  extends React.HTMLAttributes\x3CHTMLDivElement>,
    VariantProps\x3Ctypeof surfaceVariants> {}

export function Surface({
  layer,
  interactive,
  glow,
  className,
  ...props
}: SurfaceProps) {
  return (
    \x3Cdiv
      className={cn(surfaceVariants({ layer, interactive, glow }), className)}
      {...props}
    />
  );
}

Usage

\x3CSurface layer="panel" className="p-4">
  \x3Ch2>Dashboard\x3C/h2>
\x3C/Surface>

\x3CSurface layer="chip" interactive>
  \x3Cspan>Active\x3C/span>
\x3C/Surface>

\x3CSurface layer="metric" glow>
  \x3Cspan className="text-2xl">$1,234.56\x3C/span>
\x3C/Surface>

Pattern 2: CVA Button Variants

const buttonVariants = cva(
  'inline-flex items-center justify-center rounded-md font-medium transition-all focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50',
  {
    variants: {
      variant: {
        default: 'bg-primary text-primary-foreground hover:bg-primary/90',
        destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
        outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
        ghost: 'hover:bg-accent hover:text-accent-foreground',
        link: 'text-primary underline-offset-4 hover:underline',
        cyber: 'bg-gradient-to-r from-tone-cadet to-tone-azure text-white border border-tone-cyan/30 shadow-glow hover:shadow-glow-lg',
      },
      size: {
        default: 'h-10 px-4 py-2',
        sm: 'h-9 rounded-md px-3',
        lg: 'h-11 rounded-md px-8',
        icon: 'h-10 w-10',
      },
    },
    defaultVariants: {
      variant: 'default',
      size: 'default',
    },
  }
);

Pattern 3: Metric Display Component

const metricVariants = cva(
  'font-mono tabular-nums',
  {
    variants: {
      size: {
        lg: 'text-3xl font-bold tracking-tight',
        md: 'text-xl font-semibold',
        sm: 'text-base font-medium',
      },
      trend: {
        positive: 'text-success',
        negative: 'text-destructive',
        neutral: 'text-foreground',
      },
    },
    defaultVariants: {
      size: 'md',
      trend: 'neutral',
    },
  }
);

interface MetricProps extends VariantProps\x3Ctypeof metricVariants> {
  value: string | number;
  label?: string;
  prefix?: string;
  suffix?: string;
}

export function Metric({
  value,
  label,
  prefix = '',
  suffix = '',
  size,
  trend,
}: MetricProps) {
  return (
    \x3Cdiv className="flex flex-col">
      {label && (
        \x3Cspan className="text-xs uppercase tracking-wider text-muted-foreground mb-1">
          {label}
        \x3C/span>
      )}
      \x3Cspan className={cn(metricVariants({ size, trend }))}>
        {prefix}{value}{suffix}
      \x3C/span>
    \x3C/div>
  );
}

Pattern 4: Card with Header

interface CardProps {
  title?: string;
  description?: string;
  action?: React.ReactNode;
  children: React.ReactNode;
}

export function Card({ title, description, action, children }: CardProps) {
  return (
    \x3CSurface layer="panel" className="flex flex-col">
      {(title || action) && (
        \x3Cdiv className="flex items-center justify-between px-4 py-3 border-b border-tone-jordy/10">
          \x3Cdiv>
            {title && (
              \x3Ch3 className="font-display text-sm font-medium">{title}\x3C/h3>
            )}
            {description && (
              \x3Cp className="text-xs text-muted-foreground">{description}\x3C/p>
            )}
          \x3C/div>
          {action}
        \x3C/div>
      )}
      \x3Cdiv className="p-4">{children}\x3C/div>
    \x3C/Surface>
  );
}

Pattern 5: Badge/Chip Variants

const badgeVariants = cva(
  'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors',
  {
    variants: {
      variant: {
        default: 'bg-primary/10 text-primary border border-primary/20',
        success: 'bg-success/10 text-success border border-success/20',
        warning: 'bg-warning/10 text-warning border border-warning/20',
        destructive: 'bg-destructive/10 text-destructive border border-destructive/20',
        outline: 'border border-input text-foreground',
      },
    },
    defaultVariants: {
      variant: 'default',
    },
  }
);

Pattern 6: Composing Variants

Combine CVA with conditional classes:

function StatusIndicator({ 
  status, 
  size = 'md' 
}: { 
  status: 'online' | 'offline' | 'away';
  size?: 'sm' | 'md' | 'lg';
}) {
  const sizeClasses = {
    sm: 'size-2',
    md: 'size-3',
    lg: 'size-4',
  };

  const statusClasses = {
    online: 'bg-success animate-pulse',
    offline: 'bg-muted-foreground',
    away: 'bg-warning',
  };

  return (
    \x3Cspan
      className={cn(
        'rounded-full',
        sizeClasses[size],
        statusClasses[status]
      )}
    />
  );
}

Related Skills


NEVER Do

  • Build custom card containers — Use Surface primitive
  • Hardcode colors in components — Use design tokens
  • Skip variant types — CVA provides type safety
  • Mix styling approaches — Pick CVA or cn(), not random inline styles
  • Forget default variants — Components should work without props

Quick Reference

// 1. Define variants with CVA
const variants = cva('base-classes', {
  variants: {
    size: { sm: '...', md: '...', lg: '...' },
    color: { primary: '...', secondary: '...' },
  },
  defaultVariants: { size: 'md', color: 'primary' },
});

// 2. Type props from variants
interface Props extends VariantProps\x3Ctypeof variants> {}

// 3. Apply in component
\x3Cdiv className={cn(variants({ size, color }), className)} />
安全使用建议
This skill is an instruction-only collection of UI component patterns and appears coherent with its description. Before installing or copying files into your project: (1) verify the origin and license (source/homepage are marked unknown), (2) review the snippets for compatibility with your stack and to ensure no unintended code is introduced, and (3) avoid running unfamiliar install commands; the README's 'npx add' line points to a GitHub tree URL (not a standard package install) — treat it as informational and prefer fetching files from a trusted repository or inspecting them locally first.
功能分析
Type: OpenClaw Skill Name: design-system-components Version: 1.0.0 The skill bundle provides patterns and code examples for building design system components using React and CVA. All content in `_meta.json`, `SKILL.md`, and `README.md` is aligned with this stated purpose. There is no evidence of data exfiltration, malicious execution, persistence, obfuscation, or prompt injection attempts against the AI agent. The `README.md` includes installation instructions using `npx add` from a public GitHub repository, which is a standard method for distributing development assets and does not indicate malicious intent.
能力评估
Purpose & Capability
The name and description (design-system components using Surface primitives and CVA) match the SKILL.md content: example components, CVA variants, and usage snippets. There are no requested env vars, binaries, or unrelated capabilities that would contradict the stated purpose.
Instruction Scope
SKILL.md contains code patterns and usage guidance only. It does not instruct the agent to read system files, access environment variables, call external endpoints, or transmit data. No steps expand scope beyond authoring UI components.
Install Mechanism
There is no install spec in the registry metadata and no code files that will be executed by the platform. README contains manual copy instructions and an npx add line pointing at a GitHub tree URL (informational only). Because the skill is instruction-only, no runtime install or remote download is required by the skill itself.
Credentials
The skill requests no environment variables, credentials, or config paths. The content does not reference secrets or external service tokens. The requested privileges are proportional to a code-pattern documentation skill.
Persistence & Privilege
Flags show always:false and user-invocable:true (normal). The skill does not request persistent agent-wide presence or modify other skills, and it does not perform installation steps that would grant it elevated persistence.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install design-system-components
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /design-system-components 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of design-system-components skill. - Provides patterns for building reusable UI components using Surface primitives, CVA variants, and design tokens. - Includes examples for Surface, Button, Metric, Card, Badge/Chip, and StatusIndicator components. - Demonstrates how to structure components for style consistency, type-safety, and variant-based design. - Outlines best practices and "never do" guidance to enforce design system standards. - Features quick reference snippets for implementing variant-based styles. - Lists related skills for extended design system workflows.
元数据
Slug design-system-components
版本 1.0.0
许可证
累计安装 4
当前安装数 4
历史版本数 1
常见问题

Design System Components 是什么?

Patterns for building design system components using Surface primitives, CVA variants, and consistent styling. Use when building reusable UI components that follow design token architecture. Triggers on Surface component, CVA, class-variance-authority, component variants, design tokens. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1050 次。

如何安装 Design System Components?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install design-system-components」即可一键安装,无需额外配置。

Design System Components 是免费的吗?

是的,Design System Components 完全免费(开源免费),可自由下载、安装和使用。

Design System Components 支持哪些平台?

Design System Components 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Design System Components?

由 wpank(@wpank)开发并维护,当前版本 v1.0.0。

💬 留言讨论