Next.js ReusablesHome

Example Tables

We've put together a collection of Next.js Reusable Table Component examples to help you get started.

Basic Table

This is a simple example using default styles with columns, data, and no custom styling or action dropdowns.

NameEmailRoleEdit, Delete
John Doejohn@example.comAdmin

Custom Styles

Here, you can pass custom class names using the customClassNames prop to override the default styles. Also disable the default dark mode style applied by setting enableDarkMode to false.

NameEmailRole
John Doejohn@example.comAdmin
Jane Doejane@example.comUser

Table with Pagination

If you want to use a pagination component, you can pass it as the paginationComponent prop.

NameEmailRole
John Doejohn@example.comAdmin
Jane Doejane@example.comUser
Page 1

Custom Rows and Actions

This is an example where the table displays custom rows, with the last column having a custom action button. You can use the renderRow function to customize how each row is rendered and place a custom action button for the last item.

IDNameEmailRoleActions
1John Doejohn@example.comAdmin
2Jane Doejane@example.comUser
3Bob Smithbob@example.comEditor

URL, Date/Time, Arrays

This is an example where I’m using the default TableComponent and passing a data object with a URL, date, and an array of strings. The TableComponent will automatically handle rendering for these data types based on the logic already present in the component.

IDWebsiteCreated AtRoles
1https://example.comSep 20, 2023, 02:12 PM
AdminEditorViewer
2https://another-site.comAug 15, 2023, 10:05 AM
UserModerator
3https://yetanother.comJul 1, 2023, 06:20 PM
GuestContributor

Loading State

You can set the loading prop to true to show a shimmer in the table.
























































Default Row Clicking

This example shows how to use the rowOnClick prop in your TableComponent. When you click on a row, it will trigger a function that can display more details about the clicked item

NameEmailRole
John Doejohn@example.comAdmin
Jane Doejane@example.comUser
Bob Smithbob@example.comEditor