Table Component: Getting Started
Waldur Homeport uses a unified table structure to display lists and grid data.
- State management and API integration are handled via the
useTableReact hook. - Table rendering is done using the
Tablecomponent.
Core Guidelines
To maintain UI/UX consistency and code quality across the application, always follow these core principles:
- Imports from subpaths: Do not use the barrel
@/tableimport for core table components. Always import them from their specific subpaths.
1 2 3 4 | |
Note: Filter components (like StringFilter, SelectFilter) are barrel-exported and can be imported from @/table, but manual filter creation is deprecated in favor of generated filters.
- Null/Empty Values: Never display raw null/undefined/empty string values or fallbacks like
|| 'N/A'. Always wrap cell outputs with therenderFieldOrDashutility from@/table/utils.
1 2 3 | |
-
Memoize Filters: Always wrap filter objects in
useMemoto prevent infinite re-renders when passing them touseTable. -
Generated Table Filters: Never write manual filter components. Always define and generate filters based on the OpenAPI schema.
-
3-Dots Row Actions: Use the standard
ActionsDropdown+ActionItempattern for all row actions. Standalone inline buttons are discouraged.
Basic Table Example
Here is a standard implementation of a resource list showing simple text fields:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Column definitions require two mandatory fields: title (column header label) and render (cell content rendering component/function).