shadcn-remix
GitHub

Textarea

Displays a form textarea or a component that looks like a textarea.

import { Textarea } from '#app/ui/textarea.tsx'

export function TextareaDemo() {
  return () => <Textarea placeholder="Type your message here." />
}
import { Textarea } from '#app/ui/textarea.tsx'

export function TextareaDemo() {
  return () => <Textarea placeholder="Type your message here." />
}

Installation

$ pnpm dlx shadcn@latest add https://www.shadcn-remix.com/r/textarea.json

Usage

import { Textarea } from '#app/ui/textarea.tsx'
<Textarea />

Examples

Disabled

Use the disabled prop to disable the textarea. To style the disabled state, add the data-disabled attribute to the Field component.

import { Textarea } from '#app/ui/textarea.tsx'

export function TextareaDisabled() {
  return () => <Textarea placeholder="Type your message here." disabled />
}
import { Textarea } from '#app/ui/textarea.tsx'

export function TextareaDisabled() {
  return () => <Textarea placeholder="Type your message here." disabled />
}

With button

import { css } from 'remix/component'

import { Button } from '#app/ui/button.tsx'
import { Textarea } from '#app/ui/textarea.tsx'

const gridStyles = css({ display: 'grid', width: '100%', gap: '0.5rem' })
import { css } from 'remix/component'

import { Button } from '#app/ui/button.tsx'
import { Textarea } from '#app/ui/textarea.tsx'

const gridStyles = css({ display: 'grid', width: '100%', gap: '0.5rem' })

export function TextareaWithButton() {
  return () => (
    <div mix={gridStyles}>
      <Textarea placeholder="Type your message here." />
      <Button>Send message</Button>
    </div>
  )
}

With label

import { css } from 'remix/component'

import { Label } from '#app/ui/label.tsx'
import { Textarea } from '#app/ui/textarea.tsx'

const gridStyles = css({ display: 'grid', width: '100%', gap: '0.75rem' })
import { css } from 'remix/component'

import { Label } from '#app/ui/label.tsx'
import { Textarea } from '#app/ui/textarea.tsx'

const gridStyles = css({ display: 'grid', width: '100%', gap: '0.75rem' })

export function TextareaWithLabel() {
  return () => (
    <div mix={gridStyles}>
      <Label htmlFor="message">Your message</Label>
      <Textarea placeholder="Type your message here." id="message" />
    </div>
  )
}

With text

Your message will be copied to the support team.

import { css } from 'remix/component'

import { Label } from '#app/ui/label.tsx'
import { Textarea } from '#app/ui/textarea.tsx'

const gridStyles = css({ display: 'grid', width: '100%', gap: '0.75rem' })
import { css } from 'remix/component'

import { Label } from '#app/ui/label.tsx'
import { Textarea } from '#app/ui/textarea.tsx'

const gridStyles = css({ display: 'grid', width: '100%', gap: '0.75rem' })
const mutedStyles = css({
  fontSize: '0.875rem',
  lineHeight: 'calc(1.25 / 0.875)',
  color: 'var(--muted-foreground)',
})

export function TextareaWithText() {
  return () => (
    <div mix={gridStyles}>
      <Label htmlFor="message-2">Your Message</Label>
      <Textarea placeholder="Type your message here." id="message-2" />
      <p mix={mutedStyles}>Your message will be copied to the support team.</p>
    </div>
  )
}

API Reference

Textarea

PropTypeDefault
mixMixValue-