Textarea

A multi-line field you type in.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/textarea.json

Default with counter

Min height 104, grows with content, radius 24 (the same curve as the 48 pill). The counter is helper text the app computes.

0 / 200 karakter

States

Same states as Input: error, disabled 60 %, read-only --muted.

Tulis nama bank, nomor rekening dan nama pemilik.

Tulis alasan agar karyawan tahu kenapa cutinya ditolak.

When to use

  • Free text that can be more than one line: Alasan cuti, Alasan penolakan, Alamat, Data baru.

When not to use

  • One short line (nama, nomor) → Input.
  • A fixed set of answers (Alasan keluar: Resign, PHK …) → Select or RadioGroup; add a Textarea only for "Lainnya".

Do and don't

DoSay what to writeHelper text "Tulis nama bank, nomor rekening dan nama pemilik." removes guessing.
Don'tA Textarea for a choiceAsking "Alasan keluar" as free text makes reports impossible. Use Select, plus a Textarea for "Lainnya".

Installation

Add Textarea with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/textarea.json

API

import { Textarea } from "@/components/ui/textarea"
PropTypeDefaultDescription
aria-invalidboolean–Error edge. Pair with FieldError.
readOnly · disabledboolean–--muted fill / 60 %.
maxLength · value · onChange · rows …native textarea props–Show "n / max karakter" as FieldDescription.