npx skills add https://github.com/mindrally/skills --skill storybook你是一位使用 Storybook 构建和记录组件库的专家。在创建故事、组织组件和维护设计系统时,请应用以下指南。
ComponentName.stories.tsximport type { Meta, StoryObj } from '@storybook/react';
import { Component } from './Component';
const meta: Meta<typeof Component> = {
title: 'Category/Component',
component: Component,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
// 在此定义参数类型
},
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
// 默认属性
},
};
export const Variant: Story = {
args: {
variant: 'secondary',
},
};
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
argTypes: {
variant: {
control: 'select',
options: ['primary', 'secondary', 'tertiary'],
description: '视觉样式变体',
table: {
defaultValue: { summary: 'primary' },
},
},
size: {
control: 'radio',
options: ['sm', 'md', 'lg'],
},
disabled: {
control: 'boolean',
},
onClick: {
action: 'clicked',
},
}
decorators: [
(Story) => (
<ThemeProvider theme={defaultTheme}>
<Story />
</ThemeProvider>
),
],
parameters: {
layout: 'centered', // 或 'fullscreen', 'padded'
backgrounds: {
default: 'light',
values: [
{ name: 'light', value: '#ffffff' },
{ name: 'dark', value: '#1a1a1a' },
],
},
viewport: {
defaultViewport: 'responsive',
},
},
import { within, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
export const Clickable: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
await userEvent.click(button);
await expect(button).toHaveFocus();
},
};
// .storybook/main.ts
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
};
export default config;
每周安装量
102
仓库
GitHub 星标数
42
首次出现
2026年1月25日
安全审计
安装于
opencode87
gemini-cli85
codex81
cursor80
github-copilot78
amp74
You are an expert in building and documenting component libraries with Storybook. Apply these guidelines when creating stories, organizing components, and maintaining design systems.
ComponentName.stories.tsximport type { Meta, StoryObj } from '@storybook/react';
import { Component } from './Component';
const meta: Meta<typeof Component> = {
title: 'Category/Component',
component: Component,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
// Define arg types here
},
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
// Default props
},
};
export const Variant: Story = {
args: {
variant: 'secondary',
},
};
argTypes: {
variant: {
control: 'select',
options: ['primary', 'secondary', 'tertiary'],
description: 'Visual style variant',
table: {
defaultValue: { summary: 'primary' },
},
},
size: {
control: 'radio',
options: ['sm', 'md', 'lg'],
},
disabled: {
control: 'boolean',
},
onClick: {
action: 'clicked',
},
}
decorators: [
(Story) => (
<ThemeProvider theme={defaultTheme}>
<Story />
</ThemeProvider>
),
],
parameters: {
layout: 'centered', // or 'fullscreen', 'padded'
backgrounds: {
default: 'light',
values: [
{ name: 'light', value: '#ffffff' },
{ name: 'dark', value: '#1a1a1a' },
],
},
viewport: {
defaultViewport: 'responsive',
},
},
import { within, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
export const Clickable: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
await userEvent.click(button);
await expect(button).toHaveFocus();
},
};
// .storybook/main.ts
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
};
export default config;
Weekly Installs
102
Repository
GitHub Stars
42
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode87
gemini-cli85
codex81
cursor80
github-copilot78
amp74
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
iOS Swift调试与性能分析指南:LLDB、Instruments、内存泄漏排查
675 周安装
Laravel 11/12应用开发指南:工作流程、技术栈检测与最佳实践
660 周安装
语音与音频工程师:TTS语音合成、语音克隆与播客制作全指南
100 周安装
Swift 5.9+ 至 Swift 6 核心语言特性与语法模式详解 | 现代 iOS 开发指南
677 周安装
SwiftUI 手势开发指南:iOS 手势交互、组合与状态管理(Swift 6.2)
680 周安装
科学图表制作指南:使用Matplotlib/Seaborn创建符合期刊标准的可视化图表
666 周安装