Skip to main content

Components

Textarea

Used to enter long text input which spans over multiple lines

banner-Textarea
Square Icon

Selected Theme

Select brand or tribe name to preview style

Default

Usage

Textarea allow user input. The border should light up simply and clearly indicating which field the user is currently editing.

import { Textarea } from 'legion-ui';

Variant

Legion-ui have five variant of textarea

Basic

Here’s the default usage of Textarea with placeholder attribute set.

<Textarea placeholder="Placeholder" />

you can costumize textarea with normal , success and error.

<Textarea placeholder="Normal" />
<Textarea placeholder="Success" variant="success" />
<Textarea placeholder="Error" variant="error" />

Label

Add a label for each field to make it easier for users to enter values.

Address
Address
This is a help tooltip
AddressOptional
<Textarea placeholder="Where do you live exactly ..." label="Address" />
//label with help
<Textarea label="Address" labelHelp="This is a help tooltip" />
//label with caption optional
<Textarea label="Address" labelOptional={true} />

Disabled

Make textarea look inactive by adding the disabled.

<Textarea placeholder="Hi, this textarea is disabled" disabled />

Error

Add Error Message to Textarea with prop errorMessage, which could be error.

Error Message
Error Message
<Textarea
placeholder="Placeholder..."
errorMessage="Error Message"
variant="error"/>
//add icon Error Message
<Textarea
placeholder="Placeholder..."
errorMessage="Error Message"

Caption

you can add a caption below Textarea

Caption
<Textarea placeholder="Placeholder..." caption="Caption" captionIcon={<DynamicIcon name="AlertCircle" />} />

Props

propertypropTyperequireddefaultdescription
disabledboolean-falseDisabled state of textarea
labelstring--Adds helper text above your textarea element
styleobject--The style prop lets you style elements inline
variantnormal | success | error-normalAdds outline color and state of your placeholder
errorMessagestring--Add message to the error message
errorMessageIconReact.ReactNode--Add icon to the error message
labelHelpstring--Add a help text tooltip to the label
labelOptionalBoolean--Add optional label
captionstring--Add field caption
captionIconReact.ReactNode--Add icon to the caption