Marketing sectionsIndexTableSplit
Searchastronomic.dev# IndexTableSplit
The same table beside its heading, in the label column.
Static: no JavaScript.
## Usage
```astro
import IndexTableSplit from "@astronomic-dev/ui/components/IndexTableSplit.astro";
```
## Examples
### Beside its heading
From a 56rem index-table container the header sits in a start column beside the table (about three to five); below that it sits above it. Without a heading the table takes the whole row.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import IndexTableSplit from "@astronomic-dev/ui/components/IndexTableSplit.astro";
const columns = [
{ key: "family", label: "Family" },
{ key: "tier", label: "Tier" },
{ key: "parts", label: "Parts", align: "end" as const },
];
const rows = [
{ cells: { family: "Contact", tier: "Free", parts: "5" }, href: "/ui/sections/contact" },
{ cells: { family: "Newsletter", tier: "Free", parts: "4" }, href: "/ui/sections/newsletter" },
{ cells: { family: "Posts", tier: "Free", parts: "5" }, href: "/ui/sections/posts" },
{ cells: { family: "Team", tier: "Free", parts: "4" }, href: "/ui/sections/team" },
];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<IndexTableSplit heading="Site sections" text="The families every site needs past the home page, each with its own page in the directory." columns={columns} rows={rows}>
<Badge slot="eyebrow">Directory</Badge>
</IndexTableSplit>
</div>
```
## Props
### IndexTableSplit
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `string` | None | The section heading, in the section role in display type. It names the section and the table. Without it there is no section and no header: a plain <div> holds only the table, named by caption. |
| `emphasis` | `boolean` | `false` | Turn one *phrase* in the heading into <em>: exactly two asterisks around text with no space inside. Off by default, so the heading shows as typed. |
| `mark` | `string` | None | A short mark after the heading, such as "(12)", in small muted type, outside the heading. Shown only with a heading. |
| `markLabel` | `string` | None | What the mark says to a screen reader, such as "12 awards": the mark is then hidden from screen readers and this is read in its place. |
| `text` | `string` | None | One or two sentences under the heading, in the lead role, muted. Shown only with a heading. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. |
| `caption` | `string` | None | The table's name when there is no heading, in a visually hidden <caption>. With a heading too, the caption names the table and the heading the section. One of heading or caption is required: without either the build stops. |
| `columns` | `IndexColumn[]` | None | Required. The columns, in order: { key, label, align? }. key picks each row's cell; label is the column header; align "end" sets a year or a count at the end, in figures of one width, on the first line of the row on a phone. An empty list stops the build. |
| `rows` | `IndexRow[]` | None | Required. The rows, in order: { cells, href? }. cells holds each row's text by column key; a column with no cell shows an empty one, and keys that are not columns are left out. With href the first cell's text is a link to that page. An empty list stops the build. |
| `class` | `string` | None | More classes for the root (the <section>, or the <div> without a heading), merged with cn(), so yours win on conflicts. The root is a named size container (inline-size containment): in a shrink-to-fit parent it collapses, so give it a width there. |
| Slot | Description |
| --- | --- |
| `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. |
Any other attribute goes on the <section>, or on the <div> without a heading.
## Accessibility
- It is a real <table> with explicit roles on the table, its rows, its column headers and its cells, so its meaning holds on a phone, where the rows are laid out as two lines.
- With a heading it is a region named by it: a <section> whose heading id is unique on the page, and the table is labeled by the heading. Without one, the table is named by its caption (visually hidden). One of the two is required.
- The header row is visually hidden on a phone, but a screen reader still reads each cell with its column header.
- With href, the first cell's text is the row's one link, named by that text, at least 44px tall on touch screens, with the kit's focus ring.
- A year or a count (align "end") sits at the end of its row in figures of one width.
IndexTableSplit
FreeThe same table beside its heading, in the label column.
- File
- IndexTableSplit.astro
- Group
- Marketing sections
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Beside its heading
From a 56rem index-table container the header sits in a start column beside the table (about three to five); below that it sits above it. Without a heading the table takes the whole row.
This preview did not load.
main.astro
examples/indextablesplit/main.astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import IndexTableSplit from "@astronomic-dev/ui/components/IndexTableSplit.astro";
const columns = [
{ key: "family", label: "Family" },
{ key: "tier", label: "Tier" },
{ key: "parts", label: "Parts", align: "end" as const },
];
const rows = [
{ cells: { family: "Contact", tier: "Free", parts: "5" }, href: "/ui/sections/contact" },
{ cells: { family: "Newsletter", tier: "Free", parts: "4" }, href: "/ui/sections/newsletter" },
{ cells: { family: "Posts", tier: "Free", parts: "5" }, href: "/ui/sections/posts" },
{ cells: { family: "Team", tier: "Free", parts: "4" }, href: "/ui/sections/team" },
];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<IndexTableSplit heading="Site sections" text="The families every site needs past the home page, each with its own page in the directory." columns={columns} rows={rows}>
<Badge slot="eyebrow">Directory</Badge>
</IndexTableSplit>
</div>Minimal · Light