/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/ui/src/components/button.stories.tsx
108 строк
2 KB
Adam
chore: storybook (#15285)
27 фев 2026, 01:05
Не верифицирован
27 фев 2026, 01:05
05d77b7
Код
Авторство
О чём код?
// @ts-nocheck import { Button } from "./button" const docs = `### Overview Primary action button with size, variant, and optional icon support. Use \`IconButton\` for icon-only actions. ### API - \`variant\`: "primary" | "secondary" | "ghost". - \`size\`: "small" | "normal" | "large". - \`icon\`: Icon name for a leading icon. - Inherits Kobalte Button props and native button attributes. ### Variants and states - Variants: primary, secondary, ghost. - States: disabled. ### Behavior - Renders an Icon when \`icon\` is set. ### Accessibility - Provide clear label text; use \`aria-label\` for icon-only buttons. ### Theming/tokens - Uses \`data-component="button"\` with size/variant data attributes. ` export default { title: "UI/Button", id: "components-button", component: Button, tags: ["autodocs"], parameters: { docs: { description: { component: docs, }, }, }, args: { children: "Button", variant: "secondary", size: "normal", }, argTypes: { variant: { control: "select", options: ["primary", "secondary", "ghost"], }, size: { control: "select", options: ["small", "normal", "large"], }, icon: { control: "select", options: ["none", "check", "plus", "arrow-right"], mapping: { none: undefined, }, }, }, } export const Primary = { args: { variant: "primary", }, } export const Secondary = {} export const Ghost = { args: { variant: "ghost", }, } export const WithIcon = { args: { children: "Continue", icon: "arrow-right", }, } export const Disabled = { args: { variant: "primary", disabled: true, }, } export const Sizes = { render: () => ( <div style={{ display: "flex", gap: "12px", "align-items": "center" }}> <Button size="small" variant="secondary"> Small </Button> <Button size="normal" variant="secondary"> Normal </Button> <Button size="large" variant="secondary"> Large </Button> </div> ), }