Skip to content
shadcn.io is not affiliated with official shadcn/ui

Shadcn Type Table for React and Tailwind

Expandable Prop / Type rows for component APIs.

PropType
Allow more than one row to be expanded.

Default

true

Installation

bunx --bun shadcn@latest add https://kit.dev/r/type-table.json

Anatomy

TypeTable
└── TypeTableItem

shadcn.io Type Table is a styled Accordion. TypeTable is the root; each TypeTableItem is one expandable row. Column labels (Prop / Type) are rendered by the root. The chevron comes from AccordionTrigger.

Open rows inset as a nested card (bg-background, border, shadow) inside the padded bg-card frame. Names use text-primary so they follow the shadcn theme — Neutral, every accent, and dark.

Usage

import {
  TypeTable,
  TypeTableItem,
} from "@/components/ui/type-table";
<TypeTable>
  <TypeTableItem name="value" type="string">
    Which item is expanded.
  </TypeTableItem>
  <TypeTableItem name="disabled" type="boolean" optional defaultValue="false">
    Disable this row.
  </TypeTableItem>
</TypeTable>

value and defaultValue on the root are expanded row ids (string[]), same as Accordion. defaultValue on an item is the documented default shown in the open panel.

Examples

Optional

Mark a prop optional with optional. A ? is rendered after the name.

Single

Set multiple={false} so only one row can be open at a time. Type Table defaults multiple to true.

Compact

size="compact" reduces row padding. Names and types stay the same size.

Disabled

disabled on an item greys the row out. disabled on the root disables every row.

Deprecated

deprecated strikes the name.

Controlled

value / onValueChange use Ark’s { value: string[] } details, not a bare string.

Guides

Accordion

Type Table is Accordion with a Prop / Type header and framed card styles. Remaining Accordion root props (collapsible, dir, lazyMount, …) pass through. orientation is omitted — rows are always vertical.

Open state is always a string[]. Item value defaults to name.

<TypeTable defaultValue={["value"]}>
  <TypeTableItem name="value" type="string">
    Starts open.
  </TypeTableItem>
</TypeTable>

Type column

The Type column truncates. Long types, unions (|), generics (<>), and function types (=>) also render a Type row in the open panel. Pass typeDescription to show a full signature instead of the truncated column type. typeDescriptionLink turns the column type into a link.

defaultValue on the item always shows as Default. Function types can add parameters and returns.

At narrow widths (@max-[20rem]) the Type column is hidden; expand the row to read it.

Names use text-primary (deprecated: text-primary/50). Types stay text-muted-foreground, so Neutral still separates the columns and Teal / Blue / etc. paint the first column.

Type Table vs Data List vs Keyboard Table vs Table

Type TableData ListKeyboard TableTable
ShapeExpandable Prop / Type rowsLabel / value pairsTwo-column shortcut tableRows and columns
Use whenComponent API docsMetadata, summariesKeyboard supportTabular comparison

API Reference

shadcn.io Type Table wraps Ark UI Accordion. Defaults below are shadcn.io values. multiple is true here (false on Accordion). value / defaultValue are string[].

asChild merges props onto a single child element.

TypeTable

Root. Renders Accordion’s root div. Native Accordion root props pass through except orientation.

PropType
Allow more than one row to be expanded.

Default

true
AttributeDescription
data-slottype-table
data-size"default" or "compact"
data-scopeaccordion
data-partroot
data-orientation"vertical"

Root styles: @container, rounded-xl border bg-card p-1 text-card-foreground. The Prop / Type header is data-slot="type-table-header". Open items use bg-background, a visible border, and shadow-sm.

TypeTableItem

One API row. Renders Accordion’s item div.

PropType
Render ? after the name.

Default

false
AttributeDescription
data-slottype-table-item
data-state"open" or "closed"
data-disabledPresent when disabled

Name uses data-slot="type-table-name". Type uses data-slot="type-table-type".

TypeTableContext / useTypeTableContext

Same as Accordion context. TypeTableContext children: (context) => ReactNode.

TypeTableItemContext / useTypeTableItemContext

Same as Accordion item context. TypeTableItemContext children: (context) => ReactNode.

Accessibility

Complies with the Accordion WAI-ARIA design pattern. Each row is a trigger; the open panel is the associated content. Keep descriptions as text or structured content inside the item — do not put a second interactive control in the trigger.

Keyboard support

KeyDescription
Space
When focus is on a collapsed trigger, expand the row.
Enter
When focus is on a collapsed trigger, expand the row.
Tab
Move focus to the next focusable element.
ShiftTab
Move focus to the previous focusable element.
ArrowDown
Move focus to the next trigger.
ArrowUp
Move focus to the previous trigger.
Home
Move focus to the first trigger.
End
Move focus to the last trigger.