<script setup lang="ts">
withDefaults(
  defineProps<{
    modelValue?: string
    invalid?: boolean
    rows?: number
    placeholder?: string
  }>(),
  {
    modelValue: '',
    invalid: false,
    rows: 4,
  },
)

defineEmits<{ 'update:modelValue': [value: string] }>()
</script>

<template>
  <textarea
    class="nych-textarea"
    :data-p="invalid ? 'invalid' : undefined"
    :rows="rows"
    :placeholder="placeholder"
    :value="modelValue"
    @input="$emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)"
  />
</template>
