aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/field.stories.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/atoms/forms/field.stories.tsx')
-rw-r--r--src/components/atoms/forms/field.stories.tsx45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/components/atoms/forms/field.stories.tsx b/src/components/atoms/forms/field.stories.tsx
index 02681e7..ec81922 100644
--- a/src/components/atoms/forms/field.stories.tsx
+++ b/src/components/atoms/forms/field.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
+import { useState } from 'react';
import FieldComponent from './field';
export default {
@@ -7,11 +8,35 @@ export default {
args: {
disabled: false,
required: false,
- setValue: () => null,
type: 'text',
- value: '',
},
argTypes: {
+ 'aria-labelledby': {
+ control: {
+ type: 'text',
+ },
+ description: 'One or more ids that refers to the field name.',
+ table: {
+ category: 'Accessibility',
+ },
+ type: {
+ name: 'string',
+ required: false,
+ },
+ },
+ className: {
+ control: {
+ type: 'text',
+ },
+ description: 'Add classnames to the field.',
+ table: {
+ category: 'Styles',
+ },
+ type: {
+ name: 'string',
+ required: false,
+ },
+ },
disabled: {
control: {
type: 'boolean',
@@ -148,7 +173,7 @@ export default {
},
value: {
control: {
- type: 'text',
+ type: null,
},
description: 'Field value.',
type: {
@@ -159,14 +184,18 @@ export default {
},
} as ComponentMeta<typeof FieldComponent>;
-const Template: ComponentStory<typeof FieldComponent> = (args) => (
- <FieldComponent {...args} />
-);
+const Template: ComponentStory<typeof FieldComponent> = ({
+ value: _value,
+ setValue: _setValue,
+ ...args
+}) => {
+ const [value, setValue] = useState<string>('');
+
+ return <FieldComponent value={value} setValue={setValue} {...args} />;
+};
export const Field = Template.bind({});
Field.args = {
id: 'field-storybook',
name: 'field-storybook',
- setValue: () => null,
- value: '',
};