Descriptions
Headless Descriptions; covers Ant Design Descriptions, HTML dl, shadcn/ui.
| Package | @vizejs/ui/descriptions |
| Maturity | stable |
| Quality gates | behavior contract, mounted dom, type inference, tree shaking, bundle size, ssr, hydration, dom compile, ssr compile, vapor compile |
| Bundle budget | 4,000 B JS gzip / 0 B CSS gzip |
| Own the source | vize lib pull descriptions |
| Requires | — |
| Aliases | description list, definition list, property list, detail list |
| Covers | Ant Design Descriptions, HTML dl, shadcn/ui |
Minimal setup
Use a Vue 3.5+ project with Vue SFC compilation configured (see Vite+ integration).
vp install @vizejs/ui
Add the public import below to <script setup lang="ts">. Components provide behavior without styles; the preview uses optional Paper styles.
import { Descriptions, DescriptionsItem } from "@vizejs/ui/descriptions";
Or copy the source into your project with vize lib pull descriptions (see Source Distribution).
Try it
This is the basic example maintained with the component source, using the public package imports. The preview adds the optional Paper styles.
Open the interactive example · Styling these components
Copy the example
<!-- Invoice facts as a named description list. -->
<script setup lang="ts">
import { Descriptions, DescriptionsItem } from "@vizejs/ui/descriptions";
</script>
<template>
<Descriptions label="Invoice">
<DescriptionsItem label="Status">Paid</DescriptionsItem>
<DescriptionsItem label="Total">$1,280</DescriptionsItem>
</Descriptions>
</template>
Pair a term with one detail
Descriptions is a dl with an accessible name. Each DescriptionsItem is a
term plus a definition, so the pair is announced even when CSS changes the
visual columns.
<script setup lang="ts">
import { Descriptions, DescriptionsItem } from "@vizejs/ui/descriptions";
</script>
<template>
<Descriptions label="Invoice">
<DescriptionsItem label="Status">Paid</DescriptionsItem>
<DescriptionsItem label="Total">$1,280</DescriptionsItem>
</Descriptions>
</template>
The list is headless. Layout, borders, and columns belong to the consumer.
API
Descriptions
Source: src/components/descriptions/descriptions.vue
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label (required) |
string |
— | Accessible name of the list. |
Slots
| Slot | Slot props | Description |
|---|---|---|
default |
— | Renders DescriptionsItem pairs. |
DescriptionsItem
Source: src/components/descriptions/descriptions-item.vue
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label (required) |
string |
— | Term announced for the detail. |
Slots
| Slot | Slot props | Description |
|---|---|---|
default |
DescriptionsItemSlotProps |
Renders the detail for this term. |
Behavior
Normative state × input → outcome table for src/components/descriptions/descriptions.vue
and src/components/descriptions/descriptions-item.vue.
Every row is proven by src/components/descriptions/tests/behavior.test.ts.
| # | State | Input | Outcome | Proven by |
|---|---|---|---|---|
| D1 | labeled list | render | dl with role="group" named by label |
names the list and pairs each term with its detail |
| D2 | item | render | role="term" and role="definition" expose the label and the slot |
names the list and pairs each term with its detail |
| D3 | item slot | render | the slot receives the term label | passes the term to the detail slot |