text-field (#12889)
parent
5273aa334e
commit
51fa7734fd
@ -0,0 +1,51 @@ |
||||
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; |
||||
|
||||
import TextField from '.'; |
||||
|
||||
# Text Field |
||||
|
||||
Text fields allow users to enter text into a UI. |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--default-story" /> |
||||
</Canvas> |
||||
|
||||
## Component API |
||||
|
||||
<ArgsTable of={TextField} /> |
||||
|
||||
### Password Text Field |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--password" /> |
||||
</Canvas> |
||||
|
||||
### With Error |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--error" /> |
||||
</Canvas> |
||||
|
||||
### Mascara Text |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--mascara-text" /> |
||||
</Canvas> |
||||
|
||||
### With Material Theme |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--material-text" /> |
||||
</Canvas> |
||||
|
||||
### Password With Material Theme |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--material-password" /> |
||||
</Canvas> |
||||
|
||||
### With Material Theme Error |
||||
|
||||
<Canvas> |
||||
<Story id="ui-components-ui-text-field-text-field-stories-js--material-error" /> |
||||
</Canvas> |
@ -1,33 +1,75 @@ |
||||
import React from 'react'; |
||||
import README from './README.mdx'; |
||||
import TextField from '.'; |
||||
|
||||
export default { |
||||
title: 'Components/UI/TextField', |
||||
id: __filename, |
||||
component: TextField, |
||||
parameters: { |
||||
docs: { |
||||
page: README, |
||||
}, |
||||
}, |
||||
argTypes: { |
||||
error: { control: 'text' }, |
||||
classes: { control: 'object' }, |
||||
dir: { control: 'text' }, |
||||
theme: { |
||||
control: 'select', |
||||
options: ['bordered', 'material', 'material-white-padded'], |
||||
}, |
||||
startAdornment: { control: 'element' }, |
||||
largeLabel: { control: 'boolean' }, |
||||
min: { control: 'number' }, |
||||
max: { control: 'number' }, |
||||
autoComplete: { control: 'text' }, |
||||
}, |
||||
}; |
||||
|
||||
export const DefaultStory = () => <TextField label="Text" type="text" />; |
||||
|
||||
export const DefaultStory = (args) => <TextField {...args} />; |
||||
DefaultStory.storyName = 'Default'; |
||||
DefaultStory.args = { |
||||
label: 'Text', |
||||
type: 'text', |
||||
}; |
||||
|
||||
export const Password = () => <TextField label="Password" type="password" />; |
||||
|
||||
export const Error = () => ( |
||||
<TextField type="text" label="Name" error="Invalid value" /> |
||||
); |
||||
|
||||
export const MascaraText = () => ( |
||||
<TextField label="Text" type="text" largeLabel /> |
||||
); |
||||
export const Password = (args) => <TextField {...args} />; |
||||
Password.args = { |
||||
label: 'Password', |
||||
type: 'password', |
||||
}; |
||||
export const Error = (args) => <TextField {...args} />; |
||||
Error.args = { |
||||
type: 'text', |
||||
label: 'Name', |
||||
error: 'Invalid Value', |
||||
}; |
||||
export const MascaraText = (args) => <TextField {...args} />; |
||||
MascaraText.args = { |
||||
label: 'Text', |
||||
type: 'text', |
||||
largeLabel: true, |
||||
}; |
||||
|
||||
export const MaterialText = () => ( |
||||
<TextField label="Text" type="text" theme="material" /> |
||||
); |
||||
export const MaterialText = (args) => <TextField {...args} />; |
||||
MaterialText.args = { |
||||
label: 'Text', |
||||
type: 'text', |
||||
theme: 'material', |
||||
}; |
||||
|
||||
export const MaterialPassword = () => ( |
||||
<TextField label="Password" type="password" theme="material" /> |
||||
); |
||||
export const MaterialPassword = (args) => <TextField {...args} />; |
||||
MaterialPassword.args = { |
||||
label: 'Password', |
||||
type: 'password', |
||||
theme: 'material', |
||||
}; |
||||
|
||||
export const MaterialError = () => ( |
||||
<TextField type="text" label="Name" error="Invalid value" theme="material" /> |
||||
); |
||||
export const MaterialError = (args) => <TextField {...args} />; |
||||
MaterialError.args = { |
||||
type: 'text', |
||||
label: 'Name', |
||||
error: 'Invalid Value', |
||||
theme: 'material', |
||||
}; |
||||
|
Loading…
Reference in new issue