Đi tới nội dung tài liệu
Underverse UI Logo
ComponentHiển thị dữ liệu

DataTable (with i18n)

Đã cập nhật

DataTable (with i18n) thuộc nhóm Hiển thị dữ liệu. Xem demo trực tiếp, cách tích hợp và các lưu ý triển khai.

Bắt đầu nhanh

Import DataTable (with i18n) từ entry công khai. Các ví dụ bên dưới thể hiện những kiểu tương tác và cấu hình được hỗ trợ.

component.tsxtsx
import { DataTable } from '@underverse-ui/underverse';

Ví dụ tương tác

Dùng thử DataTable (with i18n) thật, xem mã ví dụ và tra cứu các prop đã được mô tả.

Đang tải ví dụ tương tác…
Tham chiếu

Tham chiếu API

Tra cứu các thuộc tính, kiểu dữ liệu được chấp nhận, giá trị mặc định và lưu ý về hành vi.

Dữ liệu được sinh từ API TypeScript công khai của thư viện. Kiểu dữ liệu, thuộc tính bắt buộc và giá trị mặc định luôn đồng bộ với mã nguồn.

DataTable

Component
Thuộc tínhMô tảKiểuMặc định
columnsBắt buộcĐịnh nghĩa cột.DataTableColumn<T>[]Bắt buộc
dataBắt buộcDữ liệu hàng.T[]Bắt buộc
rowKeyHàm lấy khoá hàng.((row: T) => string | number) | keyof T
loadingHiển thị trạng thái đang tải.boolean
totalTổng số hàng (server).number0
pageTrang hiện tại.number1
pageSizeSố hàng/trang.number20
pageSizeOptionsDanh sách tuỳ chọn số mục/trang.number[]
onQueryChangeHàm thay đổi truy vấn (server).(q: DataTableQuery) => void
captionNội dung caption.React.ReactNode
toolbarThanh công cụ.React.ReactNode
showToolbarShow the toolbar row above the table. Default: truebooleantrue
columnColorGroupsDefine color groups for the column visibility dropdown legend. Key = color value used in column's `colorTag` (e.g. "#1e40af"). If not provided, columns with colorTag still get colored but won't be grouped in dropdown.Record<string, ColumnColorGroup>
sizeVisual size preset. Maps to component scales in the table UI.DataTableSize"md"
enableColumnVisibilityToggleBật ẩn/hiện cột.booleantrue
enableDensityToggleBật đổi density.booleantrue
enableHeaderAlignToggleMã nguồn chưa cung cấp mô tả bổ sung.booleanfalse
uppercaseHeaderUppercase all text displayed in table headers. Default: falsebooleanfalse
stripedHàng kẻ sọc.booleantrue
columnDividersHiển thị đường kẻ dọc ngăn cách giữa các cộtbooleanfalse
classNameClass tuỳ chỉnh.string
storageKeyKey để lưu pageSize vào localStorage. Nếu không cung cấp, pageSize sẽ không được persiststring
stickyHeaderBật sticky header khi cuộn. Mặc định là falsebooleantrue
maxHeightChiều cao tối đa của bảng khi bật stickyHeader (mặc định: 500px)number | string500
horizontalModeHorizontal sizing strategy for the table viewport. - "auto": default, prefer fitting the container and only scroll when content truly overflows - "scroll": preserve explicit column widths and force horizontal scrolling via min-width aggregation - "fit": use fixed table layout and suppress horizontal scrollingDataTableHorizontalMode"auto"
overflowHiddenClip overflow của outer wrapper. Tắt khi cần cho phép shadow/focus ring tràn ra ngoài.booleantrue
useOverlayScrollbarEnable OverlayScrollbars on table viewport. Default: falsebooleanfalse
virtualizedRowsVirtualize body rows for large page sizes. Default: falsebooleanfalse
estimatedRowHeightEstimated row height used by virtualized rendering. Defaults to the active density row height.number
overscanNumber of extra rows rendered above and below the visible range. Default: 8number8
paginationAlignAlignment of the page navigation controls. Default: "right"DataTablePaginationAlign"right"
paginationRangeNumber of page buttons pinned at each end. Defaults to 3 below 14 pages, otherwise 5.number
enableHeaderAutoFitDouble-click leaf headers to auto-fit column width based on visible content. Default: truebooleantrue
labelsNhãn i18n cho density tuỳ chọn.DataTableLabels
borderModeMã nguồn chưa cung cấp mô tả bổ sung.BorderMode

Hướng dẫn sử dụng

Dùng DataTable (with i18n) để trình bày dữ liệu có cấu trúc dễ quét. Cần tiêu đề có nghĩa, thứ tự ổn định và hành vi responsive phù hợp với dữ liệu dày.

Trợ năng

Khi dùng DataTable (with i18n), hãy giữ trạng thái focus dễ nhận biết, cung cấp tên truy cập khi cần và kiểm tra bàn phím cùng trình đọc màn hình trong ngữ cảnh thực tế.