Skip to content

Table CSS variables ​

If what you want to change are token values such as colors, font sizes, spacing, empty-state dimensions or the loading mask, override CSS variables instead of rewriting slot classes directly.

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

This approach suits:

  • keeping the preset and slot structure and changing only visual tokens
  • sharing one set of visual rules across multiple pages and multiple table instances
  • reducing the maintenance cost of rewritten classes when you upgrade presets in the future

Generally choose in this order:

  1. To change only values such as colors, font sizes and spacing, use CSS variables
  2. To change the class structure of a slot, use the global theme or the per-instance ui
  3. To change the content structure, use Vue slots

The preset values in the tables are for light mode. If dark mode overrides a variable, the page uses the dark value.

Core visual variables ​

VariablePurposeantdvelement-plus
--vtg-table-bgMain table background, used by areas such as table and tdvar(--color-surface)var(--color-surface)
--vtg-table-header-bgBackground of the header, title, footer and summary rowvar(--color-surface-hover)var(--color-surface)
--vtg-table-header-colorHeader text colorvar(--color-on-surface)var(--color-muted)
--vtg-table-text-colorBody text colorvar(--color-on-surface)var(--color-text-regular)
--vtg-table-border-colorTable border and cell dividersvar(--color-default)var(--color-default)
--vtg-table-header-split-colorantdv-style header split linergb(0 0 0 / 6%)not read
--vtg-table-header-sort-hover-bgHover background of sortable headersrgb(0 0 0 / 4%)not read
--vtg-table-header-sort-bgHeader background of the actively sorted column#f0f0f0not read
--vtg-table-body-sort-bgCell background of the actively sorted column#fafafanot read
--color-sorter-iconInactive color of the sort iconrgb(0 0 0 / 29%)#a8abb2
--color-primaryTheme primary color, used for drag handle hover, button highlights, field states and more#1677ff#409eff

Field tag variables ​

valueType: 'tag' and renderers that return presentation: 'tag' use the same tokens. Status colors reuse --vtg-cell-success / warning / error and --color-primary.

VariablePurposeantdvelement-plus
--vtg-cell-tag-radiusTag radius4px4px
--vtg-cell-tag-padding-inlineTag horizontal padding7px9px
--vtg-cell-tag-font-sizeTag font size12px12px
--vtg-cell-tag-line-heightTag line height20px22px
--vtg-cell-tag-bgTag background; mixed from the current status color by defaultcolor-mix(in srgb, currentcolor 8%, var(--vtg-table-bg))color-mix(in srgb, currentcolor 10%, var(--vtg-table-bg))
--vtg-cell-tag-borderTag border colorcolor-mix(in srgb, currentcolor 30%, transparent)color-mix(in srgb, currentcolor 30%, transparent)
--vtg-cell-successField success status color#52c41a#67c23a
--vtg-cell-warningField warning status color#faad14#e6a23c
--vtg-cell-errorField error status color; also used for query and editing validation text#ff4d4f#f56c6c

Row state variables ​

VariablePurposeantdvelement-plus
--vtg-table-row-hover-bgHover background of hoverable rowsvar(--color-surface-hover)var(--color-surface-hover)
--vtg-table-row-striped-bgBackground of striped rowsnot read#fafafa
--vtg-table-row-selected-bgSelected row background#e6f4ffnot read
--vtg-table-row-selected-hover-bgSelected row hover background#bae0ffnot read
--vtg-table-row-drop-indicator-colorColor of the drop indicator line in drag sortingvar(--color-primary)var(--color-primary)
--vtg-table-expanded-row-bgExpanded row content backgroundundeclared, falls back to #fafafaundeclared, falls back to #fafafa

WARNING

--vtg-table-row-striped-bg is read only by the element-plus preset. The default antdv preset hard-codes the striped row background in the slot class (rgba(0, 0, 0, 0.02), matching native antdv), so overriding this variable has no effect. To change striped rows under the antdv preset, override the td slot:

vue
<VTable :striped="true" :ui="{ td: 'group-even/row:bg-slate-50' }" />

Typography and spacing variables ​

VariablePurposeantdvelement-plus
--vtg-table-font-familyTable font familyvar(--font-family-base)var(--font-family-base)
--vtg-table-font-sizeTable font size14px14px
--vtg-table-line-heightTable line height1.571523px
--vtg-table-cell-padding-inline-lgHorizontal padding for the large size16px12px
--vtg-table-cell-padding-block-lgVertical padding for the large size16px12px
--vtg-table-cell-padding-inline-mdHorizontal padding for the middle size8px12px
--vtg-table-cell-padding-block-mdVertical padding for the middle size12px8px
--vtg-table-cell-padding-inline-smHorizontal padding for the small size8px12px
--vtg-table-cell-padding-block-smVertical padding for the small size8px4px

Filter panel variables ​

VariablePurposeantdvelement-plus
--color-filter-iconInactive color of the filter iconvar(--color-sorter-icon)#909399
--vtg-table-filter-dropdown-max-heightMaximum height of the filter panel option area; scrolls internally beyond itundeclared, falls back to 264px280px

Empty and loading state variables ​

VariablePurposeantdvelement-plus
--vtg-table-loading-overlay-bgLoading mask backgroundrgb(255 255 255 / 40%)rgb(255 255 255 / 90%)
--vtg-table-empty-margin-blockEmpty state vertical margin32pxnot read
--vtg-table-empty-image-heightEmpty state image height40pxnot read
--vtg-table-empty-image-margin-bottomGap between the empty state image and text8pxnot read
--vtg-table-empty-image-opacityEmpty state image opacity1not read
--vtg-table-empty-border-colorantdv empty state illustration border color#d9d9d9not read
--vtg-table-empty-shadow-colorantdv empty state illustration shadow color#f0f0f0not read
--vtg-table-empty-content-colorantdv empty state illustration fill color#f5f5f5not read

NOTE

The empty-state illustration variables mainly serve the current built-in empty-state visuals, the antdv preset in particular. If you only care about the empty-state text or layout, changing the empty, emptyWrapper and emptyText slots is usually more direct.

Common scenarios ​

Change the header background and border ​

css
:root {
  --vtg-table-header-bg: #f8fafc;
  --vtg-table-border-color: #e2e8f0;
}

Change the hover and selected states ​

css
:root {
  --vtg-table-row-hover-bg: #eff6ff;
  --vtg-table-row-selected-bg: #dbeafe;
  --vtg-table-row-selected-hover-bg: #bfdbfe;
}

Change compact spacing everywhere ​

css
:root {
  --vtg-table-cell-padding-inline-sm: 10px;
  --vtg-table-cell-padding-block-sm: 6px;
}

How variables, theme and ui divide the work ​

  • To change only token values: prefer CSS variables
  • To change the slot class structure everywhere: use the global theme
  • To change a single table: use ui

Pagination tokens ​

Colors reference semantic tokens and follow dark mode automatically.

VariablePurposeantdvelement-plus
--vtg-pagination-sizeButton height and minimum width at the default size32px32px
--vtg-pagination-size-smButton height and minimum width at the small size24px24px
--vtg-pagination-gapGap between the navigation, controls and custom layout regions8px16px
--vtg-pagination-marginVertical padding of the pagination container16px16px
--vtg-pagination-radiusRadius of buttons and inputs6px2px
--vtg-pagination-input-widthQuick jump input width50px56px
--vtg-pagination-borderDefault border color of page number buttonstransparenttransparent
--vtg-pagination-bgDefault background of page number buttonstransparentvar(--color-surface)
--vtg-pagination-active-bgCurrent page number backgroundvar(--color-surface)var(--color-surface)
--vtg-pagination-active-colorCurrent page number text colorvar(--color-primary)var(--color-primary)
--vtg-pagination-active-borderCurrent page number button border colorvar(--color-primary)transparent
--vtg-pagination-popup-zPage size dropdown panel z-index10502000
--vtg-pagination-popup-radiusPage size dropdown panel radiusvar(--vtg-table-popup-radius)var(--vtg-table-popup-radius)
--vtg-pagination-popup-shadowPage size dropdown panel shadowvar(--vtg-table-popup-shadow)var(--vtg-table-popup-shadow)
--vtg-pagination-font-sizeDefault pagination font sizenot read14px
--vtg-pagination-font-size-smSmall-size pagination font sizenot read12px
--vtg-pagination-page-gapGap between adjacent page numbersnot read0px
--vtg-pagination-control-gapGap between controls such as quick jumpnot read8px
--vtg-pagination-select-widthPage size selector widthnot read128px
--vtg-pagination-select-width-smPage size selector width at the small sizenot read100px

Table popup tokens ​

Filtering, bulk selection, column settings, density and page size share the following appearance variables. The background reuses --color-surface.

VariablePurposeantdvelement-plus
--vtg-table-popup-radiusRadius of table popups such as filtering and batch selection6px2px
--vtg-table-popup-borderTable popup border01px solid var(--vtg-border-color-lighter, var(--color-default))
--vtg-table-popup-padding-blockTable popup vertical padding4px5px
--vtg-table-popup-padding-inlineTable popup horizontal padding4px0px
--vtg-table-popup-shadowTable popup shadow0 6px 16px rgb(0 0 0 / 8%), 0 3px 6px -4px rgb(0 0 0 / 12%), 0 9px 28px 8px rgb(0 0 0 / 5%)0 0 12px rgb(0 0 0 / 12%)
--vtg-table-popup-motion-durationTable popup animation durationundeclared, falls back to 0.15sundeclared, falls back to 0.15s
--vtg-table-popup-motion-easingTable popup animation easing curveundeclared, falls back to cubic-bezier(0.645, 0.045, 0.355, 1)undeclared, falls back to cubic-bezier(0.645, 0.045, 0.355, 1)

Toolbar and column settings tokens ​

Both presets support the variables below. Colors, the font family, the body font size and checkboxes reuse the existing semantic and component tokens, and can be adjusted together with theme.toolbar.slots, theme.columnSettings.slots or the per-instance ui.

VariablePurposeantdvelement-plus
--vtg-toolbar-title-font-sizeToolbar title font size16px16px
--vtg-toolbar-title-font-weightToolbar title font weight500500
--vtg-toolbar-search-widthToolbar lightweight search width240px240px
--vtg-toolbar-search-heightToolbar lightweight search height32px32px
--vtg-toolbar-search-font-sizeToolbar lightweight search font size14px14px
--vtg-column-settings-widthColumn settings panel width224px280px
--vtg-column-settings-radiusRadius of the column settings and density overlaysvar(--vtg-table-popup-radius)var(--vtg-table-popup-radius)
--vtg-column-settings-icon-sizeIcon size of the toolbar and column settings16px16px
--vtg-column-settings-zz-index of the column settings and density overlays10502000
--vtg-column-settings-shadowOverlay shadowvar(--vtg-table-popup-shadow)var(--vtg-table-popup-shadow)
--vtg-column-settings-pin-icon-sizeIcon size of the pin position buttonsundeclared, falls back to 14pxundeclared, falls back to 14px

Application buttons such as export and create are provided by your project's UI library and use that library's style configuration. The toolbar is responsible for the layout of the button area; see Toolbar for usage.

Editor controls ​

VariablePurposeantdvelement-plus
--vtg-editor-inset-blockMinimum gap between the control and the row edges in stable layout2px2px
--vtg-editor-inset-inlineMinimum gap between a control that grows into the cell padding and the cell edges in stable layout2px2px
--vtg-editor-min-inline-sizePreferred minimum control width in stable layout; a narrower control grows into the inline cell padding64px64px
--vtg-editor-error-gapGap between the control and the error text2px2px
--vtg-editor-error-font-sizeError font size14px12px
--vtg-editor-radiusOutline radius of the editing controlnot read4px

Schema query area ​

Query variables control grid spacing, label width, action spacing, and LightFilter chips and popups. See Schema query for usage.

VariablePurposeantdvelement-plus
--vtg-query-paddingPadding of the regular query areaundeclared, falls back to 24pxundeclared, falls back to 24px
--vtg-query-light-paddingPadding of the lightweight query areaundeclared, falls back to 16pxundeclared, falls back to 16px
--vtg-query-column-gapHorizontal gap between fieldsundeclared, falls back to 24pxundeclared, falls back to 24px
--vtg-query-row-gapVertical gap between fieldsundeclared, falls back to 24pxundeclared, falls back to 24px
--vtg-query-label-widthField label widthundeclared, falls back to 80pxundeclared, falls back to 80px
--vtg-query-label-gapGap between the field label and the controlundeclared, falls back to 12pxundeclared, falls back to 12px
--vtg-query-control-heightAlignment height of labels and the action areaundeclared, falls back to 32pxundeclared, falls back to 32px
--vtg-query-vertical-label-gapGap between the label and control in a vertical formundeclared, falls back to 4pxundeclared, falls back to 4px
--vtg-query-split-colorRow separator color in a vertical formundeclared, falls back to var(--vtg-table-border-color)undeclared, falls back to var(--vtg-table-border-color)
--vtg-query-light-control-widthWidth of regular controls in a LightFilter popupundeclared, falls back to 200pxundeclared, falls back to 200px
--vtg-query-light-range-widthWidth of date range controls in a LightFilter popupundeclared, falls back to 320pxundeclared, falls back to 320px
--vtg-query-light-gapGap between filter chipsundeclared, falls back to 8pxundeclared, falls back to 8px
--vtg-query-light-borderFilter chip border colorundeclared, falls back to transparentundeclared, falls back to transparent
--vtg-query-light-radiusFilter chip radiusundeclared, falls back to var(--vtg-btn-border-radius)undeclared, falls back to var(--vtg-btn-border-radius)
--vtg-query-light-bgFilter chip backgroundundeclared, falls back to transparentundeclared, falls back to transparent
--vtg-query-light-hover-borderHovered filter chip border colorundeclared, falls back to var(--color-primary)undeclared, falls back to var(--color-primary)
--vtg-query-light-hover-bgHovered filter chip backgroundundeclared, falls back to var(--color-text-hover-bg)undeclared, falls back to var(--color-text-hover-bg)
--vtg-query-light-active-bgActive filter chip backgroundundeclared, falls back to var(--vtg-table-row-selected-bg)undeclared, falls back to var(--vtg-table-row-selected-bg)
--vtg-query-light-active-colorActive filter chip text colorundeclared, falls back to var(--color-primary)undeclared, falls back to var(--color-primary)
--vtg-query-light-heightMinimum filter chip heightundeclared, falls back to var(--vtg-query-control-height, 32px)undeclared, falls back to var(--vtg-query-control-height, 32px)
--vtg-query-light-trigger-paddingHorizontal filter button paddingundeclared, falls back to 8pxundeclared, falls back to 8px
--vtg-query-light-summary-widthMaximum filter summary widthundeclared, falls back to 244pxundeclared, falls back to 244px
--vtg-query-light-icon-gapGap between filter text and iconundeclared, falls back to 6pxundeclared, falls back to 6px
--vtg-query-light-icon-sizeFilter icon font sizeundeclared, falls back to 10pxundeclared, falls back to 10px
--vtg-query-light-collapse-icon-sizeIcon size of the combined filter triggerundeclared, falls back to 14pxundeclared, falls back to 14px
--vtg-query-light-popup-paddingFilter popup paddingundeclared, falls back to 12pxundeclared, falls back to 12px
--vtg-query-light-popup-gapFilter popup fields and actions spacingundeclared, falls back to 12pxundeclared, falls back to 12px
--vtg-query-light-label-gapGap between label and control in a filter popupundeclared, falls back to 4pxundeclared, falls back to 4px
--vtg-query-action-gapGap between action buttonsundeclared, falls back to 8pxundeclared, falls back to 8px
--vtg-query-radiusQuery area container radiusundeclared, falls back to 6pxundeclared, falls back to 4px
--vtg-query-error-font-sizeFont size of query area error textundeclared, falls back to 12pxundeclared, falls back to 12px

Selection alert ​

VariablePurposeantdvelement-plus
--vtg-selection-alert-radiusSelection alert radius6px4px
--vtg-selection-alert-bgSelection alert backgroundrgb(0 0 0 / 2%)#fafafa
--vtg-selection-alert-padding-inlineSelection alert horizontal padding24px24px
--vtg-selection-alert-padding-blockSelection alert vertical padding8px8px
--vtg-selection-alert-motion-durationTransition duration of the alert height and opacity; set to 0s to disable transitionsundeclared, falls back to 180msundeclared, falls back to 180ms
--vtg-selection-alert-motion-easingEasing curve of the alert visibility transitionundeclared, falls back to cubic-bezier(0.645, 0.045, 0.355, 1)undeclared, falls back to cubic-bezier(0.645, 0.045, 0.355, 1)
--vtg-selection-alert-spacing-beforeSpacing before the alert, included in its expanded and collapsed heightundeclared, falls back to 0undeclared, falls back to 0

Field progress ​

VariablePurposeantdvelement-plus
--vtg-cell-progress-min-widthMinimum width of the progress component100px100px
--vtg-cell-progress-max-widthMaximum width of the progress component320px320px
--vtg-cell-progress-heightTrack height6px6px
--vtg-cell-progress-radiusTrack radius100px100px
--vtg-cell-progress-gapGap between the track and the text8px8px
--vtg-cell-progress-font-sizeProgress text font size12px12px
--vtg-cell-progress-trailTrack backgroundcolor-mix(in srgb, var(--color-on-surface) 6%, transparent)var(--color-default)

The fill color reuses --color-primary and the cell status color variables; the success / error icons follow the status colors.