aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/label/label.stories.tsx
blob: 195be972751c17e85edf2b6d1196649ae438fcc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { Label as LabelComponent } from './label';

/**
 * Label - Storybook Meta
 */
export default {
  title: 'Atoms/Forms',
  component: LabelComponent,
  args: {
    isHidden: false,
    isRequired: false,
    size: 'sm',
  },
  argTypes: {
    'aria-label': {
      control: {
        type: 'text',
      },
      description: 'Define an accessible name.',
      table: {
        category: 'Accessibility',
      },
      type: {
        name: 'string',
        required: false,
      },
    },
    className: {
      control: {
        type: 'text',
      },
      description: 'Add classnames to the label.',
      table: {
        category: 'Styles',
      },
      type: {
        name: 'string',
        required: false,
      },
    },
    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,
      },
    },
    isHidden: {
      control: {
        type: 'boolean',
      },
      description: 'Set to true if the label should be visually hidden.',
      table: {
        category: 'Options',
        defaultValue: { summary: false },
      },
      type: {
        name: 'boolean',
        required: false,
      },
    },
    isRequired: {
      control: {
        type: 'boolean',
      },
      description: 'Set to true if the field is required.',
      table: {
        category: 'Options',
        defaultValue: { summary: false },
      },
      type: {
        name: 'boolean',
        required: false,
      },
    },
    size: {
      control: {
        type: 'select',
      },
      description: 'The label size.',
      options: ['md', 'sm'],
      table: {
        category: 'Options',
        defaultValue: { summary: 'sm' },
      },
      type: {
        name: 'string',
        required: false,
      },
    },
  },
} as ComponentMeta<typeof LabelComponent>;

const Template: ComponentStory<typeof LabelComponent> = ({
  children,
  ...args
}) => <LabelComponent {...args}>{children}</LabelComponent>;

/**
 * Label Story
 */
export const Label = Template.bind({});
Label.args = {
  children: 'A label',
};