Our textarea component is designed for expressive and effortless text input, offering a refined and user-friendly interface that empowers users to convey their thoughts with ease and style.
Anatomy
Featuring a resizable rectangular field, our textarea component allows users to input and edit multi-line text. Clear labels and an expansive input area contribute to an intuitive and visually pleasing design, ensuring a comfortable text entry experience.
Properties
Boasting essential properties such as "value" to manage the content, "rows" and "cols" for defining dimensions, and "placeholder" for providing hints, our textarea component offers a comprehensive set of features. Additionally, properties like "disabled" and "readonly" provide control over user interaction and content modification.
Status
State
Size
Disabled
Readonly
Default
Default
Small
True
True
Error
Hover
Medium
False
False
Fill
Large
Fill-hover
Press
Status
The "status" denotes the visual status of the textarea, providing options such as default, error, and others, facilitating a dynamic and responsive user interface.
Default textarea signifies the standard appearance of the textarea when not interacting, establishing a baseline visual state.
Error textarea indicates the visual state of the textarea when an error condition is present, accompanied by relevant feedback, ensuring clear communication with users.
import React from'react';import { PlusTextarea } from'@plusui/react';// Default TextareaconstDefaultTextarea= () => ( <PlusTextarealabel="Label"caption="Enter your text here"placeholder="Placeholder" /> {/* Default textarea */});// Error TextareaconstErrorTextarea= () => ( <PlusTextareaerrorlabel="Label"caption="This field has an error"placeholder="Placeholder" /> {/* Textarea with error */});exportdefault { DefaultTextarea, ErrorTextarea,};
<!-- Default Textarea --><plus-textarealabel="Label"caption="Enter your text here"placeholder="Placeholder"></plus-textarea> <!-- Default textarea --><!-- Error Textarea --><plus-textareaerrorlabel="Label"caption="This field has an error"placeholder="Placeholder"></plus-textarea> <!-- Textarea with error -->
<template><!-- Default Textarea --> <plus-textarealabel="Label"caption="Enter your text here"placeholder="Placeholder" /> <!-- Default textarea --><!-- Error Textarea --> <plus-textareaerrorlabel="Label"caption="This field has an error"placeholder="Placeholder" /> <!-- Textarea with error --></template>
<!-- Default Textarea --><plus-textarealabel="Label"caption="Enter your text here"placeholder="Placeholder"></plus-textarea> <!-- Default textarea --><!-- Error Textarea --><plus-textareaerrorlabel="Label"caption="This field has an error"placeholder="Placeholder"></plus-textarea> <!-- Textarea with error -->
States
The "state" represents the visual and interactive state of the textarea, including default, hover, fill, fill-hover, and press states, contributing to an engaging user experience.
Default state textarea defines the standard appearance of the textarea when not actively engaged, ensuring a visually consistent interface.
Hover state textarea signifies the visual changes that occur when the user hovers over the textarea, providing responsive and interactive feedback.
Fill state textarea represents the appearance of the textarea when filled with content, offering a clear visual cue for user input.
Fill-hover state textarea combines the visual states of being filled with content and the user hovering over it, creating a dynamic and responsive interface.
Press state textarea denotes the visual changes that occur when the user clicks or taps on the textarea, providing immediate feedback during user interaction.
import React from'react';import { PlusTextarea } from'@plusui/react';// Empty TextareaconstEmptyTextarea= () => ( <PlusTextarealabel="Your Comments"caption="Please share your thoughts"placeholder="Type here..." /> {/* Empty textarea */});// Filled TextareaconstFilledTextarea= () => ( <PlusTextarealabel="Your Comments"caption="Please share your thoughts"placeholder="Type here..."value="I love using Plus UI!" {/* Textarea with pre-filled text */} />);exportdefault { EmptyTextarea, FilledTextarea,};
<!-- Empty Textarea --><plus-textarealabel="Your Comments"caption="Please share your thoughts"placeholder="Type here..."></plus-textarea> <!-- Empty textarea --><!-- Filled Textarea --><plus-textarealabel="Your Comments"caption="Please share your thoughts"placeholder="Type here..."value="I love using Plus UI!"></plus-textarea> <!-- Textarea with pre-filled text -->
<template>
<!-- Empty Textarea -->
<plus-textarea
label="Your Comments"
caption="Please share your thoughts"
placeholder="Type here..."
/> <!-- Empty textarea -->
<!-- Filled Textarea -->
<plus-textarea
label="Your Comments"
caption="Please share your thoughts"
placeholder="Type here..."
value="I love using Plus UI!"
/> <!-- Textarea with pre-filled text -->
</template>
<!-- Empty Textarea --><plus-textarealabel="Your Comments"caption="Please share your thoughts"placeholder="Type here..."></plus-textarea> <!-- Empty textarea --><!-- Filled Textarea --><plus-textarealabel="Your Comments"caption="Please share your thoughts"placeholder="Type here..."default-value="I love using Plus UI!"></plus-textarea> <!-- Textarea with pre-filled text -->
Size
The size property offers options for small, medium, and large textareas, accommodating various design preferences and layout requirements.
import React from'react';import { PlusTextarea } from'@plusui/react';// Small TextareaconstSmallTextarea= () => ( <PlusTextarealabel="Small Size"caption="Please enter text"placeholder="Type here..."size="sm" /> {/* Small size textarea */});// Medium TextareaconstMediumTextarea= () => ( <PlusTextarealabel="Medium Size"caption="Please enter text"placeholder="Type here..."size="md" /> {/* Medium size textarea */});// Large TextareaconstLargeTextarea= () => ( <PlusTextarealabel="Large Size"caption="Please enter text"placeholder="Type here..."size="lg" /> {/* Large size textarea */});exportdefault { SmallTextarea, MediumTextarea, LargeTextarea,};
<!-- Small Textarea --><plus-textarealabel="Small Size"caption="Please enter text"placeholder="Type here..."size="sm"></plus-textarea> <!-- Small size textarea --><!-- Medium Textarea --><plus-textarealabel="Medium Size"caption="Please enter text"placeholder="Type here..."size="md"></plus-textarea> <!-- Medium size textarea --><!-- Large Textarea --><plus-textarealabel="Large Size"caption="Please enter text"placeholder="Type here..."size="lg"></plus-textarea> <!-- Large size textarea -->
<template><!-- Small Textarea --> <plus-textarealabel="Small Size"caption="Please enter text"placeholder="Type here..."size="sm" /> <!-- Small size textarea --><!-- Medium Textarea --> <plus-textarealabel="Medium Size"caption="Please enter text"placeholder="Type here..."size="md" /> <!-- Medium size textarea --><!-- Large Textarea --> <plus-textarealabel="Large Size"caption="Please enter text"placeholder="Type here..."size="lg" /> <!-- Large size textarea --></template>
<!-- Small Textarea --><plus-textarealabel="Small Size"caption="Please enter text"placeholder="Type here..."size="sm"></plus-textarea> <!-- Small size textarea --><!-- Medium Textarea --><plus-textarealabel="Medium Size"caption="Please enter text"placeholder="Type here..."size="md"></plus-textarea> <!-- Medium size textarea --><!-- Large Textarea --><plus-textarealabel="Large Size"caption="Please enter text"placeholder="Type here..."size="lg"></plus-textarea> <!-- Large size textarea -->
Disabled
Disabled textarea restricts user interaction, preventing input and ensuring controlled behavior when needed.
import React from'react';import { PlusTextarea } from'@plusui/react';// Disabled TextareaconstDisabledTextarea= () => ( <PlusTextarealabel="Disabled Textarea"caption="This field is disabled"placeholder="Cannot enter text"disabled {/* Disabled state */} />);exportdefault DisabledTextarea;
<!-- Disabled Textarea --><plus-textarealabel="Disabled Textarea"caption="This field is disabled"placeholder="Cannot enter text"disabled></plus-textarea> <!-- Disabled state -->
<template><!-- Disabled Textarea --> <plus-textarealabel="Disabled Textarea"caption="This field is disabled"placeholder="Cannot enter text"disabled /> <!-- Disabled state --></template>
<!-- Disabled Textarea --><plus-textarealabel="Disabled Textarea"caption="This field is disabled"placeholder="Cannot enter text"disabled></plus-textarea> <!-- Disabled state -->
Readonly
Read textarea makes the textarea non-editable, allowing users to view the content without the ability to modify it.
import React from'react';import { PlusTextarea } from'@plusui/react';// Readonly TextareaconstReadonlyTextarea= () => ( <PlusTextarealabel="Readonly Textarea"caption="You can only read this field"placeholder="Read-only content"defaultValue="This field is readonly."readOnly {/* Readonly state */} />);exportdefault ReadonlyTextarea;
<!-- Readonly Textarea --><plus-textarealabel="Readonly Textarea"caption="You can only read this field"placeholder="Read-only content"default-value="This field is readonly."readonly></plus-textarea>
<template><!-- Readonly Textarea --> <plus-textarealabel="Readonly Textarea"caption="You can only read this field"placeholder="Read-only content"defaultValue="This field is readonly."readonly /></template>
<!-- Readonly Textarea --><plus-textarealabel="Readonly Textarea"caption="You can only read this field"placeholder="Read-only content"default-value="This field is readonly."readonly></plus-textarea>
Required
The Required Text Area component in our UI library ensures that essential information is captured through a customizable text area, marked as required for form submissions. This component extends the standard text area functionality by adding a "required" attribute, indicating that users must input information before submitting the form.
import React from'react';import { PlusTextarea } from'@plusui/react';// Required TextareaconstRequiredTextarea= () => ( <PlusTextarealabel="Comments"caption="This field is required"placeholder="Enter your comments..."required {/* Required state */} />);exportdefault RequiredTextarea;
<!-- Required Textarea --><plus-textarealabel="Comments"caption="This field is required"placeholder="Enter your comments..."required></plus-textarea>
<template><!-- Required Textarea --> <plus-textarealabel="Comments"caption="This field is required"placeholder="Enter your comments..."required /></template>
<!-- Required Textarea --><plus-textarealabel="Comments"caption="This field is required"placeholder="Enter your comments..."required></plus-textarea>
Layout & Spacing
Prioritizing thoughtful layout and spacing, our textarea component contributes to an organized and visually cohesive form. Consistent alignment and spacing ensure an aesthetically pleasing design, enhancing the overall user experience during text input.
Light & Dark Mode
Seamlessly adapting to both light and dark modes, our textarea component ensures optimal visibility and readability in diverse environments. Careful consideration of color choices and contrast adjustments guarantees a comfortable and stylish text input experience, regardless of the interface theme.
Accessibility
Built with accessibility in mind, our textarea component incorporates features such as proper labeling, logical tab order, keyboard navigation, and ARIA roles. This commitment ensures that the textarea is usable by all, including those with disabilities, promoting inclusivity in the digital space.
Criteria
Description
Status
ID Attribute Value
Ensures every id attribute value is unique
Passed
Color Contrast
Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds.