Build / Molecules
Textarea
A multi-line text field, for notes and longer free text.
import { Textarea } from '@meetcard/deck'Example
<Textarea label="Meeting notes" rows={4} description="Only visible to you" />Stories
Source
const Default = () => <div style={{ maxWidth: 420 }}>
<Textarea
label="Meeting notes"
placeholder="What did you talk about?"
onChange={fn()} />
</div>;With a description — who can see what is written here, for instance.
Source
const WithDescription = () => <div style={{ maxWidth: 420 }}>
<Textarea
label="Meeting notes"
placeholder="What did you talk about?"
onChange={fn()}
description="Only visible to you." />
</div>;In error. aria-invalid is set and the message is announced.
Source
const WithError = () => <div style={{ maxWidth: 420 }}>
<Textarea
label="Meeting notes"
placeholder="What did you talk about?"
onChange={fn()}
error="Notes cannot be longer than 500 characters" />
</div>;Fixed height, for dense layouts where a resize handle would disrupt flow.
Source
const NotResizable = () => <div style={{ maxWidth: 420 }}>
<Textarea
label="Meeting notes"
placeholder="What did you talk about?"
onChange={fn()}
resize="none" />
</div>;Disabled, with its text still readable.
Source
const Disabled = () => <div style={{ maxWidth: 420 }}>
<Textarea
label="Meeting notes"
placeholder="What did you talk about?"
onChange={fn()}
disabled
defaultValue="Met at SaaSConf." />
</div>;Props
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | ReactNode | — | — |
description | ReactNode | — | — |
error | ReactNode | — | — |
fieldClassName | string | — | — |
hideLabel | boolean | false | — |
resize | 'none' | 'vertical' | 'vertical' | Allow the user to drag-resize. Vertical only by default. |
rows | — | 4 | — |
size | 'sm' | 'md' | 'lg' | 'md' | — |
Also accepts everything from TextareaHTMLAttributes, so id, data-* and event handlers pass straight through.