Guide
Form Elements
Textarea

Textarea

Textarea is a React component designed to create customizable input fields with various options such as placeholder, color, label, and more. It supports different variants like outlined, filled, and standard, along with size and color customization.

Example Preview

Textarea Example

Usage

import { Textarea } from "@/@core";
 
// Use Textarea in your component
<Textarea
  placeholder="Enter text"
  label="Username"
  variant="outlined"
  helperText="Please enter your username"
  disabled={false}
  defaultValue=""
  value=""
  error={false}
  size="md"
  color="ghost"
  // Additional HTML attributes can be passed as well
  onChange={(e) => console.log(e.target.value)}
/>;

Props

Prop nameTypeDefault valueRequiredDescription
placeholderstring-NoPlaceholder text for the input field.
classNamestring-NoAdditional CSS classes for styling.
labelstring-NoLabel for the input field.
variantfilled, outlined, standardstandardNoInput field variant.
helperTextstring-NoHelper text displayed below the input field.
disabledbooleanfalseNoDisables the input field.
defaultValuestring-NoDefault value for the input field.
valuestring-NoControlled value for the input field.
errorbooleanfalseNoIndicates whether there's an error with the input.
sizexs, sm, md, lgmdNoSize of the input field.
colorprimary, secondary, error, success, warning, info, accent, ghostprimaryNoColor of the input field.
propsHTMLAttributes<HTMLTextAreaElement>-NoAdditional HTML attributes can be passed as well.

Additionally, it accepts all HTML input attributes (HTMLAttributes<HTMLTextAreaElement>).

Styling

The component allows for extensive styling customization through the use of various classes based on the specified options. These classes can be passed through the className prop.

For example, to style the input field with a specific color and size, you can pass additional classes:

<Textarea
  className="custom-style primary-color lg"
  // other props...
/>

In the above example, the input field will have the styles defined by the 'custom-style', 'primary-color', and 'lg' classes. Refer to the source code for a detailed list of available classes.

ℹ️

Note: The InputField component is inspired by the DaisyUI (opens in a new tab) framework. Check it out for more awesome components. But our InputField component is dynamic and easy to use. It is also fully customizable.