Skip to content

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().

vue
<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.th maps to theme.table.slots.th
  • ui.td maps to theme.table.slots.td
  • hoverable.true.td maps to theme.table.variants.hoverable.true.td
  • size: 'small' maps to theme.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 ​

ts
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:

css
:root {
  --vtg-table-row-hover-bg: #e6f7ff;
}

Option 2: override the tdRowHover slot through the ui prop ​

vue
<VTable :columns="columns" :data-source="data" :ui="{ tdRowHover: 'bg-blue-50' }" />

Option 3: through the global theme ​

ts
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 ​

SlotDescription
rootOutermost table container. Controls font family, font size and line height.
wrapperScroll wrapper around the <table> element.
rootAutoHeightAuto-height layout added on top of root when scroll.y: 'auto' (fills the parent container).
wrapperAutoHeightAuto-height layout added on top of wrapper when scroll.y: 'auto' (takes the remaining height).
tableThe <table> element. Controls background color, text color and border spacing.
theadThe <thead> element.
tbodyThe <tbody> element.
trThe <tr> element. Carries group/row by default so child elements can match on hover.
thHeader cell <th>. Controls background, text color, borders and the split line.
tdData cell <td>. Controls background, text color and borders; hover, selected and striped styles are added through variants.

Header and cell wrappers ​

SlotDescription
headerCellInnerFlex wrapper inside the header cell.
bodyCellEllipsisText truncation layer for the content of ellipsis columns.
headerHelpHeader help icon for a column tooltip.
cellContentWrapper around the content and copy button of copyable columns.
copyButtonCopy button of copyable columns.

Grouped headers ​

SlotDescription
groupedHeaderTableInner <table> in grouped headers.
groupedHeaderThGrouped header <th>.
groupedHeaderTdGrouped header <td>.

Sorting ​

SlotDescription
thSortableExtra styles for the <th> of sortable columns.
thSorted<th> background of the actively sorted column.
tdSorted<td> background of the actively sorted column.
sortButtonSort icon container.
sortIconDownSpacing adjustment for the descending icon.
sortAreaOuterOutermost flex wrapper of the sort area.
sortAreaWrapperFlex wrapper between the title and the sort icon.
sortAreaTitleSort title text container.

Filter icon ​

SlotDescription
filterIconWrapperFilter icon wrapper.
filterIconThe filter trigger icon itself.

Filter dropdown panel ​

SlotDescription
filterDropdownFilter panel root container.
filterDropdownListFilter option list container.
filterDropdownItemA single filter option.
filterDropdownItemSelectedSelected option styles.
filterDropdownItemSelectedSingleExtra styles for the selected option in single-select mode (filterMultiple: false).
filterDropdownItemHoverHovered option styles.
filterDropdownContentWrapperOption content wrapper.
filterDropdownActionsBottom action bar.
filterDropdownResetButtonExtra styles for the bottom "Reset" button.
filterDropdownConfirmButtonExtra styles for the bottom "OK" button.
filterDropdownSearchOuter layer of the search area.
filterDropdownSearchFieldSearch input container.
filterDropdownSearchIconSearch icon.
filterDropdownSearchInputSearch input.
filterDropdownListEmptyEmpty-result message.

Filter tree ​

SlotDescription
filterDropdownSwitcherExpand/collapse button of a tree node.
filterDropdownSwitcherExpandedExpanded state.
filterDropdownSwitcherCollapsedCollapsed state.
filterDropdownSwitcherNoopPlaceholder for nodes that cannot be toggled.
filterDropdownTreeWrapperTree list wrapper.
filterDropdownTreeListTree list <ul>.
filterDropdownTreeItemA single tree node row.
filterDropdownTreeContentWrapperTree node content wrapper.
filterDropdownTreeItemSelectedSelected node styles.
filterDropdownTreeItemMatchedStyles for nodes matched by the search.
filterDropdownTreeCheckAllThe "Select all" row.

Empty state ​

SlotDescription
emptyEmpty state root container.
emptyWrapperEmpty state content wrapper.
emptyIconEmpty state icon area.
emptyTextEmpty state text.

Loading state ​

SlotDescription
loadingLoading mask covering the whole table.
loadingSpinnerLoading icon.

Selected rows ​

SlotDescription
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 ​

SlotDescription
trDraggingThe <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 ​

SlotDescription
selectionDropdownRow selection dropdown panel.
selectionDropdownItemRow selection dropdown item.
selectionExtraExtra trigger icon in the header of the row selection column.
SlotDescription
titleTable title area.
footerTable footer area.
summarySummary container.
summaryRowSummary <tr>.
summaryCellSummary <td>.

Fixed columns and fixed header ​

SlotDescription
headerWrapperHeader scroll wrapper in fixed-header mode.
bodyWrapperBody scroll wrapper in fixed-header mode.
fixedCellFixed column cell.
fixedDividerLeftLeft fixed column divider.
fixedDividerRightRight fixed column divider.
fixedShadowLeftLeft fixed column shadow layer.
fixedShadowRightRight fixed column shadow layer.
fixedShadowLeftHiddenHidden state of the left shadow.
fixedShadowRightHiddenHidden state of the right shadow.

Expandable rows ​

SlotDescription
expandIconBase styles of the expand button.
expandIconExpandedExpanded state.
expandIconCollapsedCollapsed state.
expandIconSpacedPlaceholder for rows that cannot be expanded.
expandIconDisabledDisabled state.
expandIconSymbolSymbol container of the expand icon.
expandIconSymbolExpandedExpanded symbol state.
expandIconSymbolCollapsedCollapsed symbol state.
expandedRowExpanded row <tr>.
expandedRowCellExpanded 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.

SlotDescription
treeExpandIconBase styles of the tree expand button.
treeExpandIconExpandedExpanded state.
treeExpandIconCollapsedCollapsed state.
treeExpandIconSpacedPlaceholder for leaf nodes.
treeExpandIconDisabledDisabled state.
treeExpandIconSymbolTree symbol container.
treeExpandIconSymbolExpandedTree expanded symbol state.
treeExpandIconSymbolCollapsedTree collapsed symbol state.
treeExpandIconLoadingButton state while lazy loading is in progress.
treeExpandIconErrorRetry 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.

SlotDescription
cellStatusvalueEnum status marker, colored by data-status.
cellTagTag appearance for valueType: 'tag' or a renderer with presentation: 'tag'.

Field progress ​

SlotDescription
cellProgressOverall progress width and the gap between the track and the value.
cellProgressTrackTrack height, radius and background.
cellProgressBarFill color; supports data-status states.
cellProgressTextPercentage text or the success / error icon.

Editing controls ​

SlotDescription
editCellContent container of a cell that has entered editing.
editSizerHidden copy of the display content that sizes an editing cell in stable layout.
editControlWidth and error outline of the host control.
editErrorValidation error located by field.
editTriggerInteractive trigger button for click-to-edit cells.
editTriggerValueDisplay text wrapper inside the click-to-edit cell trigger.
editTriggerIconEdit icon wrapper revealed on cell hover or focus.

The query area uses a separate theme.query; see Schema query area.

Column resizing ​

SlotDescription
resizeHandleColumn resize handle.

Column width layout ​

SlotDescription
widthConstraintCellCell used to constrain column widths.
widthConstraintInnerInner element of the column-width constraint cell.
widthLayoutCellCell 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.

VariantValuesDefaultAffected slots
sizesmall / middle / largelarge for antdv, middle for element-plusPadding of th, td, title, footer and summaryCell
borderedtrue / falsefalseBorders of root, th, td, tbody, title, footer and summaryCell
stripedtrue / falsefalseEven-row background of td and the related row-state slots
hoverabletrue / falsetruetdRowHover and tdRowSelectedHover set the hover background of regular and selected rows
loadingtrue / falsefalseWith 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 ​

SlotDescription
rootToolbar root container and responsive layout.
titleTitle area.
rightWrapper around application actions and built-in tools.
actionsContainer for #actions application buttons.
settingsContainer for built-in tools or #settings.
searchToolbar lightweight search container.
searchGroupCombined container for the search input area and the submit button.
searchFieldOuter layer of the search text box.
searchInputSearch text input.
searchSubmitSearch submit button.
searchClearButton that clears the search text.
searchIconSearch and clear icons.
filterContainer for #filter content in the single-row layout.
extraContainer for #extra content, and for #filter content in the multi-row layout.
actionBuilt-in buttons such as refresh and fullscreen.
iconBuilt-in tool icon.
loadingIconRefresh loading animation.

VTableColumnSettings ​

SlotDescription
rootContainer for the density and column settings triggers.
triggerColumn settings button.
densityTriggerDensity button.
popupColumn settings overlay.
densityPopupDensity overlay.
densityDensity menu option.
headerColumn settings panel header.
headingSelect-all heading.
resetReset button.
columnsColumn list.
childrenNested child column list.
itemColumn list item.
rowColumn option row; serves as the drag carrier.
rowDraggingOutline of the source row being dragged.
rowDropAboveInsertion line above the target row.
rowDropBelowInsertion line below the target row.
rowDropDotDot at the left end of the insertion line.
dragHandleDrag handle.
pinActionsPin position button group.
pinActionPin position button.
pinIconPin position icon.
groupContainer for a group of columns divided by pin position.
groupTitlePin position group title.
groupColumnsColumn list within a group.
labelColumn option label.
checkboxControlCheckbox container.
checkboxCheckbox input element.
checkMarkCheck mark.
indeterminateMarkIndeterminate mark.
labelTextColumn option label text.
emptyMessage 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 ​

SlotDescription
rootPagination root container.
layoutTwo-region container of a custom pagination layout.
leftLeft region of the pagination layout.
rightRight region of the pagination layout.
extensionContainer for custom pagination content.
pagesContainer for page numbers and the previous / next navigation buttons.
itemPage number and navigation buttons.
activeExtra styles for the current page number.
jumpButton that skips a group of page numbers.
jumpEllipsisEllipsis in the jump button.
jumpIconIcon shown when the jump button is hovered.
controlsArea for controls such as page size and quick jump.
simpleControlsSimple mode controls area.
simpleInputExtra styles for the page number input in simple mode.
slashSeparator between the current page and the total page count.
goQuick jump confirm button.
inputPage number input.
selectPage size select button.
popupPage size dropdown panel.
optionPage size dropdown option.
optionActiveExtra styles for the selected page size option.
totalTotal count text.
iconPagination button icon.

Selection alert ​

SlotDescription
wrapperOuter container for visibility transitions and height collapse.
contentContent container including the spacing before the alert.
rootVisual container of the selection alert.
infoContainer for the selected count or custom #info content.
textDefault selected count text.
clearClear selection button.
optionContainer for the clear selection and batch action areas.
actionsBatch action content container.

Schema query area ​

SlotDescription
rootSchema query area root container.
fieldsQueryFilter grid or LightFilter chip container.
fieldLayout of a single query field.
labelField label.
controlHost control container.
errorSingle-field error.
actionsQuery, reset and collapse action area.
feedbackOverall error feedback for the query area.
collapseEntry 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
ts
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'
ts
export type TableVariantProps = {
  size?: 'large' | 'middle' | 'small'
  bordered?: boolean
  striped?: boolean
  hoverable?: boolean
}
ts
// tableTheme 是公开的默认 antdv 主题;typeof 保留 readonly 与字面量 variant 配置。
export type TableThemeConfig = typeof tableTheme
ts
export type ToolbarThemeConfig = typeof toolbarTheme
export type ToolbarSlots = keyof ToolbarThemeConfig['slots']
ts
export type ColumnSettingsThemeConfig = typeof columnSettingsTheme
export type ColumnSettingsSlots = keyof ColumnSettingsThemeConfig['slots']
ts
export type SlotProps<T extends ThemeConfig> = Partial<Record<keyof T['slots'] & string, string>>
ts
// 以下 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
}
ts
/** 文档说明用辅助类型,不是包导出。对象值按 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