Back to Shark UI

Textarea

docs/components/textarea

latest6.5 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Textarea

Copy Markdown

Form textarea or textarea-styled component.

DocsAPI

PreviewCode

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/textarea

Usage#

import { Textarea } from "@/components/ui/textarea";
<Textarea />

Controlled#

Control the value with value and onChange.

PreviewCode

Character count: 0

States#

Disabled#

Disable the textarea with the disabled prop. Use Field with disabled to disable the whole field (label + textarea).

PreviewCode

Feedback

Invalid#

Use the invalid prop on Field or Textarea to show invalid state.

PreviewCode

Feedback

Please provide at least 20 characters.

Examples#

Autoresize#

Use autoresize to make the textarea grow with content.

PreviewCode

With Field#

Wrap the textarea in a Field and add FieldLabel and FieldDescription.

PreviewCode

Message

Add a short message to include with your submission.

With Input Group#

Use FieldGroup to group multiple Field blocks. Combine textarea with other inputs and action buttons.

PreviewCode

script.js

Form Integration#

PreviewCode

Message

SubmitClear

API Reference#

Textarea#

Multi-line text input. Accepts all native textarea attributes.

PropTypeDefault
autoresizebooleantrue
classNamestring-

For a complete list of props, see the Ark UI documentation.

[

Previous page

Tags Input ](/docs/components/tags-input)[

Next page

Timer ](/docs/components/timer)

On This Page

InstallationUsageControlledStatesDisabledInvalidExamplesAutoresizeWith FieldWith Input GroupForm IntegrationAPI ReferenceTextarea