1.0.0 • Published 7 months ago

@darksnow-ui/textarea v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Textarea

Displays a form textarea for longer text input.

Installation

npm install @darksnow-ui/textarea

Peer Dependencies

npm install react react-dom

Usage

import { Textarea } from "@darksnow-ui/textarea"
import { Label } from "@darksnow-ui/label"

export function TextareaExample() {
  return (
    <div className="grid w-full gap-1.5">
      <Label htmlFor="message">Your message</Label>
      <Textarea placeholder="Type your message here." id="message" />
    </div>
  )
}

Props

PropTypeDefaultDescription
placeholderstring-Placeholder text
valuestring-Controlled value
defaultValuestring-Default value
onChangefunction-Called when value changes
disabledbooleanfalseDisables the textarea
readOnlybooleanfalseMakes textarea read-only
rowsnumber3Number of visible rows
classNamestring-Additional CSS classes

Examples

Basic Textarea

<Textarea placeholder="Tell us about yourself..." />

With Label

<div className="grid w-full gap-1.5">
  <Label htmlFor="message">Your message</Label>
  <Textarea placeholder="Type your message here." id="message" />
  <p className="text-sm text-theme-content-muted">
    Your message will be sent to our team.
  </p>
</div>

Disabled State

<Textarea disabled placeholder="This textarea is disabled" />

Read-only

<Textarea 
  readOnly 
  value="This content cannot be edited" 
/>

Different Sizes

<div className="space-y-4">
  <Textarea rows={2} placeholder="Small textarea" />
  <Textarea rows={4} placeholder="Medium textarea" />
  <Textarea rows={8} placeholder="Large textarea" />
</div>

Accessibility

  • Proper semantic HTML textarea element
  • Screen reader accessible
  • Keyboard navigation support
  • Form integration support
  • Label association support

Styling

Uses DarkSnow UI design tokens for consistent theming with form controls.

Related Components

1.0.0

7 months ago