Spreadsheet

Spreadsheet is a dense grid of cells that people read, compare and work through one cell at a time.

Client name
Customers
Country
Market
0Tech Nova23
Brazil
No issues
1Eco Solutions37
Japan
No issues
2Pinnacle Tech8
India
2 issues
tsx
import { RiFileLine, RiHashtag, RiPriceTag3Line, RiShieldKeyholeLine } from '@remixicon/react';
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';
import { Tag } from '@/components/ui/wideset/tag/Tag';

<Spreadsheet aria-label="Clients" className="w-[34rem] max-w-full">
  <Spreadsheet.Head>
    <Spreadsheet.Row>
      <Spreadsheet.ColumnHeader aria-label="Row" className="w-[2.8125rem]" />
      <Spreadsheet.ColumnHeader>
        <Spreadsheet.ColumnHeaderIcon icon={RiFileLine} />
        Client name
      </Spreadsheet.ColumnHeader>
      <Spreadsheet.ColumnHeader className="w-[7rem]">
        <Spreadsheet.ColumnHeaderIcon icon={RiHashtag} />
        Customers
      </Spreadsheet.ColumnHeader>
      <Spreadsheet.ColumnHeader className="w-[7.5rem]">
        <Spreadsheet.ColumnHeaderIcon icon={RiPriceTag3Line} />
        Country
      </Spreadsheet.ColumnHeader>
      <Spreadsheet.ColumnHeader className="w-[7.5rem]">
        <Spreadsheet.ColumnHeaderIcon icon={RiShieldKeyholeLine} />
        Market
      </Spreadsheet.ColumnHeader>
    </Spreadsheet.Row>
  </Spreadsheet.Head>
  <Spreadsheet.Body>
    {clients.map((client, index) => (
      <Spreadsheet.Row key={client.name}>
        <Spreadsheet.RowHeader>{index}</Spreadsheet.RowHeader>
        <Spreadsheet.Cell>{client.name}</Spreadsheet.Cell>
        <Spreadsheet.Cell align="right">{client.customers}</Spreadsheet.Cell>
        <Spreadsheet.Cell>
          <Tag size="sm" color={client.tag}>
            {client.country}
          </Tag>
        </Spreadsheet.Cell>
        <Spreadsheet.Cell>
          <StatusBadge size="sm" color={client.status}>
            {client.market}
          </StatusBadge>
        </Spreadsheet.Cell>
      </Spreadsheet.Row>
    ))}
  </Spreadsheet.Body>
</Spreadsheet>

Installation

pnpm dlx wideset add spreadsheet

Copies the component and any Wideset components it uses into your project.

Examples

Sizes

Small is the default: 32px rows with 8px sides, for the densest data. Medium has 40px rows and 12px sides, room for 24px avatars and badges. The text stays 12px at both sizes; size what the cells hold with the grid: Tag and StatusBadge sm in Small and md in Medium, Avatar xs and sm. Checkbox and Switch keep their default lg (20px) at both.

tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';

const clients = [
  { name: 'Tech Nova', manager: 'Adam Smith', initials: 'AS', market: 'No issues' },
  { name: 'Eco Solutions', manager: 'Maria Lopez', initials: 'ML', market: 'No issues' },
];

const sizes = [
  { size: 'sm', label: 'Small', avatar: 'xs', badge: 'sm' },
  { size: 'md', label: 'Medium', avatar: 'sm', badge: 'md' },
] as const;

export default function SpreadsheetSizes() {
  return (
    <div className="gap-ws-11 flex w-[30rem] max-w-full flex-col">
      {sizes.map(({ size, label, avatar, badge }) => (
        <Spreadsheet key={size} size={size} aria-label={`Clients, ${label}`}>
          <Spreadsheet.Head>
            <Spreadsheet.Row>
              <Spreadsheet.ColumnHeader>{label}</Spreadsheet.ColumnHeader>
              <Spreadsheet.ColumnHeader>Account manager</Spreadsheet.ColumnHeader>
              <Spreadsheet.ColumnHeader className="w-[8rem]">Market</Spreadsheet.ColumnHeader>
            </Spreadsheet.Row>
          </Spreadsheet.Head>
          <Spreadsheet.Body>
            {clients.map((client) => (
              <Spreadsheet.Row key={client.name}>
                <Spreadsheet.Cell>{client.name}</Spreadsheet.Cell>
                <Spreadsheet.Cell>
                  <Avatar size={avatar} initials={client.initials} />
                  {client.manager}
                </Spreadsheet.Cell>
                <Spreadsheet.Cell>
                  <StatusBadge size={badge} color="positive">
                    {client.market}
                  </StatusBadge>
                </Spreadsheet.Cell>
              </Spreadsheet.Row>
            ))}
          </Spreadsheet.Body>
        </Spreadsheet>
      ))}
    </div>
  );
}

Cell types

A cell holds text or one library component, never a hand-built pill: text, a right-aligned number, Tag for a category, StatusBadge for a state, Avatar beside a name, Checkbox, Switch, ProgressBar (80px wide), an icon. Text and mixed content stay on one line and end in an ellipsis. Controls inside a cell need their own label, as they have no visible one: name them after the column and the row.

tsx
import { RiMastercardLine, RiStarFill, RiStarLine, RiVisaLine } from '@remixicon/react';
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';
import { Checkbox } from '@/components/ui/wideset/checkbox/Checkbox';
import { ProgressBar } from '@/components/ui/wideset/progress-bar/ProgressBar';
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';
import { Switch } from '@/components/ui/wideset/switch/Switch';
import { Tag } from '@/components/ui/wideset/tag/Tag';

const clients = [
  {
    name: 'Tech Nova',
    customers: 23,
    country: 'Brazil',
    tag: 'pink',
    market: 'No issues',
    status: 'positive',
    manager: 'Adam Smith',
    initials: 'AS',
    verified: true,
    newsletter: true,
    onboarding: 50,
    starred: true,
    card: 'Visa',
    last4: '4789',
  },
  {
    name: 'Eco Solutions',
    customers: 37,
    country: 'Japan',
    tag: 'indigo',
    market: 'Risk found',
    status: 'notice',
    manager: 'Maria Lopez',
    initials: 'ML',
    verified: false,
    newsletter: false,
    onboarding: 80,
    starred: false,
    card: 'Mastercard',
    last4: '1203',
  },
  {
    name: 'Pinnacle Tech',
    customers: 8,
    country: 'India',
    tag: 'cyan',
    market: '2 issues',
    status: 'negative',
    manager: 'Kenji Sato',
    initials: 'KS',
    verified: true,
    newsletter: false,
    onboarding: 20,
    starred: false,
    card: 'Visa',
    last4: '5521',
  },
] as const;

export default function SpreadsheetCellTypes() {
  return (
    <Spreadsheet aria-label="Clients" className="w-[46rem] max-w-full">
      <Spreadsheet.Head>
        <Spreadsheet.Row>
          <Spreadsheet.ColumnHeader aria-label="Row" className="w-[2.8125rem]" />
          <Spreadsheet.ColumnHeader className="w-[9.5rem]">Client name</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[7rem]">Customers</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[7.5rem]">Country</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[7.5rem]">Market</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[9.5rem]">
            Account manager
          </Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[5rem]">Verified</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[6rem]">Newsletter</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[8rem]">Onboarding</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[5rem]">Starred</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[9rem]">Payment</Spreadsheet.ColumnHeader>
        </Spreadsheet.Row>
      </Spreadsheet.Head>
      <Spreadsheet.Body>
        {clients.map((client, index) => (
          <Spreadsheet.Row key={client.name}>
            <Spreadsheet.RowHeader>{index}</Spreadsheet.RowHeader>
            <Spreadsheet.Cell>{client.name}</Spreadsheet.Cell>
            <Spreadsheet.Cell align="right">{client.customers}</Spreadsheet.Cell>
            <Spreadsheet.Cell>
              <Tag size="sm" color={client.tag}>
                {client.country}
              </Tag>
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              <StatusBadge size="sm" color={client.status}>
                {client.market}
              </StatusBadge>
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              <Avatar size="xs" initials={client.initials} />
              {client.manager}
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              <Checkbox aria-label={`Verified: ${client.name}`} defaultChecked={client.verified} />
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              <Switch
                aria-label={`Newsletter: ${client.name}`}
                defaultChecked={client.newsletter}
              />
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              <div className="w-ws-22">
                <ProgressBar value={client.onboarding} aria-label={`Onboarding: ${client.name}`} />
              </div>
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              {client.starred ? (
                <RiStarFill role="img" aria-label="Starred" className="size-ws-9" />
              ) : (
                <RiStarLine role="img" aria-label="Not starred" className="size-ws-9" />
              )}
            </Spreadsheet.Cell>
            <Spreadsheet.Cell>
              {client.card === 'Visa' ? (
                <RiVisaLine role="img" aria-label="Visa" className="size-ws-12" />
              ) : (
                <RiMastercardLine role="img" aria-label="Mastercard" className="size-ws-12" />
              )}
              •••• {client.last4}
            </Spreadsheet.Cell>
          </Spreadsheet.Row>
        ))}
      </Spreadsheet.Body>
    </Spreadsheet>
  );
}

Column headers

A column header names its column and its data type: Spreadsheet.ColumnHeaderIcon before the label, Spreadsheet.ColumnHeaderTrigger after it, the chevron that opens your column menu (wrap it in DropdownMenu.Trigger asChild). Sorting is your state: reorder the rows and set sortDirection on the sorted column, which screen readers hear as aria-sort. With focus on a header, Enter moves it to the chevron.

tsx
import { RiArrowDownLine, RiArrowUpLine, RiFileLine, RiHashtag } from '@remixicon/react';
import { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';
import { ListItem } from '@/components/ui/wideset/list-item/ListItem';
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';
import { useState } from 'react';

const clients = [
  { name: 'Tech Nova', customers: 23, employees: 58 },
  { name: 'Eco Solutions', customers: 37, employees: 72 },
  { name: 'Skyline Innovations', customers: 15, employees: 14 },
  { name: 'Terra Firma', customers: 42, employees: 49 },
];

type Key = keyof (typeof clients)[number];

const columns = [
  { key: 'name', label: 'Client name', icon: RiFileLine },
  { key: 'customers', label: 'Customers', icon: RiHashtag },
  { key: 'employees', label: 'Employees', icon: RiHashtag },
] as const;

export default function SpreadsheetColumnHeaders() {
  const [sort, setSort] = useState<{ key: Key; direction: 'asc' | 'desc' }>({
    key: 'customers',
    direction: 'desc',
  });
  const rows = [...clients].sort((a, b) => {
    const order = String(a[sort.key]).localeCompare(String(b[sort.key]), 'en', {
      numeric: true,
    });
    return sort.direction === 'desc' ? -order : order;
  });

  return (
    <Spreadsheet aria-label="Clients" className="w-[30rem] max-w-full">
      <Spreadsheet.Head>
        <Spreadsheet.Row>
          {columns.map(({ key, label, icon }) => (
            <Spreadsheet.ColumnHeader
              key={key}
              sortDirection={sort.key === key ? sort.direction : null}
            >
              <Spreadsheet.ColumnHeaderIcon icon={icon} />
              {label}
              <DropdownMenu>
                <DropdownMenu.Trigger asChild>
                  <Spreadsheet.ColumnHeaderTrigger aria-label={`${label} options`} />
                </DropdownMenu.Trigger>
                <DropdownMenu.Content align="start">
                  <DropdownMenu.Item onSelect={() => setSort({ key, direction: 'asc' })}>
                    <ListItem.Prefix>
                      <RiArrowUpLine className="size-ws-9" />
                    </ListItem.Prefix>
                    <ListItem.Content>
                      <ListItem.Label>Sort ascending</ListItem.Label>
                    </ListItem.Content>
                  </DropdownMenu.Item>
                  <DropdownMenu.Item onSelect={() => setSort({ key, direction: 'desc' })}>
                    <ListItem.Prefix>
                      <RiArrowDownLine className="size-ws-9" />
                    </ListItem.Prefix>
                    <ListItem.Content>
                      <ListItem.Label>Sort descending</ListItem.Label>
                    </ListItem.Content>
                  </DropdownMenu.Item>
                </DropdownMenu.Content>
              </DropdownMenu>
            </Spreadsheet.ColumnHeader>
          ))}
        </Spreadsheet.Row>
      </Spreadsheet.Head>
      <Spreadsheet.Body>
        {rows.map((client) => (
          <Spreadsheet.Row key={client.name}>
            <Spreadsheet.Cell>{client.name}</Spreadsheet.Cell>
            <Spreadsheet.Cell align="right">{client.customers}</Spreadsheet.Cell>
            <Spreadsheet.Cell align="right">{client.employees}</Spreadsheet.Cell>
          </Spreadsheet.Row>
        ))}
      </Spreadsheet.Body>
    </Spreadsheet>
  );
}

Sticky columns

The header row stays in view as the grid scrolls down, and stickyColumns pins the leading columns as it scrolls sideways: 1 (the default) keeps the row numbers, 2 here keeps the client name too. Give the grid a height and a width to scroll in. Pinned cells keep the grid's surface, and a cell reached with the keyboard scrolls clear of them.

tsx
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';

const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const clients = [
  'Tech Nova',
  'Eco Solutions',
  'Skyline Innovations',
  'Terra Firma',
  'Quantum Leap',
  'Pinnacle Tech',
  'Future Vision',
  'Aqua Vista',
  'Summit Solutions',
  'Metro Dynamics',
  'Pure Air Tech',
  'Sunny Tech',
];
const money = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
  maximumFractionDigits: 0,
});
const revenue = (client: number, month: number) => ((client + 3) * (month + 7) * 389) % 9000;

export default function SpreadsheetStickyColumns() {
  return (
    <Spreadsheet
      aria-label="Monthly revenue"
      stickyColumns={2}
      className="h-[16rem] w-[34rem] max-w-full"
    >
      <Spreadsheet.Head>
        <Spreadsheet.Row>
          <Spreadsheet.ColumnHeader aria-label="Row" className="w-[2.8125rem]" />
          <Spreadsheet.ColumnHeader className="w-[9.5rem]">Client name</Spreadsheet.ColumnHeader>
          {months.map((month) => (
            <Spreadsheet.ColumnHeader key={month} align="right" className="w-[5.5rem]">
              {month}
            </Spreadsheet.ColumnHeader>
          ))}
        </Spreadsheet.Row>
      </Spreadsheet.Head>
      <Spreadsheet.Body>
        {clients.map((client, row) => (
          <Spreadsheet.Row key={client}>
            <Spreadsheet.RowHeader>{row}</Spreadsheet.RowHeader>
            <Spreadsheet.Cell>{client}</Spreadsheet.Cell>
            {months.map((month, column) => (
              <Spreadsheet.Cell key={month} align="right">
                {money.format(revenue(row, column))}
              </Spreadsheet.Cell>
            ))}
          </Spreadsheet.Row>
        ))}
      </Spreadsheet.Body>
    </Spreadsheet>
  );
}

Keyboard

The grid is one tab stop. Tab to it or click a cell, then move with the arrow keys: Home and End go to the ends of a row, Ctrl+Home and Ctrl+End (Cmd on a Mac) to the first and last cell, Page Up and Page Down by a screen of rows. The cell you reach is the selected one (aria-selected, the brand tint), and Tab comes back to it after you leave the grid. Enter or F2 moves focus to the control in a cell, the checkbox here; Escape brings it back. A cell's onFocus tells you which cell is active.

tsx
import { Checkbox } from '@/components/ui/wideset/checkbox/Checkbox';
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';
import { useState } from 'react';

const clients = [
  { name: 'Tech Nova', customers: 23, employees: 58, verified: true },
  { name: 'Eco Solutions', customers: 37, employees: 72, verified: false },
  { name: 'Skyline Innovations', customers: 15, employees: 14, verified: true },
  { name: 'Terra Firma', customers: 42, employees: 49, verified: false },
];

export default function SpreadsheetKeyboard() {
  const [active, setActive] = useState('none');

  return (
    <div className="gap-ws-5 flex w-[30rem] max-w-full flex-col">
      <Spreadsheet aria-label="Clients">
        <Spreadsheet.Head>
          <Spreadsheet.Row>
            <Spreadsheet.ColumnHeader onFocus={() => setActive('Client name')}>
              Client name
            </Spreadsheet.ColumnHeader>
            <Spreadsheet.ColumnHeader className="w-[6.5rem]" onFocus={() => setActive('Customers')}>
              Customers
            </Spreadsheet.ColumnHeader>
            <Spreadsheet.ColumnHeader className="w-[6.5rem]" onFocus={() => setActive('Employees')}>
              Employees
            </Spreadsheet.ColumnHeader>
            <Spreadsheet.ColumnHeader className="w-[5.5rem]" onFocus={() => setActive('Verified')}>
              Verified
            </Spreadsheet.ColumnHeader>
          </Spreadsheet.Row>
        </Spreadsheet.Head>
        <Spreadsheet.Body>
          {clients.map((client) => (
            <Spreadsheet.Row key={client.name}>
              <Spreadsheet.Cell onFocus={() => setActive(`${client.name}, client name`)}>
                {client.name}
              </Spreadsheet.Cell>
              <Spreadsheet.Cell
                align="right"
                onFocus={() => setActive(`${client.name}, customers`)}
              >
                {client.customers}
              </Spreadsheet.Cell>
              <Spreadsheet.Cell
                align="right"
                onFocus={() => setActive(`${client.name}, employees`)}
              >
                {client.employees}
              </Spreadsheet.Cell>
              <Spreadsheet.Cell onFocus={() => setActive(`${client.name}, verified`)}>
                <Checkbox
                  aria-label={`Verified: ${client.name}`}
                  defaultChecked={client.verified}
                />
              </Spreadsheet.Cell>
            </Spreadsheet.Row>
          ))}
        </Spreadsheet.Body>
      </Spreadsheet>
      <p className="typography-body-sm text-ws-static-subtle">Active cell: {active}</p>
    </div>
  );
}

Long values

Rows keep their height: text never wraps, a value longer than its column ends in an ellipsis, and the full text is in the cell's title. Give each column the width its usual value needs, and a long list a height to scroll in under its header. The grid renders every row it is given; past a few thousand cells, page the data or virtualize the rows.

tsx
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';

const clients = [
  ['Tech Nova', 'https://www.technova.com', '123 Elm St, Springfield, IL 62701'],
  ['Eco Solutions', 'https://www.ecosolutions.com', '456 Maple Ave, Denver, CO 80203'],
  ['Skyline Innovations', 'https://www.skyline.com', '789 Oak Dr, Austin, TX 73301'],
  ['Terra Firma', 'https://www.terrafirma.com', '321 Pine Rd, Seattle, WA 98101'],
  ['Quantum Leap', 'https://www.quantumleap.com', '654 Cedar Blvd, Miami, FL 33101'],
  ['Pinnacle Tech', 'https://www.pinnacletech.com', '987 Birch Ln, Portland, OR 97201'],
  ['Future Vision', 'https://www.futurevision.com', '135 Spruce Ct, Boston, MA 02101'],
  ['Sunny Tech', 'https://www.sunnytech.com', '852 Palm Blvd, Atlanta, GA 30301'],
  ['New Horizons', 'https://www.newhorizons.com', '951 Cypress Dr, Dallas, TX 75201'],
  ['Vivid Life', 'https://www.vividlife.com', '258 Walnut St, Philadelphia, PA 19101'],
  ['Synergy Works', 'https://www.synergyworks.com', '369 Chestnut Ave, Phoenix, AZ 85001'],
  ['Innovate Now', 'https://www.innovatenow.com', '147 Dogwood Ln, Orlando, FL 32801'],
];

export default function SpreadsheetLongValues() {
  return (
    <Spreadsheet aria-label="Client addresses" className="h-[14rem] w-[34rem] max-w-full">
      <Spreadsheet.Head>
        <Spreadsheet.Row>
          <Spreadsheet.ColumnHeader aria-label="Row" className="w-[2.8125rem]" />
          <Spreadsheet.ColumnHeader className="w-[9.5rem]">Client name</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader className="w-[9.5rem]">Website</Spreadsheet.ColumnHeader>
          <Spreadsheet.ColumnHeader>Address</Spreadsheet.ColumnHeader>
        </Spreadsheet.Row>
      </Spreadsheet.Head>
      <Spreadsheet.Body>
        {clients.map(([name, website, address], index) => (
          <Spreadsheet.Row key={name}>
            <Spreadsheet.RowHeader>{index}</Spreadsheet.RowHeader>
            <Spreadsheet.Cell>{name}</Spreadsheet.Cell>
            <Spreadsheet.Cell>{website}</Spreadsheet.Cell>
            <Spreadsheet.Cell>{address}</Spreadsheet.Cell>
          </Spreadsheet.Row>
        ))}
      </Spreadsheet.Body>
    </Spreadsheet>
  );
}

API reference

Spreadsheet

NameDescriptionDefault
size
'sm''md'
'sm'
stickyColumns

How many leading columns stay in place while the grid scrolls sideways. `1` pins the row header column; raise it to keep a name column in view too, `0` pins none. The header row always stays in place while the grid scrolls down.

number
1
Every other prop of <div> is passed through to it. See MDN: <div>.

Spreadsheet.Body

No props of its ownIt takes its content as children.
Every other prop of <tbody> is passed through to it. See MDN: <tbody>.

Spreadsheet.Cell

NameDescriptionDefault
align

Horizontal alignment of the content. Right-align numbers and amounts.

'center''left''right'
'left'
Every other prop of <td> is passed through to it. See MDN: <td>.

Spreadsheet.ColumnHeaderIcon

NameDescriptionDefault
icon*

Icon component from `@remixicon/react` that names the column's data type.

RemixiconComponentType
—
children—

Spreadsheet.ColumnHeader

NameDescriptionDefault
align

Horizontal alignment of the header content.

'center''left''right'
'left'
sortDirection

The direction the grid is sorted by this column; sets `aria-sort`. `null` marks a column that can be sorted but is not; leave it out on columns that cannot be sorted. The grid does not sort: change the order of your rows.

'desc''asc'
—
Every other prop of <td> is passed through to it. See MDN: <td>.

Spreadsheet.ColumnHeaderTrigger

NameDescriptionDefault
aria-label*

Defines a string value that labels the current element. Names the button for screen readers, e.g. "Customers options".

string
—
Every other prop of <button> is passed through to it. See MDN: <button>.

Spreadsheet.Head

No props of its ownIt takes its content as children.
Every other prop of <tbody> is passed through to it. See MDN: <tbody>.

Spreadsheet.RowHeader

NameDescriptionDefault
align

Horizontal alignment of the content.

'center''left''right'
'center'
Every other prop of <td> is passed through to it. See MDN: <td>.

Spreadsheet.Row

No props of its ownIt takes its content as children.
Every other prop of <tr> is passed through to it. See MDN: <tr>.

Accessibility

  • Name the grid: aria-label or aria-labelledby on Spreadsheet (it reaches the table).
  • Keyboard: arrows move the selected cell, Home / End to the row’s ends, Ctrl/Cmd+Home / End to the grid’s corners, Page Up / Down by a screen of rows. Enter or F2 moves focus into the cell’s first control, Tab between the cell’s controls in their tabIndex order (a negative one skips a control), Escape or F2 back to the cell. The grid is one tab stop: Tab leaves it without stopping on a control in a cell, and returns to the same cell.
  • Controls in cells have no visible label: give each an aria-label naming column and row (Verified: Tech Nova). ColumnHeaderTrigger requires its own (Customers options).
  • An empty corner header still needs a name: aria-label="Row".
PartRendersDescription
Spreadsheet<div>A dense grid of cells the user moves through one cell at a time, as in a spreadsheet. Attributes and `ref` go to the scroll container (size it with `className`); `aria-label`, `aria-labelledby` and `aria-describedby` name the grid itself, the inner `<table role="grid">`.
Spreadsheet.Body<tbody>The body of the grid: one `Spreadsheet.Row` per record.
Spreadsheet.Cell<td>A data cell. Its content is composition: text, or a library component (`Tag`, `StatusBadge`, `Checkbox`, `Avatar` and a name …) sized for the grid. Text and mixed content stay on one line and end in an ellipsis when the column is narrower.
Spreadsheet.ColumnHeaderIcon—The type icon before a column header's label.
Spreadsheet.ColumnHeader<td>A column header cell (`<th scope="col">`): type icon, label and column menu trigger.
Spreadsheet.ColumnHeaderTrigger<button>The chevron after a column header's label: a button that opens the column's menu. Wrap it in `DropdownMenu.Trigger asChild`.
Spreadsheet.Head<tbody>The head of the grid: the column header row, and any row you add under it.
Spreadsheet.RowHeader<td>A row header cell (`<th scope="row">`), the row's number.
Spreadsheet.Row<tr>A row of cells.
Client name
Customers
Country
Market
0Tech Nova23
Brazil
No issues
1Eco Solutions37
Japan
No issues
2Pinnacle Tech8
India
2 issues
tsx
import { RiFileLine, RiHashtag, RiPriceTag3Line, RiShieldKeyholeLine } from '@remixicon/react';
import { Spreadsheet } from '@/components/ui/wideset/spreadsheet/Spreadsheet';
import { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';
import { Tag } from '@/components/ui/wideset/tag/Tag';

<Spreadsheet aria-label="Clients" className="w-[34rem] max-w-full">
  <Spreadsheet.Head>
    <Spreadsheet.Row>
      <Spreadsheet.ColumnHeader aria-label="Row" className="w-[2.8125rem]" />
      <Spreadsheet.ColumnHeader>
        <Spreadsheet.ColumnHeaderIcon icon={RiFileLine} />
        Client name
      </Spreadsheet.ColumnHeader>
      <Spreadsheet.ColumnHeader className="w-[7rem]">
        <Spreadsheet.ColumnHeaderIcon icon={RiHashtag} />
        Customers
      </Spreadsheet.ColumnHeader>
      <Spreadsheet.ColumnHeader className="w-[7.5rem]">
        <Spreadsheet.ColumnHeaderIcon icon={RiPriceTag3Line} />
        Country
      </Spreadsheet.ColumnHeader>
      <Spreadsheet.ColumnHeader className="w-[7.5rem]">
        <Spreadsheet.ColumnHeaderIcon icon={RiShieldKeyholeLine} />
        Market
      </Spreadsheet.ColumnHeader>
    </Spreadsheet.Row>
  </Spreadsheet.Head>
  <Spreadsheet.Body>
    {clients.map((client, index) => (
      <Spreadsheet.Row key={client.name}>
        <Spreadsheet.RowHeader>{index}</Spreadsheet.RowHeader>
        <Spreadsheet.Cell>{client.name}</Spreadsheet.Cell>
        <Spreadsheet.Cell align="right">{client.customers}</Spreadsheet.Cell>
        <Spreadsheet.Cell>
          <Tag size="sm" color={client.tag}>
            {client.country}
          </Tag>
        </Spreadsheet.Cell>
        <Spreadsheet.Cell>
          <StatusBadge size="sm" color={client.status}>
            {client.market}
          </StatusBadge>
        </Spreadsheet.Cell>
      </Spreadsheet.Row>
    ))}
  </Spreadsheet.Body>
</Spreadsheet>

Appearance

Size