Skip to content

Commit 30c335b

Browse files
committed
storybook: added a story for field name
1 parent 759fa6e commit 30c335b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

stories/Form.RruForm.stories.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import {
2727
RruMultiSelectInput,
2828
RruRadioInput,
2929
RruSelectInput,
30-
RruTextInput,
3130
RruTextareaInput,
31+
RruTextInput,
3232
useRruForm,
3333
} from '../src/index';
3434
import animalsOptions from './data/animalsOptions';
@@ -533,3 +533,27 @@ export const SetValueProgrammaticallyAllTypes = (args) => {
533533
</RruForm>
534534
);
535535
};
536+
537+
export const ValidateFieldNames = (args) => {
538+
const rruFormContext = useRruForm();
539+
540+
const onSubmit = (form) => {
541+
action('submitting the form')(form);
542+
};
543+
544+
return (
545+
<RruForm
546+
context={rruFormContext}
547+
onSubmit={onSubmit}>
548+
549+
<RruTextInput name='email' label='Email' requiredAsterisk />
550+
<RruTextInput name='color1' label='Email' requiredAsterisk />
551+
<RruTextInput name='animal.1' label='Email' requiredAsterisk />
552+
553+
<button type='submit' className='btn btn-primary mt-4'>
554+
Submit
555+
</button>
556+
557+
</RruForm>
558+
);
559+
};

0 commit comments

Comments
 (0)