Skip to content
loseta

Components / Forms

Textarea

Displays a multi-line text input.

Status stableWorks with field, button, label
<textarea class="textarea" placeholder="Type your message here." aria-label="Message"></textarea>

Installation

pnpm dlx loseta add textarea
npx loseta add textarea

Examples

Field

Your message will be copied to the support team.

<div class="field" style="max-width: 24rem">
  <label class="label" for="demo-textarea-field">Message</label>
  <textarea class="textarea" id="demo-textarea-field" placeholder="Type your message here."></textarea>
  <p>Your message will be copied to the support team.</p>
</div>

Disabled

This field is currently disabled.

<div class="field" style="max-width: 24rem">
  <label class="label" for="demo-textarea-disabled">Message</label>
  <textarea class="textarea" id="demo-textarea-disabled" placeholder="Type your message here." disabled></textarea>
  <p>This field is currently disabled.</p>
</div>

Invalid

<div class="field" style="max-width: 24rem">
  <label class="label" for="demo-textarea-invalid">Message</label>
  <textarea class="textarea" id="demo-textarea-invalid" placeholder="Type your message here." aria-invalid="true" aria-describedby="demo-textarea-invalid-error"></textarea>
  <p id="demo-textarea-invalid-error" role="alert">Please enter a valid message.</p>
</div>

Button

<div class="field" style="max-width: 24rem">
  <textarea class="textarea" placeholder="Type your message here." aria-label="Message"></textarea>
  <button type="button" class="btn">Send message</button>
</div>

Right-to-left

شاركنا أفكارك حول خدمتنا.

<div class="field" dir="rtl" lang="ar" style="max-width: 24rem">
  <label class="label" for="demo-textarea-rtl">التعليقات</label>
  <textarea class="textarea" id="demo-textarea-rtl" placeholder="تعليقاتك تساعدنا على التحسين..." dir="rtl"></textarea>
  <p>شاركنا أفكارك حول خدمتنا.</p>
</div>

Accessibility and behavior

  • Pair every textarea with a label; a placeholder is not a label. Use native required and disabled states and aria-invalid="true" for the invalid state. Compose labels and descriptions with .field. The control grows with its content and resizes vertically by default.

Files

components/textarea.cssbase
styles/nova/textarea.cssstyle

Install contract

The CLI writes the base file under components/, the visual file for the selected style under styles/<name>/, and any primitive dependency underprimitives/. The generated index.css imports them in the right layer order.

← Back to components

loseta is MIT licensed. Built with native CSS, no runtime. Inspired byshadcn/ui.