diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-03-31 18:21:30 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-03-31 18:21:30 +0200 |
| commit | 581632a626f81bce522be1cd809e9832d5b11c99 (patch) | |
| tree | d00f1bb0ac632ed2c3c79f6797a37745cf294db5 /src/components/atoms/forms/label.stories.tsx | |
| parent | d67328f866fa469b67e2525556388d4bcc283737 (diff) | |
chore: add a Label component
Diffstat (limited to 'src/components/atoms/forms/label.stories.tsx')
| -rw-r--r-- | src/components/atoms/forms/label.stories.tsx | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/components/atoms/forms/label.stories.tsx b/src/components/atoms/forms/label.stories.tsx new file mode 100644 index 0000000..06e8eb9 --- /dev/null +++ b/src/components/atoms/forms/label.stories.tsx @@ -0,0 +1,53 @@ +import { ComponentMeta, ComponentStory } from '@storybook/react'; +import LabelComponent from './label'; + +export default { + title: 'Atoms/Forms', + component: LabelComponent, + argTypes: { + children: { + control: { + type: 'text', + }, + description: 'The label body.', + type: { + name: 'string', + required: true, + }, + }, + htmlFor: { + control: { + type: 'text', + }, + description: 'The field id.', + type: { + name: 'string', + required: true, + }, + }, + required: { + control: { + type: 'boolean', + }, + description: 'Set to true if the field is required.', + table: { + category: 'Options', + }, + type: { + name: 'boolean', + required: false, + }, + }, + }, +} as ComponentMeta<typeof LabelComponent>; + +const Template: ComponentStory<typeof LabelComponent> = (args) => { + const { children, ...props } = args; + return <LabelComponent {...props}>{children}</LabelComponent>; +}; + +export const Label = Template.bind({}); +Label.args = { + children: 'A label', + htmlFor: 'a-field-id', +}; |
