gridcn1.2.2

Loading states

The three states of the loading prop (skeleton viewport, slim indeterminate bar, and the ordinary empty state).

One prop, loading, plus whether rows exist, covers all three states. The demo's two switches (loading, rows present) reach each one live.

Toggle both switches: Loading with no rows shows a viewport-filling skeleton, Loading with rows present shows a slim bar under the header instead, and rows-off + loading-off is the ordinary empty state.

Name
Email
Role
Score
Silent Tiger
user0@example.com
Viewer
4
Quick Lion
user1@example.com
Viewer
89
Swift Wolf
user2@example.com
Manager
80
Eager Lion
user3@example.com
User
51
Eager Tiger
user4@example.com
Viewer
83
Silent Wolf
user5@example.com
User
15
Swift Lion
user6@example.com
Viewer
62
Eager Lion
user7@example.com
Manager
42
Eager Eagle
user8@example.com
Editor
35
Bold Tiger
user9@example.com
Editor
52
pnpm dlx shadcn@latest add @gridcn/data-grid-loading-demo
RowsloadingWhat renders
nonetrueA viewport-filling skeleton: pulsing rows in place of the empty grid.
presenttrueA slim indeterminate bar under the header while the existing rows stay on screen.
nonefalseThe ordinary empty state (the labels.grid.emptyState string).

Where the data comes from

loading only controls rendering. Pass it from whatever owns your request state (isPending from React Query, isLoading from SWR, your own flag). The data-fetching patterns it pairs with are on the Data & Integrations pages.

Customizing the look

loadingState replaces the skeleton (zero rows) or the indeterminate bar (rows present) while loading is true. It accepts a plain node or a function receiving { reason }: "no-data" or "rows-present". The replacement renders directly under the header at full width, and the node owns its own accessibility.

emptyState takes the same two forms. Its reason is "no-data" when the data array is empty and "filtered" when rows exist but none are in view.

  • Lazy loading: skeleton rows for per-range fetching instead of the grid-level loading prop
  • Styling: theming the skeleton via shadcn tokens

On this page