Forms

Textarea

Multi-line text in the same visual language as Input, with optional auto-resize.

Markdown is supported.

Copy
<script setup lang="ts">
const message = ref('')
</script>

<template>
  <JTextarea
    v-model="message"
    label="Feedback"
    placeholder="What could be better?"
    description="Markdown is supported."
  />
</template>

Installation #

With the Nuxt module, every component is auto-imported — there is nothing to add. In a plain Vue project, import what you use:

Copy
import { JTextarea } from '@juxtui/ui'

Usage #

Copy
<JTextarea v-model="bio" label="Bio" autoresize />

Variants & examples #

Auto-resize#

Grows with its content up to maxRows, then scrolls.

Copy
<script setup lang="ts">
const notes = ref('Keep typing | the field grows with you.')
</script>

<template>
  <JTextarea v-model="notes" label="Release notes" :rows="2" :max-rows="8" autoresize />
</template>

Validation#

Up to 80 characters.

Copy
<script setup lang="ts">
const bio = ref('')
const error = computed(() => (bio.value.length > 80 ? `${bio.value.length}/80 | a little shorter, please.` : undefined))
</script>

<template>
  <JTextarea
    v-model="bio"
    label="Bio"
    description="Up to 80 characters."
    :error="error"
    autoresize
  />
</template>

API #

Props

PropTypeDefault Description
modelValuestring | null''Bound with v-model.
labelstring—Visible label, also used as the accessible name.
descriptionstring—Supporting text under the control. Replaced by the error message while one is shown.
errorstring | boolean—An error message, or true to mark the field invalid without a message.
requiredbooleanfalseMarks the field as required, natively and visually.
disabledbooleanfalseDisables the control.
idstring—Id of the control. Generated (SSR-safe) when omitted.
placeholderstring—Placeholder text.
rowsnumber3Initial visible rows.
autoresizebooleanfalseGrow to fit the content.
maxRowsnumber12Upper bound for auto-resize.
readonlybooleanfalseRead-only.
namestring—Form field name.

Events

EventPayload Description
update:modelValuestringEmitted on input.

Slots

SlotProps Description
label—Custom label content.

Methods

MethodSignature Description
focus()() => voidFocus the textarea.

Accessibility #

  • Shares Input’s wiring: a real label, aria-describedby for description and error, aria-invalid when invalid.