Examples
Dynamic Columns Example
An example of Shadcn Table which shows how to fetch remote data and generate columns dynamically
This example shows how to generate column definitions dynamically from remote data after first render using TanStack Query. You may need to manage the columnOrder state manually if doing this.
Try it
- Click
Show/Hide columns. The six columns listed were built from the fetched data. - Click
Last Nameand chooseSort ascending. The server sorts the rows. - Click page
2. The server sends rows 11 to 20.
Related guides
Remote Data Fetching Example
An example of Shadcn Table which shows how to fetch remote data and filter and paginate on a remote server
Lazy Detail Panel Example
A Shadcn Table example showing how to use expandable rows to show additional information about a row and load the data for the detail panel only after the user expands the row.