You can build and fully evaluate an Angular table design with no data by creating a typed empty array, rendering the table shell through *ngFor over column definitions, and forcing the empty and loading states so layout, alignment, and responsiveness are visible immediately. The one condition that matters is that you design against the states you'll ship—empty, loading, error, populated—rather than a hardcoded row of fake strings. This walkthrough uses Angular 17+ standalone components and the built-in @for block, and every step works the same with *ngFor if you're on an older version.
Designing a table before data exists is a normal, healthy order of work. Real records hide design problems: a long name masks a column that's too narrow, a populated grid hides what an empty screen looks like to a new user. Working without data forces you to answer harder questions first—what does this table look like when it's empty, when it's loading, when it breaks? Those states are the ones users actually complain about, and they're the ones you can perfect before a single API call exists.
Why Building the Shell First Actually Works
A table is three separable layers: structure (the grid of rows and columns), presentation (widths, alignment, borders, typography), and data binding (what fills the cells). Only the third layer needs real records. If you collapse the first two into "whatever the data produces," you lose control—columns jump width as values arrive, headers misalign with numeric cells, and the empty state gets bolted on as an afterthought.
The shell-first approach inverts that. You declare columns as data, render header and body rows from that declaration, and bind cells through a single mapping function. With zero records, the header still renders, the body renders nothing, and the empty state appears. You can then push mock rows in temporarily to check alignment, remove them, and the design holds.
There's a practical side effect too: a column-definition-driven table is easier to make responsive and accessible, because header and cell behavior derive from one source instead of being hand-written twice. When you later connect a backend, you change one signal and the design is already proven.
Prerequisites and Setup
Before the steps, confirm your baseline:
Node.js installed and a working Angular CLI (ng version should report your Angular version). Angular 17 or newer if you want the built-in @for and @if control flow; on 16 or earlier, substitute *ngFor and *ngIf and import CommonModule. A component you can freely modify—either a fresh ng generate component or an existing feature component. No data source required. Do not stub an HTTP service for this; it adds noise.
One decision up front: will your table use native semantics or a CSS grid of divs? For tabular data with headers, native wins on accessibility and is simpler to style predictably. Use grid-of-divs only for layouts that aren't really tabular. The steps below assume native .
Step 1: Define Columns as Data, Not Markup
The core move is treating the column list as the single source of truth. Create a small interface and an array, both typed, with an empty rows array:
Why start here rather than with HTML? Because the header row becomes a loop over columns, which means header text, alignment, and width are declared once. When you later add sorting or column toggles, you extend this array instead of editing markup in two places. The empty rows array is the honest representation of "no data yet"—not a placeholder string like "-" jammed into a cell.
Check: Your editor should accept the typed array without any. If TypeScript complains that key isn't assignable, your row interface and column keys have drifted—fix that now, because it's the same drift that later produces blank cells.
Step 2: Render Header and Body From That Definition
With the column array in place, the template writes itself. Use the same loop for and , and bind each cell through the row object:
Two details carry more weight than they look. First, [style.text-align] in the body must mirror the header—otherwise numeric columns read ragged the moment real values arrive, and you won't notice with zero rows. Second, the track expression on the inner loop: col.key is stable across renders, so Angular doesn't recreate cells unnecessarily. On Angular 16 or earlier, the equivalent is *ngFor="let col of columns; trackBy: trackByKey" with a small trackByKey function returning the key.
Notice what's absent: no *ngIf="rows.length" wrapping the table. If you hide the entire table when empty, you never see the header design at all—which defeats the purpose of this exercise. Keep the header visible in the empty state; it tells users what the table will contain.
Check: At this point the page shows a header row and nothing beneath it. That's correct and intentional. If you see a stray blank row, something is looping over an array with one empty object.
Step 3: Style the Skeleton Before Any Data Arrives
This is where most of the design work happens, and zero rows is the ideal time to do it. Style the table against its own structure:
Two choices deserve explanation. border-collapse: collapse plus border-bottom only gives a clean rule between rows without doubling borders—verify it visually, because with zero rows you're checking the header's own border. white-space: nowrap looks harmless on an empty table and turns into a horizontal-overflow problem once a long email appears; test it by temporarily adding one wide mock row, then remove it. Sticky headers are worth setting now, because position: sticky on interacts with overflow on ancestors and behaves differently once a scroll container exists—get that relationship right while the table is short.
Don't add zebra striping you can't see. If you want alternating rows, write the selector (tbody tr:nth-child(even)) now but accept that its appearance is unverified until you insert a couple of mock rows. That's a known, acceptable gap—note it rather than pretending the design is fully validated.
Check: Resize the browser from phone width to desktop. The header should stay aligned, text shouldn't collide, and you should see a horizontal scrollbar appear rather than cells wrapping into unreadable stacks. If columns squeeze, add overflow-x: auto on a wrapper element around the table and confirm the scrollbar sits on the wrapper, not the page.
Step 4: Design the Empty State as a First-Class Screen
The empty state is the actual product in a no-data design. Give it its own row inside the table body so it inherits the table's width and centering, and make the message explain what belongs here and what to do next:
The [attr.colspan]="columns.length" is non-negotiable: it ties the empty cell to the column count, so adding a column never breaks the empty layout. The distinction between "no data yet" ("No users yet") and "no matches for your filter" ("No users match 'lee'") is worth building now as separate copy, because the two states have different remedies and users act differently on each. A bare "No data" communicates nothing and invites support tickets.
Structurally, keeping the empty state inside a
means it centers under the header, aligns with the column grid, and prints or exports consistently with the populated view. An absolutely-positioned overlay div is easier today and misaligned tomorrow.
Check: Temporarily change columns.length expectations by adding a fifth column; the empty message should still span the full width with no orphaned border. If the message sits in the first column only, your colspan binding isn't evaluating—check for a missing attr. prefix.
Step 5: Fake the Loading and Error States
Zero data has two siblings you should design in the same sitting: loading and error. Both can be forced without any backend. Loading is a boolean signal you toggle; error is an object you set to a non-null value. Render them ahead of the empty check so their priority is explicit:
For the loading state, a skeleton of a few gray bars sized like real rows beats a spinner, because it reserves vertical space and prevents the layout jump when data lands. Size the skeleton bars to your actual row height—a common failure is a skeleton shorter than real rows, causing a jarring shift. You can verify the jump by toggling loading in devtools or a temporary "Simulate loading" button.
Order matters: if you check empty before loading, a user refetching sees "No users yet" flash for a frame, which reads as data loss. Loading first, error second, empty third mirrors how users interpret the screen.
Step 6: Verify With Deliberately Hostile Mock Rows
Before calling the design done, insert a small set of mock rows that stress the layout, inspect alignment, then remove them. The point isn't realistic data—it's worst-case strings:
Now check four things against the hostile row: numbers right-align in the ID column (and the header does too); the long email doesn't force the whole table past the container or truncate silently without a title attribute; CJK characters don't misalign the role column; and row height stays consistent enough that scanning isn't interrupted. This is where you decide whether long cells get text-overflow: ellipsis with a title tooltip, or wrap. Ellipsis without a way to see the full value is a trap—users can't copy what they can't see.
Check and stop condition: Remove the mock rows and confirm the empty state returns cleanly with no residual layout. If, at any point, fixing alignment requires restructuring your template around a specific data value (rather than around columns), stop and reconsider the column definition—you're likely hardcoding where you should be declaring.
A Complete Reference Component
Pulling the pieces together, the component stays small because complexity lives in the column definition, not the template:
The template is the sequence from Steps 2, 4, and 5: header loop, then loading/error/empty priority in the body, then the row loop. Nothing in the component references a service, an HTTP client, or a resolver. That's the deliverable: a component whose design is complete and provable while its data contract is still just a TypeScript interface.
To hand this to a teammate later, the only integration work is replacing readonly rows: UserRow[] = [] with a signal or observable fed from the API and mapping the response to UserRow. The design—alignment, empty state, error recovery, responsive behavior—carries over unchanged, because none of it was ever coupled to real values.
Pitfalls That Show Up Only Later
A few problems hide behind empty tables and surface in production, so it's worth knowing them now. Column widths set only in the header ( width) often collapse once table-layout: fixed isn't combined with a width: 100% table—if you set explicit widths, decide whether you want fixed layout and test it. trackBy/track on an index instead of a stable key causes full-row re-renders on refresh, which is invisible at zero rows and obvious with a few hundred. And an empty state inside a scroll container can scroll off-screen if the container has a fixed height—check whether your empty message stays visible at small viewport heights.
Numeric columns are the most common design regression. Right-align them at the header and body from day one, and use font-variant-numeric: tabular-nums on the cells, because proportional digits make a column of numbers look ragged for reasons users can't articulate. You can confirm the alignment works with the mock rows from Step 6.
None of this requires data. What it requires is treating the empty, loading, and error screens as real screens—and a table skeleton is the easiest place to do that, because the header is already the whole spine of the design.
What the Column-Definition Approach Buys You
Building the table around a typed column array rather than hand-written header cells changes what's easy later. Adding a column becomes a one-line data change; column visibility toggles become filters over that array; sorting and export derive from the same keys. It also makes the design reviewable: a reviewer can read the column list and the empty-state copy without running anything.
The trade-off is honest: it's more setup than pasting a template snippet, and for a genuinely one-off, five-column, never-changing table the abstraction may cost more than it saves. My recommendation is to use the column array whenever the table will gain features (sorting, toggles, exports) or needs an empty state worth designing—which is most administrative tables in Angular apps. For a static reference grid, plain markup is fine, as long as you still force the empty and loading states before shipping.
FAQ
Can I use Angular Material's table without data? Yes. MatTableDataSource accepts an empty array, and MatTable renders the header from a displayedColumns string array with no rows. The design principles here still apply—write the mat-table empty-state row manually, since Material doesn't ship a default empty template, and verify that matColumnDef names line up with displayedColumns before data exists, because that mismatch is the most common cause of an invisible column.
Does this work with server-side pagination or virtual scrolling? The shell and states are identical; you add a page-length and page-index signal and feed rows from the paged response. Keep the loading state visible during transitions, and make sure the empty state distinguishes "no records at all" from "no records on page 4" so users know to page back rather than assume deletion.
How do I make the table responsive without data? Put the table in a wrapper with overflow-x: auto and give the wrapper a min-width via the column definitions. Resize to phone width and confirm the header aligns and the scrollbar belongs to the wrapper. Card-stacking on mobile is a separate design; decide it before you populate the table, because the column definitions drive both layouts.