|
| 1 | +/** |
| 2 | + * Copyright IBM Corp. 2016, 2018 |
| 3 | + * |
| 4 | + * This source code is licensed under the Apache-2.0 license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + */ |
| 7 | + |
| 8 | +import React from 'react'; |
| 9 | +import FormGroup from '../FormGroup'; |
| 10 | +import TextInput from '../../TextInput'; |
| 11 | +import RadioButtonGroup from '../../RadioButtonGroup'; |
| 12 | +import RadioButton from '../../RadioButton'; |
| 13 | +import Button from '../../Button'; |
| 14 | +import { Stack } from '../../Stack'; |
| 15 | + |
| 16 | +export default { |
| 17 | + title: 'Components/FormGroup', |
| 18 | + component: FormGroup, |
| 19 | + argTypes: { |
| 20 | + disabled: { |
| 21 | + control: { |
| 22 | + type: 'boolean', |
| 23 | + }, |
| 24 | + defaultValue: false, |
| 25 | + }, |
| 26 | + // TODO remove hasMargin in v11 |
| 27 | + hasMargin: { |
| 28 | + table: { |
| 29 | + disable: true, |
| 30 | + }, |
| 31 | + }, |
| 32 | + legendText: { |
| 33 | + control: { type: 'text' }, |
| 34 | + defaultValue: 'FormGroup Legend', |
| 35 | + }, |
| 36 | + legendId: { |
| 37 | + control: { type: 'text' }, |
| 38 | + defaultValue: 'formgroup-legend-id', |
| 39 | + }, |
| 40 | + children: { |
| 41 | + control: false, |
| 42 | + }, |
| 43 | + }, |
| 44 | +}; |
| 45 | + |
| 46 | +export const Default = (args) => ( |
| 47 | + <FormGroup style={{ maxWidth: '400px' }} {...args}> |
| 48 | + <Stack gap={7}> |
| 49 | + <TextInput id="one" labelText="First Name" /> |
| 50 | + <TextInput id="two" labelText="Last Name" /> |
| 51 | + <RadioButtonGroup |
| 52 | + legendText="Radio button heading" |
| 53 | + name="radio-button-group" |
| 54 | + defaultSelected="radio-1"> |
| 55 | + <RadioButton labelText="Option 1" value="radio-1" id="radio-1" /> |
| 56 | + <RadioButton labelText="Option 2" value="radio-2" id="radio-2" /> |
| 57 | + <RadioButton labelText="Option 3" value="radio-3" id="radio-3" /> |
| 58 | + </RadioButtonGroup> |
| 59 | + <Button>Submit</Button> |
| 60 | + </Stack> |
| 61 | + </FormGroup> |
| 62 | +); |
0 commit comments