UndieGravity LogoUndiegravity

Building a React Admin Dashboard: Layout, Data, and Tables

How to build or customize a React admin dashboard: a responsive sidebar layout, data fetching, fast tables, charts, auth, and accessibility basics.

By UndieGravity, , 2 min read

A dashboard is mostly the same five parts in every product: a layout with navigation, data that loads and refreshes, tables, charts, and forms. Get those right once and every new page is quick to add. This guide covers decisions for each part, whether you start from scratch or from a template.

Layout: sidebar plus header

  • A fixed sidebar on desktop that collapses to an icon rail, and a slide-in drawer on phones.
  • A sticky header for search, notifications, and the account menu.
  • A content area with consistent padding and a page title on every screen.
  • Mark the current page in the navigation with aria-current="page", not only with color.

Data fetching

Dashboards show data that changes, so caching and refetching matter more than on a marketing site. A data library such as TanStack Query gives you caching, background refresh, retries, and loading states with very little code.

const { data, isPending, error } = useQuery({
  queryKey: ["orders", page],
  queryFn: () => fetch(`/api/orders?page=${page}`).then((r) => r.json()),
});

In a Next.js dashboard you can often skip this: load data in Server Components and refresh after mutations with Server Actions.

Tables that stay fast

  • Paginate on the server; do not send 10,000 rows to the browser.
  • For long scrolling lists, use virtualization so only visible rows are rendered.
  • Keep sort and filter state in the URL (?status=paid&page=2) so views can be shared and survive a refresh.
  • On phones, turn wide tables into stacked cards instead of horizontal scrolling.

Charts

Choose the chart for the question: a line for change over time, bars for comparing categories, a single big number for a headline metric. Load chart libraries lazily, since they are often the heaviest part of a dashboard bundle.

Loading and empty states

Use skeletons shaped like the real content instead of spinners, so the layout does not jump. Every list needs an empty state that says what to do next, such as "No orders yet".

Auth and permissions

Hide pages and buttons the user cannot use, but always check permissions on the server too. Hiding a button is a convenience, not a security control.

Accessibility basics

  • Every icon-only button needs an aria-label.
  • Menus and dialogs close with Escape and keep focus inside while open.
  • Status is shown with text or an icon, never color alone.

Starting from a template saves the layout work. Our React and Next.js dashboard templates are in the catalog; use this list to review whichever one you pick.

Keep reading