mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-21 15:27:53 +00:00
118 lines
2.7 KiB
Plaintext
118 lines
2.7 KiB
Plaintext
import { Meta, Story, Props, Canvas } from '@storybook/addon-docs/blocks'
|
|
import { config, withDesign } from 'storybook-addon-designs'
|
|
import { action } from '@storybook/addon-actions'
|
|
|
|
import FormTextarea from '@baserow/modules/core/components/FormTextarea'
|
|
|
|
<Meta
|
|
title="Baserow/Form Elements/Textarea"
|
|
component={FormTextarea}
|
|
parameters={{
|
|
backgrounds: {
|
|
default: 'light',
|
|
values: [
|
|
{ name: 'white', value: '#ffffff' },
|
|
{ name: 'light', value: '#eeeeee' },
|
|
{ name: 'dark', value: '#222222' },
|
|
],
|
|
},
|
|
}}
|
|
decorators={[withDesign]}
|
|
argTypes={{
|
|
rows: {
|
|
control: {
|
|
type: 'number',
|
|
},
|
|
defaultValue: 4,
|
|
},
|
|
placeholder: {
|
|
control: {
|
|
type: 'text',
|
|
},
|
|
defaultValue: 'Type something...',
|
|
},
|
|
disabled: {
|
|
control: {
|
|
type: 'boolean',
|
|
},
|
|
defaultValue: false,
|
|
},
|
|
autoExpandable: {
|
|
control: {
|
|
type: 'boolean',
|
|
},
|
|
defaultValue: false,
|
|
},
|
|
error: {
|
|
control: {
|
|
type: 'boolean',
|
|
},
|
|
defaultValue: false,
|
|
},
|
|
minRows: {
|
|
control: {
|
|
type: 'number',
|
|
},
|
|
defaultValue: null,
|
|
},
|
|
maxRows: {
|
|
control: {
|
|
type: 'number',
|
|
},
|
|
defaultValue: null,
|
|
},
|
|
maxlength: {
|
|
control: {
|
|
type: 'number',
|
|
},
|
|
defaultValue: null,
|
|
},
|
|
size: {
|
|
control: {
|
|
type: 'select',
|
|
options: ['small', 'regular'],
|
|
},
|
|
defaultValue: 'regular',
|
|
},
|
|
}}
|
|
/>
|
|
|
|
# FormTextarea
|
|
|
|
FormTextarea is a component that renders a textarea. The textarea can auto grow in height when the user types more text.
|
|
|
|
export const Template = (args, { argTypes }) => ({
|
|
components: { FormTextarea },
|
|
props: Object.keys(argTypes),
|
|
template: `
|
|
<FormTextarea v-bind="$props">
|
|
</FormTextarea>
|
|
`,
|
|
})
|
|
|
|
export const designConfig = {
|
|
type: 'figma',
|
|
url: 'https://www.figma.com/file/W7R2rQW7ohsZMeHRfEcPFW/Design-Library?node-id=1%3A87&mode=dev',
|
|
}
|
|
|
|
<Canvas>
|
|
<Story
|
|
name="Textarea"
|
|
parameters={{
|
|
design: config(designConfig),
|
|
}}
|
|
>
|
|
{Template.bind({})}
|
|
</Story>
|
|
</Canvas>
|
|
|
|
## Example
|
|
|
|
```javascript
|
|
<FormTextarea>Label</FormTextarea>
|
|
```
|
|
|
|
## Props
|
|
|
|
<Props of={FormTextarea} />
|