Tansy UI is a React component kit by OpenKhalix, named after the tansy
flower ("golden buttons"). It has two surfaces:
- A landing page built entirely from the kit's own components, with
five featured parts, a palette-switching playground form, and links
into Storybook
- A Storybook workshop with Tansy branding, a Welcome page, palette
toolbar and accessibility checks
Includes 15 components with colocated tokens and stories, seven brand
palettes, a palette-aware logo, a Docker/nginx image, a scripted
cPanel deploy, and a generator that keeps the landing page catalogue
in sync with Storybook.
81 lines
1.9 KiB
TypeScript
81 lines
1.9 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
import { Button, LinkButton } from './Button'
|
|
|
|
const meta = {
|
|
title: 'Actions/Button',
|
|
component: Button,
|
|
tags: ['autodocs'],
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
component: 'A reusable button with visual variants and size tokens. Use semantic variants rather than ad-hoc colors.',
|
|
},
|
|
},
|
|
},
|
|
argTypes: {
|
|
variant: {
|
|
control: 'select',
|
|
options: ['primary', 'secondary', 'outline', 'ghost', 'danger'],
|
|
},
|
|
size: {
|
|
control: 'select',
|
|
options: ['sm', 'md', 'lg'],
|
|
},
|
|
},
|
|
args: {
|
|
children: 'Continue',
|
|
variant: 'primary',
|
|
size: 'md',
|
|
},
|
|
} satisfies Meta<typeof Button>
|
|
|
|
export default meta
|
|
type Story = StoryObj<typeof meta>
|
|
|
|
export const Playground: Story = {}
|
|
|
|
export const Variants: Story = {
|
|
render: () => (
|
|
<div className="flex flex-wrap gap-3">
|
|
<Button>Primary</Button>
|
|
<Button variant="secondary">Secondary</Button>
|
|
<Button variant="outline">Outline</Button>
|
|
<Button variant="ghost">Ghost</Button>
|
|
<Button variant="danger">Danger</Button>
|
|
</div>
|
|
),
|
|
}
|
|
|
|
export const Sizes: Story = {
|
|
render: () => (
|
|
<div className="flex flex-wrap items-center gap-3">
|
|
<Button size="sm">Small</Button>
|
|
<Button size="md">Medium</Button>
|
|
<Button size="lg">Large</Button>
|
|
</div>
|
|
),
|
|
}
|
|
|
|
export const Disabled: Story = {
|
|
args: {
|
|
disabled: true,
|
|
children: 'Unavailable',
|
|
},
|
|
}
|
|
|
|
export const AsLink: Story = {
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
story: '`LinkButton` renders an anchor with the same variants and sizes. Use it for navigation so the page keeps real links.',
|
|
},
|
|
},
|
|
},
|
|
render: () => (
|
|
<div className="flex flex-wrap gap-3">
|
|
<LinkButton href="#">Browse components</LinkButton>
|
|
<LinkButton href="#" variant="outline">Read the guide</LinkButton>
|
|
</div>
|
|
),
|
|
}
|