Docs
Textarea

Textarea

Displays a textarea component.

Installation

Copy and paste the following code into your component.

import * as React from "react";
import styles from "./textarea.module.css";

export interface TextareaProps
  extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}

const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
  ({ className, ...props }, ref) => {
    return (
      <textarea
        className={`${styles.textareaBase} ${className ?? ""}`}
        ref={ref}
        {...props}
      />
    );
  }
);
Textarea.displayName = "Textarea";

export { Textarea };

Copy and paste the following CSS into a .module.css file.

.textareaBase {
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
  display: flex;
  font-size: var(--text-sm);
  min-height: 85px;
  outline-offset: 2px;
  padding-inline: 0.75rem;
  padding-block: 0.5rem;
  width: 100%;
}

.textareaBase::placeholder {
  color: hsl(var(--muted-foreground));
}

.textareaBase:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.textareaBase:focus-visible {
  outline-color: hsl(var(--secondary));
}

Update the import paths to match your project setup.

Usage

import { Textarea } from "@/components/ui/textarea";
<Textarea placeholder='Enter your message here...' />

Examples

Basic

Disabled

With Label