Skip to content

Empty

Displays an empty state placeholder when there is no content.

No content yet

You haven't created any content. Get started by creating your first item.

Cài đặt

bash
npx @galaxy-stack/nebula-cli add empty
bash
npx @galaxy-stack/nebula-cli add empty
bash
npx @galaxy-stack/nebula-cli add empty

Usage

tsx
import { Empty } from '@/components/empty'
import { Button } from '@/components/button'

export default function EmptyDemo() {
  return (
    <Empty description="No data available">
      <Button>Create New</Button>
    </Empty>
  )
}
vue
<script setup lang="ts">
import { Empty } from '@/components/empty'
import { Button } from '@/components/button'
</script>

<template>
  <Empty description="No data available">
    <Button>Create New</Button>
  </Empty>
</template>
typescript
import { Component } from '@angular/core'
import { EmptyComponent } from '@/components/empty'
import { ButtonDirective } from '@/components/button'

@Component({
  selector: 'app-empty-demo',
  standalone: true,
  imports: [EmptyComponent, ButtonDirective],
  template: `
    <ui-empty description="No data available">
      <button gButton>Create New</button>
    </ui-empty>
  `
})
export class EmptyDemo {}

API Reference

Props

PropTypeDefaultMô tảFrameworks
descriptionReactNode-Nội dung mô tả empty stateAll
imageReactNode-Nội dung icon hoặc hình ảnh tùy chỉnhAll
imageAltstring'Empty'Nhãn truy cập cho minh họa mặc địnhAll
classNamestring''CSS class cho containerAll
childrenReactNode-Nội dung action tùy chọn bên dưới mô tảAll

Examples

Custom Image

tsx
<Empty
  image={<img src="/empty.svg" alt="No data" className="w-32 h-32" />}
  description="No items found"
/>

With Action Button

tsx
<Empty description="No projects yet">
  <Button onClick={() => navigate('/create')}>
    Create First Project
  </Button>
</Empty>

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.