Skip to content

Textarea

Hiển thị form textarea cho nhập văn bản dài hơn.

Cài đặt

bash
npx @galaxy-stack/nebula-cli@latest add textarea
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add textarea
bash
yarn dlx @galaxy-stack/nebula-cli@latest add textarea
bash
bunx @galaxy-stack/nebula-cli@latest add textarea

Sử dụng

Vue

vue
<script setup lang="ts">
import { Textarea } from '@/components/ui'
import { ref } from 'vue'

const message = ref('')
</script>

<template>
  <Textarea v-model="message" placeholder="Nhập tin nhắn của bạn tại đây." />
</template>

React

tsx
import { Textarea } from '@/components/ui'

export default function TextareaDemo() {
  return <Textarea placeholder="Nhập tin nhắn của bạn tại đây." />
}

Angular

typescript
import { Component } from '@angular/core';
import { TextareaComponent } from '@/components/ui';

@Component({
  selector: 'app-textarea-demo',
  standalone: true,
  imports: [TextareaComponent],
  template: `
    <ui-textarea
      [(ngModel)]="message"
      placeholder="Nhập tin nhắn của bạn tại đây."
    />
  `
})
export class TextareaDemoComponent {
  message = '';
}

API Reference

Props

PropTypeDefaultMô tảFrameworks
valuestring | number-Giá trị textarea (controlled)All
defaultValuestring | number-Giá trị khởi tạo (uncontrolled)All
placeholderstring-Văn bản giữ chỗAll
disabledbooleanfalseVô hiệu hóa textareaAll
rowsnumber-Số hàng văn bản hiển thịAll
namestring-Tên field cho form submissionAll
requiredbooleanfalseBắt buộc trườngAll
readOnlybooleanfalseChỉ đọcAll
maxLengthnumber-Số ký tự tối đaAll
autoCompletestring-Thuộc tính autocompleteAll
classNamestring''CSS classAll

Khả năng truy cập

  • Điều hướng bàn phím: [TODO]
  • Đọc màn hình: [TODO]
  • Quản lý focus: [TODO]
  • Tuân thủ WCAG: Tuân thủ WCAG 2.1 cấp độ AA

Tác giả

Bùi Trọng Hiếu (kevinbui)

Giấy phép

MIT © 2025 Bùi Trọng Hiếu (kevinbui)

Phát hành theo Giấy phép MIT.