| name | sourcebase-knowledge-component-discovery |
| description | null |
Component Discovery
Category: sourcebase-knowledge · Status: 🟢 Active
When to use
Trước khi tạo component mới, để tìm component sẵn có có thể reuse.
Steps
- Search theo từ khóa chức năng (Button, Modal, Table) trong
components/, ui/.
- Tìm theo props/role tương tự nếu tên khác (vd:
Dialog thay vì Modal).
- Mở component ứng viên, đọc Props interface và variants có sẵn.
- Xem usage thực tế bằng cách grep nơi import để hiểu cách dùng đúng.
- Quyết định: reuse trực tiếp, mở rộng props, hay tạo mới nếu thật sự khác.
Template
rg -t tsx -l "export (function|const) \w*Button" src
rg "import .*Modal.* from" src
rg "interface \w+Props" src/components -A8
Example
Good: Tìm thấy <Dialog> có sẵn variant confirm, reuse thay vì viết Modal mới.
Avoid: Tạo MyButton mới trong khi ui/Button đã hỗ trợ đủ variant cần dùng.
Checklist