Skip to content

Vben Descriptions ​ ​

Descriptions displays a group of read-only fields, commonly used on detail pages and information previews. It is built on shadcn-ui with an API modeled after Ant Design Vue's Descriptions, supporting responsive columns, column spanning, borders, and vertical layout.

If the documentation does not cover the details you need, please refer to the online examples.

Before you start

The component supports two usages: data-driven via items (recommended), or declaring entries with the VbenDescriptionsItem child component. items takes precedence when both are provided. :::

Basic Usage ​ ​

Pass an array of fields via items, each with a label and content. Columns adapt to breakpoints by default (1 column on xs, 2 on sm, 3 on md and above).

Bordered ​ ​

Set bordered for a bordered style, combined with the title prop and the #extra slot (an action area on the right of the title).

Vertical Layout ​ ​

Use layout="vertical" to place labels above their content.

Sizes ​ ​

Use size to switch between small, middle, and large.

Span & Responsive ​ ​

Set span on an item to span multiple columns; 'filled' fills the remaining space of the current row. column accepts a breakpoint-keyed object for responsive columns.

Child Component Usage ​ ​

When items is omitted, declare entries with VbenDescriptionsItem in the default slot. Content can be customized via the default slot or the #content slot.

API ​ ​

Descriptions Props ​ ​

PropDescriptionTypeDefault
itemsData-driven entries; reads the default slot when omittedDescriptionsItemType[]-
borderedWhether to show bordersbooleanfalse
columnColumns per row, supports breakpoint confignumber | Partial<Record<Breakpoint, number>>{ xs: 1, sm: 2, md: 3, xxxl: 4 }
layoutLayout direction'horizontal' | 'vertical''horizontal'
sizeSize'small' | 'middle' | 'large''middle'
colonShow colon (only for non-bordered horizontal layout)booleantrue
titleTitlestring-
extraAction area on the right of the titlestring-
labelStyleShared label styleCSSProperties-
contentStyleShared content styleCSSProperties-
classCustom class for the root nodestring-

Descriptions Slots ​ ​

SlotDescription
titleCustom title
extraCustom action area beside the title
defaultPlace VbenDescriptionsItem children

DescriptionsItem ​ ​

Each entry in items, or the props of the VbenDescriptionsItem child component.

PropDescriptionTypeDefault
labelLabelstring | number | (() => VNode) | Component-
contentContentstring | number | (() => VNode) | Component-
spanColumns to span, 'filled' fills the rest of the rownumber | 'filled' | Partial<Record<Breakpoint, number>>1
labelStyleLabel styleCSSProperties-
contentStyleContent styleCSSProperties-
keyUnique keystring | number-

DescriptionsItem Slots ​ ​

Available only for the child component usage.

SlotDescription
defaultContent (equivalent to content)
contentCustom content
labelCustom label

Breakpoint

The responsive Breakpoint is one of 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl', with pixel values aligned with Ant Design (sm 576, md 768, lg 992, xl 1200, xxl 1600, xxxl 2000). :::

Contributors

Changelog

Released under the MIT License.