Đi tới nội dung tài liệu
Underverse UI Logo
ComponentPhản hồi & Overlay

Sheet

Sheet thuộc nhóm Phản hồi & Overlay. 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 Sheet từ entry của gói Free. 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 { Sheet } from '@underverse-ui/underverse';

Ví dụ tương tác

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

Sheet

Component
Thuộc tínhMô tảKiểuMặc định
openBắt buộcTrạng thái mở/đóng.booleanBắt buộc
onOpenChangeBắt buộcCallback thay đổi trạng thái mở.(open: boolean) => voidBắt buộc
sideCạnh xuất hiện."left" | "right" | "top" | "bottom""right"
sizeKích thước sheet."sm" | "md" | "lg" | "xl" | "full""md"
variantBiến thể hiển thị."default" | "overlay" | "push""default"
childrenBắt buộcNội dung thân sheet.React.ReactNodeBắt buộc
titleTiêu đề phần header.React.ReactNode—
descriptionMô tả ở header.React.ReactNode—
classNameClass tuỳ chỉnh cho panel.string—
showCloseHiển thị nút đóng ở header.booleantrue
closeOnOutsideClickClick overlay để đóng.booleantrue
closeOnEscapeNhấn Escape để đóng.booleantrue
headerHeader tuỳ chỉnh (ghi đè).React.ReactNode—
footerFooter tuỳ chỉnh.React.ReactNode—
overlayOpacityTuỳ chỉnh opacity overlay từ 0 đến 1.number—
resizableAllow the user to resize the sheet from the edge closest to the page content.booleanfalse
minSizeMinimum sheet width/height in pixels while resizing.number280
maxSizeMaximum sheet width/height in pixels while resizing. Defaults to 90% of the viewport.number—
onResizeCalled with each width/height update while the user resizes the sheet.(size: number) => void—
getPortalContainerResolve the document element that should receive the sheet portal.() => HTMLElement | null—

BottomSheet

Component
Thuộc tínhMô tảKiểuMặc định
snapPointsMã nguồn chưa cung cấp mô tả bổ sung.string[]["25%", "50%", "90%"]
defaultSnapMã nguồn chưa cung cấp mô tả bổ sung.number1
childrenBắt buộcNội dung thân sheet.React.ReactNodeBắt buộc
variantBiến thể hiển thị."default" | "overlay" | "push"—
sizeKích thước sheet."sm" | "md" | "lg" | "xl" | "full"—
classNameClass tuỳ chỉnh cho panel.string—
titleTiêu đề phần header.React.ReactNode—
descriptionMô tả ở header.React.ReactNode—
footerFooter tuỳ chỉnh.React.ReactNode—
getPortalContainerResolve the document element that should receive the sheet portal.() => HTMLElement | null—
openBắt buộcTrạng thái mở/đóng.booleanBắt buộc
headerHeader tuỳ chỉnh (ghi đè).React.ReactNode—
onOpenChangeBắt buộcCallback thay đổi trạng thái mở.(open: boolean) => voidBắt buộc
showCloseHiển thị nút đóng ở header.boolean—
closeOnOutsideClickClick overlay để đóng.boolean—
closeOnEscapeNhấn Escape để đóng.boolean—
overlayOpacityTuỳ chỉnh opacity overlay từ 0 đến 1.number—
resizableAllow the user to resize the sheet from the edge closest to the page content.boolean—
minSizeMinimum sheet width/height in pixels while resizing.number—
maxSizeMaximum sheet width/height in pixels while resizing. Defaults to 90% of the viewport.number—
onResizeCalled with each width/height update while the user resizes the sheet.(size: number) => void—

Drawer

Component
Thuộc tínhMô tảKiểuMặc định
placementMã nguồn chưa cung cấp mô tả bổ sung."left" | "right""right"
childrenBắt buộcNội dung thân sheet.React.ReactNodeBắt buộc
variantBiến thể hiển thị."default" | "overlay" | "push"—
sizeKích thước sheet."sm" | "md" | "lg" | "xl" | "full"—
classNameClass tuỳ chỉnh cho panel.string—
titleTiêu đề phần header.React.ReactNode—
descriptionMô tả ở header.React.ReactNode—
footerFooter tuỳ chỉnh.React.ReactNode—
getPortalContainerResolve the document element that should receive the sheet portal.() => HTMLElement | null—
openBắt buộcTrạng thái mở/đóng.booleanBắt buộc
headerHeader tuỳ chỉnh (ghi đè).React.ReactNode—
onOpenChangeBắt buộcCallback thay đổi trạng thái mở.(open: boolean) => voidBắt buộc
showCloseHiển thị nút đóng ở header.boolean—
closeOnOutsideClickClick overlay để đóng.boolean—
closeOnEscapeNhấn Escape để đóng.boolean—
overlayOpacityTuỳ chỉnh opacity overlay từ 0 đến 1.number—
resizableAllow the user to resize the sheet from the edge closest to the page content.boolean—
minSizeMinimum sheet width/height in pixels while resizing.number—
maxSizeMaximum sheet width/height in pixels while resizing. Defaults to 90% of the viewport.number—
onResizeCalled with each width/height update while the user resizes the sheet.(size: number) => void—

SidebarSheet

Component
Thuộc tínhMô tảKiểuMặc định
navigationMã nguồn chưa cung cấp mô tả bổ sung.React.ReactNode—
childrenBắt buộcNội dung thân sheet.React.ReactNodeBắt buộc
sizeKích thước sheet."sm" | "md" | "lg" | "xl" | "full"—
classNameClass tuỳ chỉnh cho panel.string—
titleTiêu đề phần header.React.ReactNode—
descriptionMô tả ở header.React.ReactNode—
footerFooter tuỳ chỉnh.React.ReactNode—
getPortalContainerResolve the document element that should receive the sheet portal.() => HTMLElement | null—
openBắt buộcTrạng thái mở/đóng.booleanBắt buộc
headerHeader tuỳ chỉnh (ghi đè).React.ReactNode—
onOpenChangeBắt buộcCallback thay đổi trạng thái mở.(open: boolean) => voidBắt buộc
showCloseHiển thị nút đóng ở header.boolean—
closeOnOutsideClickClick overlay để đóng.boolean—
closeOnEscapeNhấn Escape để đóng.boolean—
overlayOpacityTuỳ chỉnh opacity overlay từ 0 đến 1.number—
resizableAllow the user to resize the sheet from the edge closest to the page content.boolean—
minSizeMinimum sheet width/height in pixels while resizing.number—
maxSizeMaximum sheet width/height in pixels while resizing. Defaults to 90% of the viewport.number—
onResizeCalled with each width/height update while the user resizes the sheet.(size: number) => void—

SlideOver

Component
Thuộc tínhMô tảKiểuMặc định
childrenBắt buộcNội dung thân sheet.React.ReactNodeBắt buộc
sizeKích thước sheet."sm" | "md" | "lg" | "xl" | "full"—
classNameClass tuỳ chỉnh cho panel.string—
titleTiêu đề phần header.React.ReactNode—
descriptionMô tả ở header.React.ReactNode—
footerFooter tuỳ chỉnh.React.ReactNode—
getPortalContainerResolve the document element that should receive the sheet portal.() => HTMLElement | null—
openBắt buộcTrạng thái mở/đóng.booleanBắt buộc
headerHeader tuỳ chỉnh (ghi đè).React.ReactNode—
onOpenChangeBắt buộcCallback thay đổi trạng thái mở.(open: boolean) => voidBắt buộc
showCloseHiển thị nút đóng ở header.boolean—
closeOnOutsideClickClick overlay để đóng.boolean—
closeOnEscapeNhấn Escape để đóng.boolean—
overlayOpacityTuỳ chỉnh opacity overlay từ 0 đến 1.number—
resizableAllow the user to resize the sheet from the edge closest to the page content.boolean—
minSizeMinimum sheet width/height in pixels while resizing.number—
maxSizeMaximum sheet width/height in pixels while resizing. Defaults to 90% of the viewport.number—
onResizeCalled with each width/height update while the user resizes the sheet.(size: number) => void—

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

Dùng Sheet để thông báo thay đổi trạng thái đúng lúc mà không làm gián đoạn tác vụ. Nội dung nên ngắn và focus phải quay về vị trí hợp lý.

Trợ năng

Khi dùng Sheet, 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ế.