Tables

Table States

A table before its data: skeleton bars while waiting and an empty state with an action, with the header staying put.

  • table
  • skeleton
  • empty
  • state

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/table-009?lang=en

Счета за март
СчётЗаказчикСтатусСумма
Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

# Install and place "table-009" (Table States) from VibeUI

## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/table-009.json

Registry item: https://vibeui.ru/r/table-009.json
Installs to: components/vibeui/table-009.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.

Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.

## 2. What it is
A table before its data: skeleton bars while waiting and an empty state with an action, with the header staying put.

Two pre-data table states: skeleton bars while loading and an explaining screen with a button when there are no rows. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Table009 } from "@/components/vibeui/table-009"

<Table009 state="empty" columns={["Invoice", "Customer", "Status", "Amount"]} />

Read the installed file for the full prop list.

## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.

Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)

## 5. Keep exactly as installed
- the local --vibeui-table-009-* palette — do not swap it for your theme tokens
- the header in both states: it says what will appear and keeps the layout from jumping
- aria-busy on the table while loading
- bars of differing widths: equal ones read as a pattern, not as future text
- the action in the empty state — the screen must explain the next step
- switching the pulse off under prefers-reduced-motion

## 6. You may change
- state, columns and the skeleton row count
- emptyTitle, emptyText and actionLabel
- the accent through the accent prop
- the bar height

## 7. Rules
- A skeleton suits a second or two: for a long wait progress or an explanation is honest.
- An empty state and a no-results state differ: the latter needs a way to clear the filter.
- Keep the skeleton row count near the usual response: ten bars for three rows misleads.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.

## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.

For developers

npx shadcn@latest add https://vibeui.ru/r/table-009.json
https://vibeui.ru/r/table-009.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-table-009-*. Серверный: хуков нет, состояние приходит пропом. При ожидании таблица помечена aria-busy, а ширины полос заданы правилами по номеру колонки, чтобы не городить инлайновые стили. При prefers-reduced-motion пульсация выключается.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Table009Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children"
> & {
  state?: "loading" | "empty"
  caption?: string
  columns?: string[]
  rows?: number
  emptyTitle?: string
  emptyText?: string
  actionLabel?: string
  accent?: string
}

// Идея компонента: два состояния таблицы до данных — ожидание и пустота.
// Шапка остаётся на месте в обоих: она объясняет, что здесь будет, и не даёт
// макету прыгнуть при появлении строк. Полосы-заглушки разной ширины, потому
// что одинаковые читаются как элемент оформления, а не как будущий текст.
const STYLES = `
:where([data-vibeui-block="table-009"]){
--vibeui-table-009-bg:oklch(1 0 0);
--vibeui-table-009-fg:oklch(0.24 0.014 265);
--vibeui-table-009-muted:oklch(0.56 0.014 265);
--vibeui-table-009-border:oklch(0.92 0.006 265);
--vibeui-table-009-head:oklch(0.975 0.003 265);
--vibeui-table-009-bar:oklch(0.93 0.005 265);
--vibeui-table-009-accent:oklch(0.55 0.2 262);
--vibeui-table-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="table-009"]{
width:100%;box-sizing:border-box;overflow-x:auto;
background:var(--vibeui-table-009-bg);
border:1px solid var(--vibeui-table-009-border);border-radius:0.875rem;
font-family:var(--vibeui-table-009-font);color:var(--vibeui-table-009-fg);
}
[data-vibeui-block="table-009"] table{width:100%;border-collapse:collapse;font-size:0.8125rem}
[data-vibeui-block="table-009"] caption{padding:0.75rem 0.875rem;text-align:left;font-size:0.875rem;font-weight:650}
[data-vibeui-block="table-009"] th,
[data-vibeui-block="table-009"] td{
padding:0.5rem 0.875rem;text-align:left;
border-top:1px solid var(--vibeui-table-009-border);
}
[data-vibeui-block="table-009"] thead th{background:var(--vibeui-table-009-head);font-weight:600;white-space:nowrap}
/* Полосы разной ширины: одинаковые читаются как узор, а не как будущий текст. */
[data-vibeui-block="table-009"] [data-part="bar"]{
display:block;height:0.625rem;border-radius:9999px;
background:var(--vibeui-table-009-bar);
animation:vibeui-table-009-pulse 1.4s ease-in-out infinite;
}
[data-vibeui-block="table-009"] tr:nth-child(2n) [data-part="bar"]{animation-delay:.2s}
[data-vibeui-block="table-009"] td:nth-child(1) [data-part="bar"]{width:62%}
[data-vibeui-block="table-009"] td:nth-child(2) [data-part="bar"]{width:84%}
[data-vibeui-block="table-009"] td:nth-child(3) [data-part="bar"]{width:48%}
[data-vibeui-block="table-009"] td:nth-child(n+4) [data-part="bar"]{width:70%}
@keyframes vibeui-table-009-pulse{0%,100%{opacity:1}50%{opacity:.45}}
[data-vibeui-block="table-009"] [data-part="empty"]{
padding:2rem 0.875rem;text-align:center;
}
[data-vibeui-block="table-009"] [data-part="title"]{margin:0 0 0.25rem;font-size:0.875rem;font-weight:650}
[data-vibeui-block="table-009"] [data-part="text"]{
margin:0 auto 0.875rem;max-width:22rem;
font-size:0.8125rem;line-height:1.5;color:var(--vibeui-table-009-muted);
}
[data-vibeui-block="table-009"] button{
appearance:none;cursor:pointer;height:2.125rem;padding:0 0.875rem;
border:0;border-radius:0.5rem;
background:var(--vibeui-table-009-accent);color:oklch(1 0 0);
font:inherit;font-size:0.8125rem;font-weight:650;
}
[data-vibeui-block="table-009"] button:focus-visible{outline:2px solid var(--vibeui-table-009-accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="table-009"] [data-part="bar"]{animation:none;opacity:.7}
[data-vibeui-block="table-009"] *{transition:none!important}
}
`

/**
 * Таблица до данных: ожидание полосами и пустое состояние с действием.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Table009({
  state = "loading",
  caption = "Счета за март",
  columns = ["Счёт", "Заказчик", "Статус", "Сумма"],
  rows = 4,
  emptyTitle = "Счетов пока нет",
  emptyText = "Выставленные счета появятся здесь. Первый можно создать прямо сейчас.",
  actionLabel = "Выставить счёт",
  accent,
  className,
  style,
  ...props
}: Table009Props) {
  const palette = {
    ...(accent ? { "--vibeui-table-009-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-table-009" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="table-009"
        className={className}
        style={palette}
      >
        <table aria-busy={state === "loading" || undefined}>
          <caption>{caption}</caption>
          <thead>
            <tr>
              {columns.map((column) => (
                <th key={column} scope="col">
                  {column}
                </th>
              ))}
            </tr>
          </thead>
          <tbody>
            {state === "loading" ? (
              Array.from({ length: rows }, (_, row) => (
                <tr key={row}>
                  {columns.map((column) => (
                    <td key={column}>
                      <span data-part="bar" />
                    </td>
                  ))}
                </tr>
              ))
            ) : (
              <tr>
                <td colSpan={columns.length} data-part="empty">
                  <p data-part="title">{emptyTitle}</p>
                  <p data-part="text">{emptyText}</p>
                  <button type="button">{actionLabel}</button>
                </td>
              </tr>
            )}
          </tbody>
        </table>
      </div>
    </>
  )
}