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.
: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
Recommended priority
Generally choose in this order:
- To change only values such as colors, font sizes and spacing, use CSS variables
- To change the class structure of a slot, use the global
themeor the per-instanceui - 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
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-table-bg | Main table background, used by areas such as table and td | var(--color-surface) | var(--color-surface) |
--vtg-table-header-bg | Background of the header, title, footer and summary row | var(--color-surface-hover) | var(--color-surface) |
--vtg-table-header-color | Header text color | var(--color-on-surface) | var(--color-muted) |
--vtg-table-text-color | Body text color | var(--color-on-surface) | var(--color-text-regular) |
--vtg-table-border-color | Table border and cell dividers | var(--color-default) | var(--color-default) |
--vtg-table-header-split-color | antdv-style header split line | rgb(0 0 0 / 6%) | not read |
--vtg-table-header-sort-hover-bg | Hover background of sortable headers | rgb(0 0 0 / 4%) | not read |
--vtg-table-header-sort-bg | Header background of the actively sorted column | #f0f0f0 | not read |
--vtg-table-body-sort-bg | Cell background of the actively sorted column | #fafafa | not read |
--color-sorter-icon | Inactive color of the sort icon | rgb(0 0 0 / 29%) | #a8abb2 |
--color-primary | Theme 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.
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-cell-tag-radius | Tag radius | 4px | 4px |
--vtg-cell-tag-padding-inline | Tag horizontal padding | 7px | 9px |
--vtg-cell-tag-font-size | Tag font size | 12px | 12px |
--vtg-cell-tag-line-height | Tag line height | 20px | 22px |
--vtg-cell-tag-bg | Tag background; mixed from the current status color by default | color-mix(in srgb, currentcolor 8%, var(--vtg-table-bg)) | color-mix(in srgb, currentcolor 10%, var(--vtg-table-bg)) |
--vtg-cell-tag-border | Tag border color | color-mix(in srgb, currentcolor 30%, transparent) | color-mix(in srgb, currentcolor 30%, transparent) |
--vtg-cell-success | Field success status color | #52c41a | #67c23a |
--vtg-cell-warning | Field warning status color | #faad14 | #e6a23c |
--vtg-cell-error | Field error status color; also used for query and editing validation text | #ff4d4f | #f56c6c |
Row state variables
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-table-row-hover-bg | Hover background of hoverable rows | var(--color-surface-hover) | var(--color-surface-hover) |
--vtg-table-row-striped-bg | Background of striped rows | not read | #fafafa |
--vtg-table-row-selected-bg | Selected row background | #e6f4ff | not read |
--vtg-table-row-selected-hover-bg | Selected row hover background | #bae0ff | not read |
--vtg-table-row-drop-indicator-color | Color of the drop indicator line in drag sorting | var(--color-primary) | var(--color-primary) |
--vtg-table-expanded-row-bg | Expanded row content background | undeclared, falls back to #fafafa | undeclared, 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:
<VTable :striped="true" :ui="{ td: 'group-even/row:bg-slate-50' }" />Typography and spacing variables
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-table-font-family | Table font family | var(--font-family-base) | var(--font-family-base) |
--vtg-table-font-size | Table font size | 14px | 14px |
--vtg-table-line-height | Table line height | 1.5715 | 23px |
--vtg-table-cell-padding-inline-lg | Horizontal padding for the large size | 16px | 12px |
--vtg-table-cell-padding-block-lg | Vertical padding for the large size | 16px | 12px |
--vtg-table-cell-padding-inline-md | Horizontal padding for the middle size | 8px | 12px |
--vtg-table-cell-padding-block-md | Vertical padding for the middle size | 12px | 8px |
--vtg-table-cell-padding-inline-sm | Horizontal padding for the small size | 8px | 12px |
--vtg-table-cell-padding-block-sm | Vertical padding for the small size | 8px | 4px |
Filter panel variables
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--color-filter-icon | Inactive color of the filter icon | var(--color-sorter-icon) | #909399 |
--vtg-table-filter-dropdown-max-height | Maximum height of the filter panel option area; scrolls internally beyond it | undeclared, falls back to 264px | 280px |
Empty and loading state variables
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-table-loading-overlay-bg | Loading mask background | rgb(255 255 255 / 40%) | rgb(255 255 255 / 90%) |
--vtg-table-empty-margin-block | Empty state vertical margin | 32px | not read |
--vtg-table-empty-image-height | Empty state image height | 40px | not read |
--vtg-table-empty-image-margin-bottom | Gap between the empty state image and text | 8px | not read |
--vtg-table-empty-image-opacity | Empty state image opacity | 1 | not read |
--vtg-table-empty-border-color | antdv empty state illustration border color | #d9d9d9 | not read |
--vtg-table-empty-shadow-color | antdv empty state illustration shadow color | #f0f0f0 | not read |
--vtg-table-empty-content-color | antdv empty state illustration fill color | #f5f5f5 | not 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
:root {
--vtg-table-header-bg: #f8fafc;
--vtg-table-border-color: #e2e8f0;
}Change the hover and selected states
:root {
--vtg-table-row-hover-bg: #eff6ff;
--vtg-table-row-selected-bg: #dbeafe;
--vtg-table-row-selected-hover-bg: #bfdbfe;
}Change compact spacing everywhere
: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.
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-pagination-size | Button height and minimum width at the default size | 32px | 32px |
--vtg-pagination-size-sm | Button height and minimum width at the small size | 24px | 24px |
--vtg-pagination-gap | Gap between the navigation, controls and custom layout regions | 8px | 16px |
--vtg-pagination-margin | Vertical padding of the pagination container | 16px | 16px |
--vtg-pagination-radius | Radius of buttons and inputs | 6px | 2px |
--vtg-pagination-input-width | Quick jump input width | 50px | 56px |
--vtg-pagination-border | Default border color of page number buttons | transparent | transparent |
--vtg-pagination-bg | Default background of page number buttons | transparent | var(--color-surface) |
--vtg-pagination-active-bg | Current page number background | var(--color-surface) | var(--color-surface) |
--vtg-pagination-active-color | Current page number text color | var(--color-primary) | var(--color-primary) |
--vtg-pagination-active-border | Current page number button border color | var(--color-primary) | transparent |
--vtg-pagination-popup-z | Page size dropdown panel z-index | 1050 | 2000 |
--vtg-pagination-popup-radius | Page size dropdown panel radius | var(--vtg-table-popup-radius) | var(--vtg-table-popup-radius) |
--vtg-pagination-popup-shadow | Page size dropdown panel shadow | var(--vtg-table-popup-shadow) | var(--vtg-table-popup-shadow) |
--vtg-pagination-font-size | Default pagination font size | not read | 14px |
--vtg-pagination-font-size-sm | Small-size pagination font size | not read | 12px |
--vtg-pagination-page-gap | Gap between adjacent page numbers | not read | 0px |
--vtg-pagination-control-gap | Gap between controls such as quick jump | not read | 8px |
--vtg-pagination-select-width | Page size selector width | not read | 128px |
--vtg-pagination-select-width-sm | Page size selector width at the small size | not read | 100px |
Table popup tokens
Filtering, bulk selection, column settings, density and page size share the following appearance variables. The background reuses --color-surface.
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-table-popup-radius | Radius of table popups such as filtering and batch selection | 6px | 2px |
--vtg-table-popup-border | Table popup border | 0 | 1px solid var(--vtg-border-color-lighter, var(--color-default)) |
--vtg-table-popup-padding-block | Table popup vertical padding | 4px | 5px |
--vtg-table-popup-padding-inline | Table popup horizontal padding | 4px | 0px |
--vtg-table-popup-shadow | Table popup shadow | 0 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-duration | Table popup animation duration | undeclared, falls back to 0.15s | undeclared, falls back to 0.15s |
--vtg-table-popup-motion-easing | Table popup animation easing curve | undeclared, 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.
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-toolbar-title-font-size | Toolbar title font size | 16px | 16px |
--vtg-toolbar-title-font-weight | Toolbar title font weight | 500 | 500 |
--vtg-toolbar-search-width | Toolbar lightweight search width | 240px | 240px |
--vtg-toolbar-search-height | Toolbar lightweight search height | 32px | 32px |
--vtg-toolbar-search-font-size | Toolbar lightweight search font size | 14px | 14px |
--vtg-column-settings-width | Column settings panel width | 224px | 280px |
--vtg-column-settings-radius | Radius of the column settings and density overlays | var(--vtg-table-popup-radius) | var(--vtg-table-popup-radius) |
--vtg-column-settings-icon-size | Icon size of the toolbar and column settings | 16px | 16px |
--vtg-column-settings-z | z-index of the column settings and density overlays | 1050 | 2000 |
--vtg-column-settings-shadow | Overlay shadow | var(--vtg-table-popup-shadow) | var(--vtg-table-popup-shadow) |
--vtg-column-settings-pin-icon-size | Icon size of the pin position buttons | undeclared, falls back to 14px | undeclared, 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
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-editor-inset-block | Minimum gap between the control and the row edges in stable layout | 2px | 2px |
--vtg-editor-inset-inline | Minimum gap between a control that grows into the cell padding and the cell edges in stable layout | 2px | 2px |
--vtg-editor-min-inline-size | Preferred minimum control width in stable layout; a narrower control grows into the inline cell padding | 64px | 64px |
--vtg-editor-error-gap | Gap between the control and the error text | 2px | 2px |
--vtg-editor-error-font-size | Error font size | 14px | 12px |
--vtg-editor-radius | Outline radius of the editing control | not read | 4px |
Schema query area
Query variables control grid spacing, label width, action spacing, and LightFilter chips and popups. See Schema query for usage.
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-query-padding | Padding of the regular query area | undeclared, falls back to 24px | undeclared, falls back to 24px |
--vtg-query-light-padding | Padding of the lightweight query area | undeclared, falls back to 16px | undeclared, falls back to 16px |
--vtg-query-column-gap | Horizontal gap between fields | undeclared, falls back to 24px | undeclared, falls back to 24px |
--vtg-query-row-gap | Vertical gap between fields | undeclared, falls back to 24px | undeclared, falls back to 24px |
--vtg-query-label-width | Field label width | undeclared, falls back to 80px | undeclared, falls back to 80px |
--vtg-query-label-gap | Gap between the field label and the control | undeclared, falls back to 12px | undeclared, falls back to 12px |
--vtg-query-control-height | Alignment height of labels and the action area | undeclared, falls back to 32px | undeclared, falls back to 32px |
--vtg-query-vertical-label-gap | Gap between the label and control in a vertical form | undeclared, falls back to 4px | undeclared, falls back to 4px |
--vtg-query-split-color | Row separator color in a vertical form | undeclared, falls back to var(--vtg-table-border-color) | undeclared, falls back to var(--vtg-table-border-color) |
--vtg-query-light-control-width | Width of regular controls in a LightFilter popup | undeclared, falls back to 200px | undeclared, falls back to 200px |
--vtg-query-light-range-width | Width of date range controls in a LightFilter popup | undeclared, falls back to 320px | undeclared, falls back to 320px |
--vtg-query-light-gap | Gap between filter chips | undeclared, falls back to 8px | undeclared, falls back to 8px |
--vtg-query-light-border | Filter chip border color | undeclared, falls back to transparent | undeclared, falls back to transparent |
--vtg-query-light-radius | Filter chip radius | undeclared, falls back to var(--vtg-btn-border-radius) | undeclared, falls back to var(--vtg-btn-border-radius) |
--vtg-query-light-bg | Filter chip background | undeclared, falls back to transparent | undeclared, falls back to transparent |
--vtg-query-light-hover-border | Hovered filter chip border color | undeclared, falls back to var(--color-primary) | undeclared, falls back to var(--color-primary) |
--vtg-query-light-hover-bg | Hovered filter chip background | undeclared, falls back to var(--color-text-hover-bg) | undeclared, falls back to var(--color-text-hover-bg) |
--vtg-query-light-active-bg | Active filter chip background | undeclared, falls back to var(--vtg-table-row-selected-bg) | undeclared, falls back to var(--vtg-table-row-selected-bg) |
--vtg-query-light-active-color | Active filter chip text color | undeclared, falls back to var(--color-primary) | undeclared, falls back to var(--color-primary) |
--vtg-query-light-height | Minimum filter chip height | undeclared, falls back to var(--vtg-query-control-height, 32px) | undeclared, falls back to var(--vtg-query-control-height, 32px) |
--vtg-query-light-trigger-padding | Horizontal filter button padding | undeclared, falls back to 8px | undeclared, falls back to 8px |
--vtg-query-light-summary-width | Maximum filter summary width | undeclared, falls back to 244px | undeclared, falls back to 244px |
--vtg-query-light-icon-gap | Gap between filter text and icon | undeclared, falls back to 6px | undeclared, falls back to 6px |
--vtg-query-light-icon-size | Filter icon font size | undeclared, falls back to 10px | undeclared, falls back to 10px |
--vtg-query-light-collapse-icon-size | Icon size of the combined filter trigger | undeclared, falls back to 14px | undeclared, falls back to 14px |
--vtg-query-light-popup-padding | Filter popup padding | undeclared, falls back to 12px | undeclared, falls back to 12px |
--vtg-query-light-popup-gap | Filter popup fields and actions spacing | undeclared, falls back to 12px | undeclared, falls back to 12px |
--vtg-query-light-label-gap | Gap between label and control in a filter popup | undeclared, falls back to 4px | undeclared, falls back to 4px |
--vtg-query-action-gap | Gap between action buttons | undeclared, falls back to 8px | undeclared, falls back to 8px |
--vtg-query-radius | Query area container radius | undeclared, falls back to 6px | undeclared, falls back to 4px |
--vtg-query-error-font-size | Font size of query area error text | undeclared, falls back to 12px | undeclared, falls back to 12px |
Selection alert
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-selection-alert-radius | Selection alert radius | 6px | 4px |
--vtg-selection-alert-bg | Selection alert background | rgb(0 0 0 / 2%) | #fafafa |
--vtg-selection-alert-padding-inline | Selection alert horizontal padding | 24px | 24px |
--vtg-selection-alert-padding-block | Selection alert vertical padding | 8px | 8px |
--vtg-selection-alert-motion-duration | Transition duration of the alert height and opacity; set to 0s to disable transitions | undeclared, falls back to 180ms | undeclared, falls back to 180ms |
--vtg-selection-alert-motion-easing | Easing curve of the alert visibility transition | undeclared, 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-before | Spacing before the alert, included in its expanded and collapsed height | undeclared, falls back to 0 | undeclared, falls back to 0 |
Field progress
| Variable | Purpose | antdv | element-plus |
|---|---|---|---|
--vtg-cell-progress-min-width | Minimum width of the progress component | 100px | 100px |
--vtg-cell-progress-max-width | Maximum width of the progress component | 320px | 320px |
--vtg-cell-progress-height | Track height | 6px | 6px |
--vtg-cell-progress-radius | Track radius | 100px | 100px |
--vtg-cell-progress-gap | Gap between the track and the text | 8px | 8px |
--vtg-cell-progress-font-size | Progress text font size | 12px | 12px |
--vtg-cell-progress-trail | Track background | color-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.