primitives

Textarea

Textarea — a base RevueUI primitive (Reka UI + a shadcn-compatible API).

Loading preview…

src/ui/textarea/Textarea.vue

<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"

const props = defineProps<{
  /** Доп. классы. Имя `class` — соглашение shadcn-vue (не `className`). */
  class?: HTMLAttributes["class"]
}>()

// То же, что в Input.vue: корень — нативный <textarea>, `v-model` сквозным
// атрибутом не работает и нужен явный defineModel.
const model = defineModel<string | number>()

function onInput(event: Event) {
  model.value = (event.target as HTMLTextAreaElement).value
}
</script>

<template>
  <textarea
    data-slot="textarea"
    :value="model"
    :class="
      cn(
        'cn-textarea flex field-sizing-content min-h-16 w-full outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
        props.class
      )
    "
    @input="onInput"
  />
</template>

src/ui/textarea/index.ts

export { default as Textarea } from "./Textarea.vue"

Install

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/textarea.json

Registry dependencies

Source: ported from ReUI (Keenthemes, MIT)