Command
Xem trước Command, sao chép snippet setup, xem ví dụ và kiểm tra export API cho @tuturuuu/ui/command.
Xem trước
Preview gọn dùng cùng primitive dùng chung được export bởi package.
Cài đặt
Cài package UI dùng chung, import global styles một lần, sau đó import thành phần từ subpath công khai.
bun add @tuturuuu/uiimport '@tuturuuu/ui/globals.css';import { Command, CommandInput, CommandItem, CommandList } from '@tuturuuu/ui/command';Cách dùng
Sao chép snippet mặc định và điều chỉnh nhãn, trạng thái, handler theo bề mặt sản phẩm.
import { Command, CommandInput, CommandItem, CommandList } from '@tuturuuu/ui/command';
<Command>
<CommandInput placeholder="Search..." />
<CommandList><CommandItem>Open dashboard</CommandItem></CommandList>
</Command>Ví dụ
Ví dụ dùng lại snippet registry để tài liệu luôn khớp với catalog thành phần.
Mặc định
Một cách dùng tối thiểu dựa trên snippet registry hiện tại.
import { Command, CommandInput, CommandItem, CommandList } from '@tuturuuu/ui/command';
<Command>
<CommandInput placeholder="Search..." />
<CommandList><CommandItem>Open dashboard</CommandItem></CommandList>
</Command>Kết hợp
Dùng các export nhóm khi primitive có slot, trigger, vùng nội dung hoặc provider.
import {
Command,
CommandInput,
CommandItem,
CommandList,
} from '@tuturuuu/ui/command';Import package
Import qua đường dẫn package công khai để app workspace và app ngoài dùng chung một contract.
// Public package import
import { Command } from '@tuturuuu/ui/command';
// Workspace apps should keep importing through the package boundary.Tham chiếu API
Các export công khai hiện có từ entry thành phần này.
| Tên | Loại | Mô tả |
|---|---|---|
Command | Thành phần | Command được export từ @tuturuuu/ui/command. Xem source để biết props và chi tiết kết hợp riêng của thành phần. |
CommandInput | Thành phần | CommandInput được export từ @tuturuuu/ui/command. Xem source để biết props và chi tiết kết hợp riêng của thành phần. |
CommandItem | Thành phần | CommandItem được export từ @tuturuuu/ui/command. Xem source để biết props và chi tiết kết hợp riêng của thành phần. |
CommandList | Thành phần | CommandList được export từ @tuturuuu/ui/command. Xem source để biết props và chi tiết kết hợp riêng của thành phần. |
Tùy biến
Các prop, trạng thái và điểm kết hợp cần xem trước khi dùng thành phần.