Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Placeholder bars

Stack a few bars to sketch the shape of the content underneath, so the layout holds while it loads.

Width and height
width sizes the bar to the content it stands in for: a wide heading, a full body line, a short caption.
Show code
<app-skeleton width="80%" height="16px"></app-skeleton>
<app-skeleton width="100%" height="12px"></app-skeleton>
<app-skeleton width="60%" height="12px"></app-skeleton>

Table rows

Fill a table body with one placeholder per cell, using the same column count as the table it stands in for.

A loading ledger
The row and column count match the table this stands in for, so the layout is stable before and after load.
Show code
<table class="table table-ledger">
  <tbody>
    <tr>
      <td><app-skeleton width="70%" height="12px"></app-skeleton></td>
      <td><app-skeleton width="50%" height="12px"></app-skeleton></td>
      <td><app-skeleton width="50%" height="12px"></app-skeleton></td>
      <td><app-skeleton width="50%" height="12px"></app-skeleton></td>
    </tr>
  </tbody>
</table>

Radius and classes

Keep the corner radius close to the shape it stands in for, so a round avatar reads as round.

Corner radius
radius=0
radius=6
radius=12
radius="50%"
Show code
<app-skeleton width="40px" height="40px" radius="0"></app-skeleton>
<app-skeleton width="40px" height="40px" radius="6"></app-skeleton>
<app-skeleton width="40px" height="40px" radius="12"></app-skeleton>
<app-skeleton width="40px" height="40px" radius="50%"></app-skeleton>
Extra classes
class is appended to the base skeleton class, so the page can target the bar.
Show code
<app-skeleton class="kpi-skel"></app-skeleton>

Every option

Every value of every prop, one cell each.

width

width="100%" (default)
width="50%"
width="200px"
width="2rem"

height

height="8"
height="14" (default)
height="24"
height="2rem"

radius

radius="0"
radius="6" (default)
radius="12"
radius="50%"

class and style passthrough

class="kpi-skel", appended to the base skeleton class
style="margin-top:8px", merged with the computed width, height and radius
style="width:min(300px,100%)", an authored style wins over the width attribute

table skeleton rows: rows × cols

rows=4 cols=5 (default), React: AppSkeletonRows rows={4} cols={5}
rows=2 cols=3, React: AppSkeletonRows rows={2} cols={3}
rows=1 cols=1, React: AppSkeletonRows rows={1} cols={1}
rows=0: no rows, React: AppSkeletonRows rows={0} cols={5}
cols=0: rows with no cells, React: AppSkeletonRows rows={2} cols={0}

Guidance

What to do, and what to avoid.

Use it when

  • A component is loading its first data, the classic loading && data.length === 0 case.
  • You want the page layout to hold its shape so content doesn't jump on arrival.
  • A table or list is fetching its first page and you want per-row placeholders.

Reach for something else when

  • The data loaded but the result set is empty. → AppEmptyState
  • A table query returned no rows. → AppEmptyState variant="table"
  • A short, indeterminate action is running (a button submit). → AppButton loading
  • The whole page is blocked on a single request. → a page-level spinner

Echo the layout that is loading

Do

A few bars that echo the real layout, a heading over two body lines. The eye reads it as "content, loading".

Avoid

One giant block tells the user nothing about what's coming and reflows hard when the real, smaller content lands.

Match table columns while loading

Do

Table skeletons use the same column count as the loaded table, so headers and widths never shift.

Avoid

Two loose bars where a table is loading leaves the columns to snap into place on arrival.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

React, generated from the controls
<AppSkeleton />
Razor, the same props
<app-skeleton />

3 props. The 3 most used come first.

Used on most screens 3 props

PropTypeDefaultDescription
widthdefault 100% string 100% Width of the bar: a number is px, a string is any CSS length.
heightdefault 14 string 14 Height of the bar: a number is px, a string is any CSS length.
radiusdefault 6 string 6 Corner radius of the bar: a number is px, a string is any CSS length.

Screen reader

2 notes
  • The bar is a span with aria-hidden set to true, so screen readers skip it.
  • The bar has no role and takes no focus.

Do and avoid

2 pairs

Echo the layout that is loading

Do

A few bars that echo the real layout, a heading over two body lines. The eye reads it as "content, loading".

Avoid

One giant block tells the user nothing about what's coming and reflows hard when the real, smaller content lands.

Match table columns while loading

Do

Table skeletons use the same column count as the loaded table, so headers and widths never shift.

Avoid

Two loose bars where a table is loading leaves the columns to snap into place on arrival.