shadcn.io is an independent project built on shadcn/ui
On this page9 sections
Type Table lists the props of a component or the options of a function, one row each, with the name and type always in view. Opening a row shows its description, default, parameters and return type, so a long API stays short until the reader needs one detail.
For records people scan across columns, use a Table. For a list of shortcuts, use a Keyboard Table.
Installation
Anatomy

Usage
<script setup lang="ts">
import { TypeTable, TypeTableItem } from "@/components/ui/type-table";
</script>
A row's name is also its value, so defaultValue on the table lists the names of the rows that start open.
<TypeTable defaultValue={["multiple"]}>
<TypeTableItem defaultValue="true" name="multiple" optional type="boolean">
Allow more than one row to be expanded.
</TypeTableItem>
<TypeTableItem name="value" optional type="string[]">
Controlled expanded item values.
</TypeTableItem>
<TypeTableItem
name="onValueChange"
optional
parameters={[{ description: "{ value: string[] }", name: "details" }]}
returns="void"
type="(details: { value: string[] }) => void"
>
Called when expanded items change.
</TypeTableItem>
</TypeTable>Accessibility
This version is built on UI SDK's accordion, which puts each row's button in a level 3 heading. A row with something to show is a button that reports aria-expanded, and its panel is a region labeled by that row. A row with nothing to open is plain text and takes no focus. The Prop and Type header is text, not a table header, so a screen reader hears each row's name and type as its button label. A deprecated row adds the word deprecated after its name in that label, hidden from sight, so the strikethrough isn't the only sign.
- Space
- When focus is on a row, opens its details, or closes them when they are open.
- Enter
- When focus is on a row, opens its details, or closes them when they are open.
- Tab
- Moves focus to the next row with details, a disabled one included, or out of the table.
- Shift+Tab
- Moves focus to the previous row with details, or out of the table.
Demos
Controlled
The open rows live in the demo's own state, passed as value and updated from @value-change, and the line under the table prints their names, or none once every row is closed. The value row starts open. Hold the open rows yourself when a link or a search box elsewhere on the page should open a specific prop.
Deprecated
The open prop has deprecated, which strikes its name through, fades it and tells screen readers it is deprecated, and its description points to value and defaultValue instead. Keep a row like this while old code still passes the prop and readers need the way out. Remove it once the prop is gone from every version people still run.
Disabled
The middle row has disabled on its TypeTableItem, so it is faded to half opacity and can't be hovered or opened, while the value and className rows open as usual. It stays in the tab order, so keyboard and screen reader users still find the prop, but its description never shows. Disable a row only when its details don't apply to the reader.
Optional
The id row is required, so its name has no mark, while label and disabled carry optional and print a question mark after the name. The disabled row also has a defaultValue of false, shown as Default when it opens. Mark every prop a caller can leave out, so the required ones stand out.
Single
multiple is set to false, so opening one of the three rows closes the one that was open, and pressing the open row closes it too. Use it when descriptions run long and two open at once would push the next prop off screen. Keep the default, several open rows, when readers compare props.
Size compact
The same three rows with size set to compact, which trims the padding of the header and of every row, so these rows are a quarter shorter than in the other demos. Pick it for a reference with many props in a sidebar or a dialog. Keep the default when the table is the main content of the page.
FAQ
When should I use a Type Table instead of a regular Table?
Use a Type Table for an API: props, options or fields where the name and type are what people scan for, and the description is something they open when they need it. Each row carries its own details, so a list of 30 props stays one line per prop.
Use a Table for records, such as orders or users, where people compare values across columns, sort them or read every cell. A Type Table has exactly two visible columns and no sorting.
How do I document a prop in the Type Table?
Add a TypeTableItem with its name and type, and write the description inside it. optional adds a question mark after the name, defaultValue shows a Default line when the row opens, and deprecated strikes the name through, as the Optional and Deprecated demos show.
The type column cuts off a long type, so a type over 32 characters, or any union, intersection, generic or arrow function type (one with |, &, < or > in it), is repeated in full when the row opens. typeDescription replaces that full text, and nameColumn on the table renames the Prop header. typeDescriptionLink links the type on the open row's Type line, or in the column of a row with nothing to open.
How do I show a function's parameters and return type in the Type Table?
Set parameters on the TypeTableItem to a list of objects, each with a name and a description, and returns to the return type. The open row lists them under Parameters and Returns, after the description.
Give the item the whole signature as its type too, such as the onValueChange row in the first preview. Because the signature holds an arrow, the open row repeats it in full under Type, while the column shows as much as fits.
How do I control which Type Table rows are open in Vue?
Hold the open rows in a ref and bind it with v-model:value on TypeTable, which reads and writes the array of open rows. @value-change receives an object, so read the array from details.value, as the Controlled demo does.
Each entry is a row's name, or its value when you set one. To start some rows open and leave the rest to the reader, list them in defaultValue instead. Set multiple to false to keep one row open at a time, as the Single demo does.
Why do two Type Table rows open and close together?
They share a name. A row's value is its name unless you set value, and the table keeps track of open rows by value, so two rows called value, for the root and for an item, open and close as one.
Give one of them a value of its own, such as item-value. The name in the first column stays the same, and defaultValue or your own state then lists that new value for the row.
Why can't Ctrl+F find text inside a closed Type Table row?
A closed row's details aren't in the page. The table leaves a row's panel out until the row opens and takes it out again when it closes. With unmountOnExit set to false a panel stays in the page once it has opened, and with lazyMount set to false every panel mounts from the start, but either way a closed panel is hidden, so find in page still can't see it.
Names and types are always rendered, so find in page still lands on the right row. On a reference page where people search descriptions, start every row open by listing all the names in defaultValue, or put an Expand all button above the table that sets value to every name.
Why does the Type column disappear in a narrow Type Table?
Below 20rem wide, the table hides the Type column and its header so the names keep their room. It measures its own width, not the window's, so a Type Table in a slim sidebar hides types even on a wide screen.
Long and compound types still show in full when the row opens. A short plain one, such as boolean, then appears nowhere, so set typeDescription on rows where the type matters, and it shows whenever that row opens.
API Reference
TypeTable
<div> data-slot="accordion"
value?string[]
The open rows' values. Pass it to control the table. Two-way with v-model.
defaultValue?string[]
The rows open at first, when uncontrolled.
collapsible?boolean
Whether the open row can close when only one may be open.
- Default
true
disabled?boolean
Stops every row from opening or closing.
lazyMount?boolean
Leave a row's panel out of the page until the row first opens. With
false, closed panels are in the page, hidden, from the start.
- Default
true
multiple?boolean
Allow more than one row to be expanded.
- Default
true
nameColumn?string
Label for the first column.
- Default
"Prop"
size?"default" | "compact"
Row density. Compact reduces trigger padding.
- Type
"default" | "compact"- Default
"default"
unmountOnExit?boolean
Take a row's panel out of the page when it closes. With false, a panel
that has opened stays in the page, hidden.
- Default
true
class?string
Merged with the part's classes.
@value-change(details: { value: string[] }) → void
Called when the value changes.
- Type
(details: { value: string[] }) → void- Parameters
details– { value: string[] }- Returns
void
data-disabled?string
Present when the whole accordion is disabled.
TypeTableItem
<div> data-slot="accordion-item"
namestring
Name in the first column. Also the item value unless value is set.
typestring
Type in the second column.
children?VNode
Description shown when the row is open.
defaultValue?string
Shown as Default in the open panel.
deprecated?boolean
Strike the name, and add "(deprecated)" to it for screen readers.
- Default
false
disabled?boolean
Stops the row from opening.
optional?boolean
Renders ? after the name.
- Default
false
parameters?TypeTableParameter[]
Parameter list when the type is a function.
returns?VNode
Return type shown in the open panel.
typeDescription?VNode
Full type signature in the open panel. Overrides the truncated column type.
typeDescriptionLink?string
Optional href for the type: on the Type line of the open row, or on the second column of a row with nothing to open.
value?string
Unique row value. Defaults to name.
class?string
Merged with the part's classes.
data-closed?string
Present while the item is closed, including while its panel animates out.
data-disabled?string
Present when the item can't open or close.
data-open?string
Present while the item is open.











