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

Grid

Grid 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 Grid 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 { Grid } from '@underverse-ui/underverse';

Ví dụ tương tác

Dùng thử Grid 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.

Grid

Component
Thuộc tínhMô tảKiểuMặc định
columnsNumber of columns or full template string. Default: 12 (1fr each).number | string
rowsNumber of rows or full template string.number | string
gapOverall gap (shorthand).number | string
gapXHorizontal gap.number | string
gapYVertical gap.number | string
autoRowsAuto rows value (e.g. 'minmax(100px, auto)').string
autoColumnsAuto columns value (e.g. 'minmax(100px, 1fr)').string
autoFlowGrid auto-flow direction and density.GridAutoFlow
minColumnWidthUse auto-fit with a min width to create responsive columns.number | string
areasCSS grid-template-areas. Provide full string or joined lines.string | string[]
alignItemsItem alignment within cells.React.CSSProperties["alignItems"]
justifyItemsCăn phần tử theo trục ngang trong ô lưới.React.CSSProperties["justifyItems"]
alignContentGrid content alignment.React.CSSProperties["alignContent"]
justifyContentCăn toàn bộ nội dung lưới theo trục ngang.React.CSSProperties["justifyContent"]
responsiveResponsive overrides by breakpoint (Tailwind defaults).Partial<Record<Breakpoint, ResponsiveConfig>>
variantVisual variant style.GridVariant
animatedEnable smooth animations for grid layout changes.boolean
outlinedApply Card-like outline (rounded + border + bg-card).boolean

GridItem

Component
Thuộc tínhMô tảKiểuMặc định
colSpanColumn span (e.g., 3 => span 3).number | string
rowSpanRow span.number | string
colStartColumn start line.number | string
colEndColumn end line.number | string
rowStartRow start line.number | string
rowEndRow end line.number | string
areaNamed area (must match container areas).string
alignSelfItem alignment override.React.CSSProperties["alignSelf"]
justifySelfMã nguồn chưa cung cấp mô tả bổ sung.React.CSSProperties["justifySelf"]
orderOrder of the item in the grid.number
hoverableAdd hover effect.booleanfalse
animationDelayAdd animation delay (in ms).number

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

Dùng Grid để 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 Grid, 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ế.