ui slot reference
The ui prop of VTable is the per-instance entry for style overrides. Each key corresponds to a theme slot, and its value is a Tailwind CSS class string that is merged intelligently with the preset's default classes through cn().
<VTable
:columns="columns"
:data-source="data"
:ui="{
th: 'bg-blue-50',
td: 'align-top',
}"
/>TIP
After you install and import @vtable-guild/vtable-guild, all slot keys of the ui prop are autocompleted in TypeScript projects.
This page is not only for ui
The slots and variants listed on this page are not just a reference table for the ui prop; they also map to how the global theme is written:
ui.thmaps totheme.table.slots.thui.tdmaps totheme.table.slots.tdhoverable.true.tdmaps totheme.table.variants.hoverable.true.tdsize: 'small'maps totheme.table.defaultVariants.size = 'small'
In other words, you can read this page as the complete list of what the Table theme system lets you override.
Mapping the slot tables to the global theme
createVTableGuild({
theme: {
table: {
slots: {
th: 'bg-slate-50 text-slate-900',
td: 'align-top',
},
variants: {
hoverable: {
true: {
td: 'group-hover/row:bg-blue-50',
},
},
},
defaultVariants: {
size: 'small',
},
},
},
})If you want an app-wide convention, read Three-layer theme overrides first. If you only need to change a single table, come back to ui.
Quick example: changing the row hover background
The row hover effect is controlled by the hoverable variant. The hover highlight is driven by JS state, so it handles cells merged across rows correctly. To customize the hover background, overriding the CSS variable is recommended:
Option 1: override the CSS variable (recommended)
:root {
--vtg-table-row-hover-bg: #e6f7ff;
}Option 2: override the tdRowHover slot through the ui prop
<VTable :columns="columns" :data-source="data" :ui="{ tdRowHover: 'bg-blue-50' }" />Option 3: through the global theme
app.use(
createVTableGuild({
theme: {
table: {
slots: {
tdRowHover: 'bg-blue-50',
},
},
},
}),
)Complete slot list
All available theme slot keys are listed below, grouped by feature. They work both in ui and in the global theme.table.slots.
Core structure
| Slot | Description |
|---|---|
root | Outermost table container. Controls font family, font size and line height. |
wrapper | Scroll wrapper around the <table> element. |
rootAutoHeight | Auto-height layout added on top of root when scroll.y: 'auto' (fills the parent container). |
wrapperAutoHeight | Auto-height layout added on top of wrapper when scroll.y: 'auto' (takes the remaining height). |
table | The <table> element. Controls background color, text color and border spacing. |
thead | The <thead> element. |
tbody | The <tbody> element. |
tr | The <tr> element. Carries group/row by default so child elements can match on hover. |
th | Header cell <th>. Controls background, text color, borders and the split line. |
td | Data cell <td>. Controls background, text color and borders; hover, selected and striped styles are added through variants. |
Header and cell wrappers
| Slot | Description |
|---|---|
headerCellInner | Flex wrapper inside the header cell. |
bodyCellEllipsis | Text truncation layer for the content of ellipsis columns. |
headerHelp | Header help icon for a column tooltip. |
cellContent | Wrapper around the content and copy button of copyable columns. |
copyButton | Copy button of copyable columns. |
Grouped headers
| Slot | Description |
|---|---|
groupedHeaderTable | Inner <table> in grouped headers. |
groupedHeaderTh | Grouped header <th>. |
groupedHeaderTd | Grouped header <td>. |
Sorting
| Slot | Description |
|---|---|
thSortable | Extra styles for the <th> of sortable columns. |
thSorted | <th> background of the actively sorted column. |
tdSorted | <td> background of the actively sorted column. |
sortButton | Sort icon container. |
sortIconDown | Spacing adjustment for the descending icon. |
sortAreaOuter | Outermost flex wrapper of the sort area. |
sortAreaWrapper | Flex wrapper between the title and the sort icon. |
sortAreaTitle | Sort title text container. |
Filter icon
| Slot | Description |
|---|---|
filterIconWrapper | Filter icon wrapper. |
filterIcon | The filter trigger icon itself. |
Filter dropdown panel
| Slot | Description |
|---|---|
filterDropdown | Filter panel root container. |
filterDropdownList | Filter option list container. |
filterDropdownItem | A single filter option. |
filterDropdownItemSelected | Selected option styles. |
filterDropdownItemSelectedSingle | Extra styles for the selected option in single-select mode (filterMultiple: false). |
filterDropdownItemHover | Hovered option styles. |
filterDropdownContentWrapper | Option content wrapper. |
filterDropdownActions | Bottom action bar. |
filterDropdownResetButton | Extra styles for the bottom "Reset" button. |
filterDropdownConfirmButton | Extra styles for the bottom "OK" button. |
filterDropdownSearch | Outer layer of the search area. |
filterDropdownSearchField | Search input container. |
filterDropdownSearchIcon | Search icon. |
filterDropdownSearchInput | Search input. |
filterDropdownListEmpty | Empty-result message. |
Filter tree
| Slot | Description |
|---|---|
filterDropdownSwitcher | Expand/collapse button of a tree node. |
filterDropdownSwitcherExpanded | Expanded state. |
filterDropdownSwitcherCollapsed | Collapsed state. |
filterDropdownSwitcherNoop | Placeholder for nodes that cannot be toggled. |
filterDropdownTreeWrapper | Tree list wrapper. |
filterDropdownTreeList | Tree list <ul>. |
filterDropdownTreeItem | A single tree node row. |
filterDropdownTreeContentWrapper | Tree node content wrapper. |
filterDropdownTreeItemSelected | Selected node styles. |
filterDropdownTreeItemMatched | Styles for nodes matched by the search. |
filterDropdownTreeCheckAll | The "Select all" row. |
Empty state
| Slot | Description |
|---|---|
empty | Empty state root container. |
emptyWrapper | Empty state content wrapper. |
emptyIcon | Empty state icon area. |
emptyText | Empty state text. |
Loading state
| Slot | Description |
|---|---|
loading | Loading mask covering the whole table. |
loadingSpinner | Loading icon. |
Selected rows
| Slot | Description |
|---|---|
tdSelected | <td> background of selected rows. |
tdRowHover | <td> background of regular rows on hover. |
tdRowSelectedHover | <td> background overlay of selected rows on hover. |
Row drag sorting
| Slot | Description |
|---|---|
trDragging | The <tr> of the row being dragged. |
trDropAbove | <tr> indicator line of the drop target row (insert above it). |
trDropBelow | <tr> indicator line of the drop target row (insert below it). |
Row selection dropdown
| Slot | Description |
|---|---|
selectionDropdown | Row selection dropdown panel. |
selectionDropdownItem | Row selection dropdown item. |
selectionExtra | Extra trigger icon in the header of the row selection column. |
Title, footer and summary
| Slot | Description |
|---|---|
title | Table title area. |
footer | Table footer area. |
summary | Summary container. |
summaryRow | Summary <tr>. |
summaryCell | Summary <td>. |
Fixed columns and fixed header
| Slot | Description |
|---|---|
headerWrapper | Header scroll wrapper in fixed-header mode. |
bodyWrapper | Body scroll wrapper in fixed-header mode. |
fixedCell | Fixed column cell. |
fixedDividerLeft | Left fixed column divider. |
fixedDividerRight | Right fixed column divider. |
fixedShadowLeft | Left fixed column shadow layer. |
fixedShadowRight | Right fixed column shadow layer. |
fixedShadowLeftHidden | Hidden state of the left shadow. |
fixedShadowRightHidden | Hidden state of the right shadow. |
Expandable rows
| Slot | Description |
|---|---|
expandIcon | Base styles of the expand button. |
expandIconExpanded | Expanded state. |
expandIconCollapsed | Collapsed state. |
expandIconSpaced | Placeholder for rows that cannot be expanded. |
expandIconDisabled | Disabled state. |
expandIconSymbol | Symbol container of the expand icon. |
expandIconSymbolExpanded | Expanded symbol state. |
expandIconSymbolCollapsed | Collapsed symbol state. |
expandedRow | Expanded row <tr>. |
expandedRowCell | Expanded content <td>. |
Tree expansion
treeExpandIconLoading and treeExpandIconError control the lazy-loading feedback and the retryable error respectively; colors, sizes and animations are defined by the preset layer.
| Slot | Description |
|---|---|
treeExpandIcon | Base styles of the tree expand button. |
treeExpandIconExpanded | Expanded state. |
treeExpandIconCollapsed | Collapsed state. |
treeExpandIconSpaced | Placeholder for leaf nodes. |
treeExpandIconDisabled | Disabled state. |
treeExpandIconSymbol | Tree symbol container. |
treeExpandIconSymbolExpanded | Tree expanded symbol state. |
treeExpandIconSymbolCollapsed | Tree collapsed symbol state. |
treeExpandIconLoading | Button state while lazy loading is in progress. |
treeExpandIconError | Retry button state after lazy loading fails. |
Field tags
cellTag controls the tag appearance of valueType: 'tag', while cellStatus still controls the enum status marker. Both share data-status and the status color variables; a custom renderer can also return presentation: 'tag' to use the tag theme.
| Slot | Description |
|---|---|
cellStatus | valueEnum status marker, colored by data-status. |
cellTag | Tag appearance for valueType: 'tag' or a renderer with presentation: 'tag'. |
Field progress
| Slot | Description |
|---|---|
cellProgress | Overall progress width and the gap between the track and the value. |
cellProgressTrack | Track height, radius and background. |
cellProgressBar | Fill color; supports data-status states. |
cellProgressText | Percentage text or the success / error icon. |
Editing controls
| Slot | Description |
|---|---|
editCell | Content container of a cell that has entered editing. |
editSizer | Hidden copy of the display content that sizes an editing cell in stable layout. |
editControl | Width and error outline of the host control. |
editError | Validation error located by field. |
editTrigger | Interactive trigger button for click-to-edit cells. |
editTriggerValue | Display text wrapper inside the click-to-edit cell trigger. |
editTriggerIcon | Edit icon wrapper revealed on cell hover or focus. |
The query area uses a separate theme.query; see Schema query area.
Column resizing
| Slot | Description |
|---|---|
resizeHandle | Column resize handle. |
Column width layout
| Slot | Description |
|---|---|
widthConstraintCell | Cell used to constrain column widths. |
widthConstraintInner | Inner element of the column-width constraint cell. |
widthLayoutCell | Cell styles added when the column-width layout is used. |
Variant list
The table applies conditional styles based on props. The global theme.table.variants can override the preset's conditional classes. When a table is not given size, you can adjust the default size through theme.table.defaultVariants.size.
| Variant | Values | Default | Affected slots |
|---|---|---|---|
size | small / middle / large | large for antdv, middle for element-plus | Padding of th, td, title, footer and summaryCell |
bordered | true / false | false | Borders of root, th, td, tbody, title, footer and summaryCell |
striped | true / false | false | Even-row background of td and the related row-state slots |
hoverable | true / false | true | tdRowHover and tdRowSelectedHover set the hover background of regular and selected rows |
loading | true / false | false | With boolean true, the antdv table becomes translucent and ignores pointer events. In both presets the mask and default icon come from loading and loadingSpinner. |
Theme slots for the toolbar and column settings
These two components have their own theme configs: globally, use theme.toolbar.slots / theme.columnSettings.slots; per instance, use each component's own ui. Instance styles for the column settings inside VTableToolbar are passed through columnSettings.ui; when you use VTableColumnSettings on its own, pass ui directly.
VTableToolbar
| Slot | Description |
|---|---|
root | Toolbar root container and responsive layout. |
title | Title area. |
right | Wrapper around application actions and built-in tools. |
actions | Container for #actions application buttons. |
settings | Container for built-in tools or #settings. |
search | Toolbar lightweight search container. |
searchGroup | Combined container for the search input area and the submit button. |
searchField | Outer layer of the search text box. |
searchInput | Search text input. |
searchSubmit | Search submit button. |
searchClear | Button that clears the search text. |
searchIcon | Search and clear icons. |
filter | Container for #filter content in the single-row layout. |
extra | Container for #extra content, and for #filter content in the multi-row layout. |
action | Built-in buttons such as refresh and fullscreen. |
icon | Built-in tool icon. |
loadingIcon | Refresh loading animation. |
VTableColumnSettings
| Slot | Description |
|---|---|
root | Container for the density and column settings triggers. |
trigger | Column settings button. |
densityTrigger | Density button. |
popup | Column settings overlay. |
densityPopup | Density overlay. |
density | Density menu option. |
header | Column settings panel header. |
heading | Select-all heading. |
reset | Reset button. |
columns | Column list. |
children | Nested child column list. |
item | Column list item. |
row | Column option row; serves as the drag carrier. |
rowDragging | Outline of the source row being dragged. |
rowDropAbove | Insertion line above the target row. |
rowDropBelow | Insertion line below the target row. |
rowDropDot | Dot at the left end of the insertion line. |
dragHandle | Drag handle. |
pinActions | Pin position button group. |
pinAction | Pin position button. |
pinIcon | Pin position icon. |
group | Container for a group of columns divided by pin position. |
groupTitle | Pin position group title. |
groupColumns | Column list within a group. |
label | Column option label. |
checkboxControl | Checkbox container. |
checkbox | Checkbox input element. |
checkMark | Check mark. |
indeterminateMark | Indeterminate mark. |
labelText | Column option label text. |
empty | Message shown when there are no configurable columns. |
Theme slots change styles; the Vue content slots #actions, #settings and #columnLabel extend content and belong to the toolbar or column settings component. See Toolbar for complete examples.
Theme slots for pagination, the selection alert and the query area
Pagination uses the global theme.pagination.slots. The selection alert and the Schema query area also have their own global theme and per-instance ui.
Pagination
| Slot | Description |
|---|---|
root | Pagination root container. |
layout | Two-region container of a custom pagination layout. |
left | Left region of the pagination layout. |
right | Right region of the pagination layout. |
extension | Container for custom pagination content. |
pages | Container for page numbers and the previous / next navigation buttons. |
item | Page number and navigation buttons. |
active | Extra styles for the current page number. |
jump | Button that skips a group of page numbers. |
jumpEllipsis | Ellipsis in the jump button. |
jumpIcon | Icon shown when the jump button is hovered. |
controls | Area for controls such as page size and quick jump. |
simpleControls | Simple mode controls area. |
simpleInput | Extra styles for the page number input in simple mode. |
slash | Separator between the current page and the total page count. |
go | Quick jump confirm button. |
input | Page number input. |
select | Page size select button. |
popup | Page size dropdown panel. |
option | Page size dropdown option. |
optionActive | Extra styles for the selected page size option. |
total | Total count text. |
icon | Pagination button icon. |
Selection alert
| Slot | Description |
|---|---|
wrapper | Outer container for visibility transitions and height collapse. |
content | Content container including the spacing before the alert. |
root | Visual container of the selection alert. |
info | Container for the selected count or custom #info content. |
text | Default selected count text. |
clear | Clear selection button. |
option | Container for the clear selection and batch action areas. |
actions | Batch action content container. |
Schema query area
| Slot | Description |
|---|---|
root | Schema query area root container. |
fields | QueryFilter grid or LightFilter chip container. |
field | Layout of a single query field. |
label | Field label. |
control | Host control container. |
error | Single-field error. |
actions | Query, reset and collapse action area. |
feedback | Overall error feedback for the query area. |
collapse | Entry point for expanding or collapsing fields. |
Further reading
Type Declarations
ui uses SlotProps<TableThemeConfig>, whose values are optional class strings. The declarations below provide all Table theme slots and variant props; for the complete global override mapping, see the Type reference. The helper parameter type of cn() is not a package export.
Type Declarations
export type TableSlots =
| 'root'
| 'wrapper'
| 'rootAutoHeight'
| 'wrapperAutoHeight'
| 'table'
| 'thead'
| 'tbody'
| 'widthConstraintCell'
| 'widthConstraintInner'
| 'widthLayoutCell'
| 'tr'
| 'groupedHeaderTable'
| 'groupedHeaderTh'
| 'groupedHeaderTd'
| 'th'
| 'td'
| 'empty'
| 'loading'
| 'headerCellInner'
| 'bodyCellEllipsis'
| 'thSortable'
| 'thSorted'
| 'tdSorted'
| 'sortButton'
| 'sortIconDown'
| 'sortAreaOuter'
| 'sortAreaWrapper'
| 'sortAreaTitle'
| 'headerHelp'
| 'cellContent'
| 'copyButton'
| 'cellStatus'
| 'cellTag'
| 'editCell'
| 'editSizer'
| 'editControl'
| 'editError'
| 'editTrigger'
| 'editTriggerValue'
| 'editTriggerIcon'
| 'cellProgress'
| 'cellProgressTrack'
| 'cellProgressBar'
| 'cellProgressText'
| 'filterIconWrapper'
| 'filterIcon'
| 'filterDropdown'
| 'filterDropdownList'
| 'filterDropdownItem'
| 'filterDropdownItemSelected'
| 'filterDropdownItemSelectedSingle'
| 'filterDropdownItemHover'
| 'filterDropdownSwitcher'
| 'filterDropdownSwitcherExpanded'
| 'filterDropdownSwitcherCollapsed'
| 'filterDropdownSwitcherNoop'
| 'filterDropdownContentWrapper'
| 'filterDropdownTreeWrapper'
| 'filterDropdownTreeList'
| 'filterDropdownTreeItem'
| 'filterDropdownTreeContentWrapper'
| 'filterDropdownTreeItemSelected'
| 'filterDropdownTreeItemMatched'
| 'filterDropdownTreeCheckAll'
| 'filterDropdownActions'
| 'filterDropdownResetButton'
| 'filterDropdownConfirmButton'
| 'filterDropdownSearch'
| 'filterDropdownSearchField'
| 'filterDropdownSearchIcon'
| 'filterDropdownSearchInput'
| 'filterDropdownListEmpty'
| 'emptyWrapper'
| 'emptyIcon'
| 'emptyText'
| 'loadingSpinner'
| 'tdSelected'
| 'tdRowHover'
| 'tdRowSelectedHover'
| 'trDragging'
| 'trDropAbove'
| 'trDropBelow'
| 'selectionDropdown'
| 'selectionDropdownItem'
| 'selectionExtra'
| 'title'
| 'footer'
| 'summary'
| 'summaryRow'
| 'summaryCell'
| 'headerWrapper'
| 'bodyWrapper'
| 'fixedCell'
| 'fixedDividerLeft'
| 'fixedDividerRight'
| 'fixedShadowLeft'
| 'fixedShadowRight'
| 'fixedShadowLeftHidden'
| 'fixedShadowRightHidden'
| 'expandIcon'
| 'expandIconExpanded'
| 'expandIconCollapsed'
| 'expandIconSpaced'
| 'expandIconDisabled'
| 'expandIconSymbol'
| 'expandIconSymbolExpanded'
| 'expandIconSymbolCollapsed'
| 'treeExpandIcon'
| 'treeExpandIconExpanded'
| 'treeExpandIconCollapsed'
| 'treeExpandIconSpaced'
| 'treeExpandIconDisabled'
| 'treeExpandIconSymbol'
| 'treeExpandIconLoading'
| 'treeExpandIconError'
| 'treeExpandIconSymbolExpanded'
| 'treeExpandIconSymbolCollapsed'
| 'expandedRow'
| 'expandedRowCell'
| 'resizeHandle'export type TableVariantProps = {
size?: 'large' | 'middle' | 'small'
bordered?: boolean
striped?: boolean
hoverable?: boolean
}// tableTheme 是公开的默认 antdv 主题;typeof 保留 readonly 与字面量 variant 配置。
export type TableThemeConfig = typeof tableThemeexport type ToolbarThemeConfig = typeof toolbarTheme
export type ToolbarSlots = keyof ToolbarThemeConfig['slots']export type ColumnSettingsThemeConfig = typeof columnSettingsTheme
export type ColumnSettingsSlots = keyof ColumnSettingsThemeConfig['slots']export type SlotProps<T extends ThemeConfig> = Partial<Record<keyof T['slots'] & string, string>>// 以下 Theme* 辅助类型用于展开声明,不是包导出。
type ThemeSlotKeys<T extends ThemeConfig> = keyof T['slots'] & string
type ThemeVariantOverrides<T extends ThemeConfig> = {
[TVariant in keyof NonNullable<T['variants']>]?: NonNullable<
T['variants']
>[TVariant] extends Record<string, unknown>
? {
[TValue in keyof NonNullable<T['variants']>[TVariant]]?: NonNullable<
T['variants']
>[TVariant][TValue] extends string
? string
: Partial<Record<ThemeSlotKeys<T>, string>>
}
: never
}
type ThemeDefaultVariantOverrides<T extends ThemeConfig> = {
[TVariant in keyof NonNullable<T['defaultVariants']>]?: NonNullable<
T['defaultVariants']
>[TVariant] extends boolean
? boolean
: string
}
type ThemeCompoundRuleOverride<T, TSlotKey extends string> = T extends string
? string
: T extends boolean
? boolean
: T extends readonly (infer U)[]
? Array<U extends string ? Extract<U, TSlotKey> : ThemeCompoundRuleOverride<U, TSlotKey>>
: T extends object
? {
[K in keyof T]?: K extends 'class'
? string
: K extends 'slots'
? T[K] extends readonly (infer U)[]
? Array<Extract<U, TSlotKey>>
: ThemeCompoundRuleOverride<T[K], TSlotKey>
: ThemeCompoundRuleOverride<T[K], TSlotKey>
}
: T
export type ThemeOverrideConfig<T extends ThemeConfig> = {
slots?: Partial<Record<ThemeSlotKeys<T>, string>>
variants?: ThemeVariantOverrides<T>
defaultVariants?: ThemeDefaultVariantOverrides<T>
compoundVariants?: T extends { compoundVariants?: readonly (infer U)[] }
? Array<ThemeCompoundRuleOverride<U, ThemeSlotKeys<T>>>
: never
compoundSlots?: T extends { compoundSlots?: readonly (infer U)[] }
? Array<ThemeCompoundRuleOverride<U, ThemeSlotKeys<T>>>
: never
}/** 文档说明用辅助类型,不是包导出。对象值按 truthy/falsy 决定是否添加对应 class。 */
type CnClassValue =
| string
| number
| bigint
| boolean
| null
| undefined
| Record<string, unknown>
| CnClassValue[]
export declare const cn: <T extends CnClassValue[]>(...classes: T) => string | undefined