Skip to content

Toolbar ​

VTableToolbar provides a title, an application action area and common tools. Its layout follows React ProTable, and it supports the Ant Design Vue and Element Plus presets. Put it in the title slot of VTable to use it.

Reload, density and column settings are provided by default; fullscreen is opt-in. Application capabilities such as export, create and batch actions are added through slots, and can use buttons from the UI library your project already has installed.

Adding an export button ​

The "Export CSV" button below comes from #actions and is displayed side by side with the built-in tools. The example reads data from the title slot and the toolbar's controlled column configuration, and exports only the visible fields of the currently displayed data; after column settings, pagination or filtering change, the application can choose to export the current page, all data or the selected records.

Edit in Playground

The component does not make data requests or convert export files. You can replace the export function in the example with Excel, PDF or a server-side export job; the button's permissions, confirmation and progress are up to the application.

Search, filtering and view switching ​

search enables a combined keyword input with a search icon button on its right, 32px high by default. When you only care about the submitted result, listening to search is enough: pressing Enter, clicking the search button or clicking the clear icon all trigger it, with the submitted keyword as the argument, which is an empty string on clear.

vue
<VTableToolbar search @search="keyword = $event" />

The input draft is held by the component by default, and input changes do not submit or reload automatically. When you need to read or modify the draft from outside (for example a "Reset" button that also clears the input), take it over with v-model:search-value; the input then always displays the value passed in.

The clear icon triggers update:searchValue(''), clearSearch and search('') in that order. Handle the request for an empty keyword in search; clearSearch only serves to tell the "clear" action apart, so do not send the request again in both events.

#filter holds the filter controls your application already has; by default it shares a row with the action buttons, and multipleLine moves it to a second row. #extra always takes a full row of its own and can combine Tabs, a selection alert or other application content. Whether the state, page number and selection reset when the view switches is up to the application.

Edit in Playground

#search can replace the built-in search control entirely. It shares searchValue, updateSearchValue(value), submitSearch(value?) and clearSearch() with the other toolbar slots, and the draft can likewise be left unbound. During loading the search draft can still be modified while submitting and clearing are temporarily disabled; disabled disables both the input and the actions. Submitting with Enter skips the IME composition state.

vue
<VTableToolbar @search="submitQuery">
  <template #search="{ searchValue, updateSearchValue, submitSearch, disabled }">
    <a-input-search
      :value="searchValue"
      :disabled="disabled"
      @update:value="updateSearchValue"
      @search="submitSearch"
    />
  </template>
</VTableToolbar>

Toggling and replacing ​

Hide an individual built-in tool through options; false turns off all built-in tools. #actions and #settings are kept, so application buttons can be used on their own.

vue
<VTableToolbar
  v-model:columns="columns"
  v-model:size="size"
  title="Orders"
  :options="{ reload: false, density: false }"
>
  <template #actions="{ disabled }">
    <a-button :disabled="disabled" @click="exportOrders">Export Excel</a-button>
    <a-button type="primary" :disabled="disabled" @click="createOrder">New order</a-button>
  </template>
</VTableToolbar>

#title customizes the title area. #settings replaces the built-in tools area entirely, which suits custom icons, action order or menus; the slot params provide the reload and toggleFullscreen methods and the current state.

vue
<VTableToolbar title="Orders" :loading="loading" @reload="loadOrders">
  <template #title><strong>Orders</strong><a-tag>This month</a-tag></template>
  <template #settings="{ reload, loading, disabled }">
    <a-button :loading="loading" :disabled="disabled" @click="reload">Reload</a-button>
  </template>
</VTableToolbar>

State ​

  • columns and size are shared with the table and accept updates through v-model. Without columns, column settings are hidden; without size, the default density of the table theme is read.
  • Reload only triggers reload. The application sets loading during the request; the reload button shows a loading state and prevents repeated clicks, while density and column settings remain usable.
  • disabled disables the built-in actions. Custom buttons read disabled and loading from the slot params and decide their own disabling rules.

Fullscreen ​

When the toolbar is placed in the title or footer slot of VTable, enabling options.fullScreen is all it takes, and the whole table (including the title and pagination) enters browser fullscreen:

vue
<VTable :columns="columns" :data-source="rows">
  <template #title>
    <VTableToolbar :options="{ fullScreen: true }" />
  </template>
</VTable>

When content outside the table, such as a query form, needs to go fullscreen together with it, or the toolbar is not inside a table slot, specify an element with fullscreenTarget; it takes precedence over the containing table:

vue
<div ref="page">
  <QueryForm />
  <VTableToolbar :options="{ fullScreen: true }" :fullscreen-target="() => page" />
  <VTable :columns="columns" :data-source="rows" />
</div>
  • A fullscreen table uses --vtg-table-bg as its background and scrolls when the content exceeds the screen. The background, padding and scrolling of a custom target are set by the application through :fullscreen.
  • The button is disabled when there is no usable target or the browser does not support fullscreen; when the toolbar is neither inside a table nor given a fullscreenTarget, a warning is issued in development.
  • fullscreenChange fires after the browser confirms the change, and exiting with Escape is synced too; fullscreenError fires when the request is rejected.
  • In fullscreen, the filter menu, column settings, page size menu and tooltips are mounted inside the fullscreen element by default. When you customize the container through getPopupContainer, it should return a descendant of the fullscreen element.

API ​

TRecord is the application row type.

Props ​

PropTypeDefaultDescription
titleVNodeChild-Title; the #title slot can be used instead.
columnsTableColumnsType<TRecord>-Controlled column config shared with the table; use with v-model:columns. Column settings are hidden when omitted.
size'large' | 'middle' | 'small'follows table themeDensity shared with the table; use with v-model:size.
optionsfalse | TableToolbarOptions-Built-in tool switches; see the options. false turns off all built-in tools.
loadingbooleanfalseLoading state of the reload button; reload, search submission and clearing are disabled meanwhile.
searchboolean | TableToolbarSearchConfigfalseEnable the built-in search; see the options.
searchValuestring-Search input draft. Controlled when passed, use with v-model:search-value; held by the component when omitted.
multipleLinebooleanfalseMove the filter slot to its own row.
disabledbooleanfalseDisable built-in actions and pass the disabled state to slots.
fullscreenTarget() => HTMLElement | null | undefinedenclosing tableElement that enters full screen; defaults to the root element of the enclosing table. Pass it when the toolbar is outside the table's title / footer slots, or when content outside the table should be included.
columnSettingsobject-Config for the embedded column settings panel; see the options.
localeobject-Per-instance text overrides; fields are listed in Themes and locales.
uiobject-Per-instance slot class overrides; available slots are listed in ui slots.
classstring-Class for the root element.

options ​

Switches for the built-in tools. fixed and draggable are passed to the column settings panel.

FieldTypeDefaultDescription
reloadbooleantrueShow the reload button.
densitybooleantrueShow the density switch.
settingbooleantrueShow the column settings entry; hidden when columns is not passed.
fixedbooleantruePin buttons in the column settings panel.
draggablebooleantrueDrag reordering in the column settings panel.
fullScreenbooleanfalseShow the full screen button. For the full screen target, see fullscreenTarget.

The configuration fields when search is an object; passing true uses the defaults.

FieldTypeDefaultDescription
placeholderstringfollows localePlaceholder and accessible name of the input; defaults to searchPlaceholder from the locale.
clearablebooleantrueShow the clear icon when the input has content.

columnSettings ​

The configuration passed to the embedded column settings panel; the fields mean the same as the props of the same name on VTableColumnSettings.

FieldTypeDefaultDescription
localeobject-Text overrides for the column settings panel.
uiobject-Slot class overrides for the column settings panel; available slots are listed in ui slots.
classstring-Class for the container of the column settings triggers.
getPopupContainer(trigger: HTMLElement) => HTMLElement-Mount container for the density menu and the column settings panel, document.body by default. In browser full screen they mount inside the full screen element by default; a custom function should return one of its descendants.

Events ​

EventPayloadDescription
update:columns(columns: TableColumnsType<TRecord>) => voidColumn visibility, pinning or order changed.
update:size(size: 'large' | 'middle' | 'small') => voidDensity changed.
reset() => void"Reset" was clicked in the column settings panel; only the initial column visibility is restored.
reload() => voidReload was clicked. The component does not issue a request.
update:searchValue(value: string) => voidThe search input draft changed; this is not a submission.
search(value: string) => voidSearch submitted by pressing Enter or clicking the search button or the clear icon. value is an empty string when clearing.
clearSearch() => voidThe clear icon was clicked; search is emitted next with an empty string.
fullscreenChange(active: boolean) => voidEmitted after the browser confirms entering or leaving full screen, including leaving with Escape.
fullscreenError(error: unknown) => voidThe browser rejected the full screen request.

Slots ​

SlotPayload typeDescription
titleTableToolbarSlotProps<TRecord>Custom title area.
actionsTableToolbarSlotProps<TRecord>Application action buttons, next to the built-in tools.
settingsTableToolbarSlotProps<TRecord>Replaces the built-in tools area entirely.
searchTableToolbarSlotProps<TRecord>Replaces the built-in search control.
filterTableToolbarSlotProps<TRecord>Filter controls; on the same row as the actions by default, on their own row with multipleLine.
extraTableToolbarSlotProps<TRecord>Extra content on a full row of its own.
columnLabel{ column: ColumnType<TRecord> | ColumnGroupType<TRecord> }Custom column labels in the column settings panel.

Slot Props ​

Every slot except columnLabel receives TableToolbarSlotProps<TRecord>.

FieldTypeDescription
columnsTableColumnsType<TRecord>Current column config; an empty array when columns is not passed.
size'large' | 'middle' | 'small'Current density.
loadingbooleanCurrent loading state.
disabledbooleanCurrent disabled state.
fullscreenbooleanWhether the full screen target is in full screen.
fullscreenAvailablebooleanA full screen target exists and the browser supports full screen.
reload() => voidEmits the reload event; does nothing while disabled or loading.
toggleFullscreen() => Promise<void>Enter or leave full screen.
searchValuestringCurrent search draft.
updateSearchValue(value: string) => voidUpdate the search draft.
submitSearch(value?: string) => voidSubmit the search; uses the current draft when no argument is passed.
clearSearch() => voidClear the draft and submit an empty keyword.

Themes and locales ​

The toolbar uses the global theme.toolbar.slots or the per-instance ui; the embedded column settings are overridden through theme.columnSettings.slots or columnSettings.ui.

Toolbar text follows the global locale and supports localeOverrides.toolbar and the per-instance locale. Column settings text is still controlled by columnSettings.locale or localeOverrides.columnSettings.

The theme code lists the default classes of the toolbar and of the column settings panel separately.

ui slots ​

Theme configSlotDescription
theme.toolbarrootToolbar root container and responsive layout.
theme.toolbartitleTitle area.
theme.toolbarrightWrapper around application actions and built-in tools.
theme.toolbaractionsContainer for #actions application buttons.
theme.toolbarsettingsContainer for built-in tools or #settings.
theme.toolbarsearchToolbar lightweight search container.
theme.toolbarsearchGroupCombined container for the search input area and the submit button.
theme.toolbarsearchFieldOuter layer of the search text box.
theme.toolbarsearchInputSearch text input.
theme.toolbarsearchSubmitSearch submit button.
theme.toolbarsearchClearButton that clears the search text.
theme.toolbarsearchIconSearch and clear icons.
theme.toolbarfilterContainer for #filter content in the single-row layout.
theme.toolbarextraContainer for #extra content, and for #filter content in the multi-row layout.
theme.toolbaractionBuilt-in buttons such as refresh and fullscreen.
theme.toolbariconBuilt-in tool icon.
theme.toolbarloadingIconRefresh loading animation.
theme.columnSettingsrootContainer for the density and column settings triggers.
theme.columnSettingstriggerColumn settings button.
theme.columnSettingsdensityTriggerDensity button.
theme.columnSettingspopupColumn settings overlay.
theme.columnSettingsdensityPopupDensity overlay.
theme.columnSettingsdensityDensity menu option.
theme.columnSettingsheaderColumn settings panel header.
theme.columnSettingsheadingSelect-all heading.
theme.columnSettingsresetReset button.
theme.columnSettingscolumnsColumn list.
theme.columnSettingschildrenNested child column list.
theme.columnSettingsitemColumn list item.
theme.columnSettingsrowColumn option row; serves as the drag carrier.
theme.columnSettingsrowDraggingOutline of the source row being dragged.
theme.columnSettingsrowDropAboveInsertion line above the target row.
theme.columnSettingsrowDropBelowInsertion line below the target row.
theme.columnSettingsrowDropDotDot at the left end of the insertion line.
theme.columnSettingsdragHandleDrag handle.
theme.columnSettingspinActionsPin position button group.
theme.columnSettingspinActionPin position button.
theme.columnSettingspinIconPin position icon.
theme.columnSettingsgroupContainer for a group of columns divided by pin position.
theme.columnSettingsgroupTitlePin position group title.
theme.columnSettingsgroupColumnsColumn list within a group.
theme.columnSettingslabelColumn option label.
theme.columnSettingscheckboxControlCheckbox container.
theme.columnSettingscheckboxCheckbox input element.
theme.columnSettingscheckMarkCheck mark.
theme.columnSettingsindeterminateMarkIndeterminate mark.
theme.columnSettingslabelTextColumn option label text.
theme.columnSettingsemptyMessage shown when there are no configurable columns.

Preset defaults ​

ts
createVTableGuild({
  theme: {
    toolbar: {
      slots: {
        root: 'flex min-h-8 flex-wrap items-center justify-between gap-x-4 gap-y-3 text-[length:var(--vtg-table-font-size)] text-[color:var(--color-on-surface)] font-[family-name:var(--font-family-base)] leading-[var(--vtg-table-line-height)]',
        title: 'min-w-0 flex-1 text-[length:var(--vtg-toolbar-title-font-size)] font-[number:var(--vtg-toolbar-title-font-weight)]',
        right: 'ml-auto flex max-w-full flex-wrap items-center justify-end gap-4',
        actions: 'flex max-w-full flex-wrap items-center gap-2',
        settings: 'inline-flex shrink-0 items-center gap-4',
        search: 'flex w-[var(--vtg-toolbar-search-width,240px)] max-w-full items-center',
        searchGroup: 'inline-flex h-[var(--vtg-toolbar-search-height,32px)] w-full min-w-0 items-stretch text-[length:var(--vtg-toolbar-search-font-size,14px)]',
        searchField: 'relative z-0 -mr-px flex min-w-0 flex-1 items-center gap-1 rounded-l-[var(--vtg-input-border-radius)] border border-[color:var(--color-border)] bg-[color:var(--color-surface)] px-[var(--vtg-input-padding-inline)] transition-all duration-200 hover:z-10 hover:border-[color:var(--color-primary-hover)] focus-within:z-10 focus-within:border-[color:var(--color-primary)] focus-within:shadow-[0_0_0_2px_rgba(5,145,255,0.1)] data-[disabled]:cursor-not-allowed data-[disabled]:bg-[color:var(--color-bg-disabled)] data-[disabled]:hover:border-[color:var(--color-border)]',
        searchInput: 'h-full min-w-0 flex-1 rounded-none border-0 bg-transparent p-0 text-[length:var(--vtg-toolbar-search-font-size,14px)] outline-none shadow-none focus:shadow-none',
        searchSubmit: 'relative z-0 inline-flex w-[var(--vtg-toolbar-search-height,32px)] shrink-0 items-center justify-center rounded-r-[var(--vtg-input-border-radius)] border border-[color:var(--color-border)] bg-[color:var(--color-surface)] p-0 text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:z-10 hover:text-[color:var(--color-primary-hover)] hover:border-[color:var(--color-primary-hover)] focus-visible:z-10 focus-visible:outline-none focus-visible:border-[color:var(--color-primary)] focus-visible:shadow-[0_0_0_2px_rgba(5,145,255,0.1)] disabled:cursor-not-allowed disabled:bg-[color:var(--color-bg-disabled)] disabled:text-[color:var(--color-text-disabled)] disabled:hover:border-[color:var(--color-border)]',
        searchClear: 'inline-flex shrink-0 items-center justify-center border-0 bg-transparent p-0 text-[color:var(--color-text-placeholder)] cursor-pointer hover:text-[color:var(--color-muted)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)]',
        searchIcon: 'block h-[1em] w-[1em] shrink-0',
        filter: 'flex min-w-0 max-w-full flex-wrap items-center gap-2',
        extra: 'flex w-full min-w-0 flex-wrap items-center gap-3',
        action: 'inline-flex items-center justify-center h-6 w-6 p-0 border-0 bg-transparent text-[length:var(--vtg-column-settings-icon-size)] text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        icon: 'block',
        loadingIcon: 'animate-spin motion-reduce:animate-none',
      },
    },
    columnSettings: {
      slots: {
        root: 'inline-flex items-center gap-4',
        trigger: 'inline-flex items-center justify-center h-6 w-6 p-0 border-0 bg-transparent text-[length:var(--vtg-column-settings-icon-size)] text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        densityTrigger: 'inline-flex items-center justify-center h-6 w-6 p-0 border-0 bg-transparent text-[length:var(--vtg-column-settings-icon-size)] text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        popup: '[--vtg-table-popup-panel-radius:var(--vtg-column-settings-radius)] [--vtg-table-popup-panel-shadow:var(--vtg-column-settings-shadow)] flex flex-col [--vtg-table-popup-width:var(--vtg-column-settings-width)] max-w-[calc(100vw-16px)]',
        densityPopup: '[--vtg-table-popup-panel-radius:var(--vtg-column-settings-radius)] [--vtg-table-popup-panel-shadow:var(--vtg-column-settings-shadow)] min-w-[80px]',
        density: 'block w-full border-0 rounded-[var(--vtg-btn-border-radius-sm)] px-3 py-[5px] text-left text-[length:var(--vtg-table-font-size)] font-normal leading-[var(--vtg-table-line-height)] bg-transparent cursor-pointer hover:bg-[color:var(--color-control-item-hover-bg)] aria-checked:bg-[color:var(--color-control-item-active-bg)] aria-checked:text-[color:var(--color-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        header: 'flex items-center justify-between gap-3 h-8 mb-2 px-2',
        heading: 'group inline-flex items-center gap-2 cursor-pointer font-normal',
        reset: 'shrink-0 border-0 bg-transparent p-0 text-[color:var(--color-primary)] text-[length:var(--vtg-table-font-size)] font-semibold cursor-pointer hover:text-[color:var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        columns: 'm-0 max-h-[280px] overflow-auto list-none px-2 py-2',
        children: 'm-0 list-none pl-6',
        item: 'm-0 p-0 pb-1',
        row: 'relative flex min-w-0 items-center gap-1 select-none [&[draggable=true]]:cursor-grab [&[draggable=true]]:active:cursor-grabbing [&[draggable=false]]:cursor-not-allowed',
        rowDragging: 'rounded-[var(--vtg-btn-border-radius-sm)] bg-[color:var(--color-control-item-active-bg)] ring-1 ring-inset ring-[color:var(--color-primary)]',
        rowDropAbove: 'pointer-events-none absolute right-0 top-0 z-[1] h-[2px] rounded-[1px] left-[calc(var(--vtg-column-settings-icon-size)+var(--vtg-checkbox-size)+16px)] bg-[color:var(--vtg-table-row-drop-indicator-color)]',
        rowDropBelow: 'pointer-events-none absolute right-0 bottom-0 z-[1] h-[2px] rounded-[1px] left-[calc(var(--vtg-column-settings-icon-size)+var(--vtg-checkbox-size)+16px)] bg-[color:var(--vtg-table-row-drop-indicator-color)]',
        rowDropDot: 'pointer-events-none absolute start-[-6px] top-[-3px] h-2 w-2 rounded-full border-2 border-[color:var(--vtg-table-row-drop-indicator-color)] bg-transparent',
        dragHandle: 'inline-flex w-[var(--vtg-column-settings-icon-size)] shrink-0 items-center justify-center mr-2 select-none text-[color:var(--color-muted)]',
        pinActions: 'inline-flex shrink-0 items-center gap-0.5',
        pinAction: 'inline-flex items-center justify-center h-5 w-5 p-0 border-0 rounded-[var(--vtg-btn-border-radius-sm)] bg-transparent text-[color:var(--color-muted)] cursor-pointer hover:text-[color:var(--color-primary)] hover:bg-[color:var(--color-control-item-hover-bg)] aria-pressed:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        pinIcon: 'h-[var(--vtg-column-settings-pin-icon-size,14px)] w-[var(--vtg-column-settings-pin-icon-size,14px)]',
        group: 'm-0 list-none p-0',
        groupTitle: 'py-1 text-[length:var(--vtg-table-font-size)] text-[color:var(--color-muted)]',
        groupColumns: 'm-0 list-none p-0',
        label: 'group flex min-w-0 flex-1 min-h-6 items-center gap-1 cursor-pointer has-[:disabled]:cursor-not-allowed has-[:disabled]:text-[color:var(--color-text-disabled)]',
        checkboxControl: 'relative inline-flex shrink-0 h-[var(--vtg-checkbox-size)] w-[var(--vtg-checkbox-size)]',
        checkbox: 'peer m-0 h-full w-full appearance-none border border-[color:var(--color-border)] rounded-[var(--vtg-checkbox-border-radius)] bg-[color:var(--color-surface)] cursor-inherit transition-colors duration-300 checked:bg-[color:var(--color-primary)] checked:border-[color:var(--color-primary)] group-hover:enabled:border-[color:var(--color-primary)] group-hover:enabled:checked:bg-[color:var(--color-primary-hover)] group-hover:enabled:checked:border-transparent disabled:bg-[color:var(--color-bg-disabled)] disabled:border-[color:var(--color-border)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        checkMark: 'pointer-events-none absolute box-border top-1/2 left-[22%] w-[5.71px] h-[9.14px] border-b-2 border-r-2 border-[color:var(--vtg-checkbox-check-color,#fff)] [transform:rotate(45deg)_translate(-50%,_-50%)] peer-disabled:border-[color:var(--color-text-disabled)]',
        indeterminateMark: 'pointer-events-none absolute top-1/2 left-1/2 w-2 h-2 rounded-[1px] bg-[color:var(--vtg-checkbox-indeterminate-color,var(--color-primary))] -translate-x-1/2 -translate-y-1/2',
        labelText: 'min-w-0 flex-1 truncate px-1',
        empty: 'px-2 py-2 text-[color:var(--color-muted)]',
      },
    },
  },
})
ts
createVTableGuild({
  themePreset: 'element-plus',
  theme: {
    toolbar: {
      slots: {
        root: 'flex min-h-8 flex-wrap items-center justify-between gap-x-4 gap-y-3 text-[length:var(--vtg-table-font-size)] text-[color:var(--color-on-surface)] font-[family-name:var(--font-family-base)] leading-[var(--vtg-table-line-height)]',
        title: 'min-w-0 flex-1 text-[length:var(--vtg-toolbar-title-font-size)] font-[number:var(--vtg-toolbar-title-font-weight)]',
        right: 'ml-auto flex max-w-full flex-wrap items-center justify-end gap-4',
        actions: 'flex max-w-full flex-wrap items-center gap-2 [&>.el-button+.el-button]:!ml-0',
        settings: 'inline-flex shrink-0 items-center gap-4',
        search: 'flex w-[var(--vtg-toolbar-search-width,240px)] max-w-full items-center',
        searchGroup: 'inline-flex h-[var(--vtg-toolbar-search-height,32px)] w-full min-w-0 items-stretch text-[length:var(--vtg-toolbar-search-font-size,14px)]',
        searchField: 'relative z-0 -mr-px flex min-w-0 flex-1 items-center gap-1 rounded-l-[var(--vtg-input-border-radius)] border border-[color:var(--color-border)] bg-[color:var(--color-surface)] px-[var(--vtg-input-padding-inline)] transition-all duration-200 hover:z-10 hover:border-[color:var(--color-primary-hover)] focus-within:z-10 focus-within:border-[color:var(--color-primary)] focus-within:shadow-[0_0_0_2px_rgba(5,145,255,0.1)] data-[disabled]:cursor-not-allowed data-[disabled]:bg-[color:var(--color-bg-disabled)] data-[disabled]:hover:border-[color:var(--color-border)] hover:border-[color:var(--color-border-hover)] focus-within:shadow-none focus-within:hover:border-[color:var(--color-primary)]',
        searchInput: 'h-full min-w-0 flex-1 rounded-none border-0 bg-transparent p-0 text-[length:var(--vtg-toolbar-search-font-size,14px)] outline-none shadow-none focus:shadow-none',
        searchSubmit: 'relative z-0 inline-flex w-[var(--vtg-toolbar-search-height,32px)] shrink-0 items-center justify-center rounded-r-[var(--vtg-input-border-radius)] border border-[color:var(--color-border)] bg-[color:var(--color-surface)] p-0 text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:z-10 hover:text-[color:var(--color-primary-hover)] hover:border-[color:var(--color-primary-hover)] focus-visible:z-10 focus-visible:outline-none focus-visible:border-[color:var(--color-primary)] focus-visible:shadow-[0_0_0_2px_rgba(5,145,255,0.1)] disabled:cursor-not-allowed disabled:bg-[color:var(--color-bg-disabled)] disabled:text-[color:var(--color-text-disabled)] disabled:hover:border-[color:var(--color-border)] bg-[color:var(--color-bg-disabled)] text-[color:var(--color-muted)] focus-visible:shadow-none',
        searchClear: 'inline-flex shrink-0 items-center justify-center border-0 bg-transparent p-0 text-[color:var(--color-text-placeholder)] cursor-pointer hover:text-[color:var(--color-muted)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)]',
        searchIcon: 'block h-[1em] w-[1em] shrink-0',
        filter: 'flex min-w-0 max-w-full flex-wrap items-center gap-2',
        extra: 'flex w-full min-w-0 flex-wrap items-center gap-3',
        action: 'inline-flex items-center justify-center h-6 w-6 p-0 border-0 bg-transparent text-[length:var(--vtg-column-settings-icon-size)] text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        icon: 'block',
        loadingIcon: 'animate-spin motion-reduce:animate-none',
      },
    },
    columnSettings: {
      slots: {
        root: 'inline-flex items-center gap-4',
        trigger: 'inline-flex items-center justify-center h-6 w-6 p-0 border-0 bg-transparent text-[length:var(--vtg-column-settings-icon-size)] text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        densityTrigger: 'inline-flex items-center justify-center h-6 w-6 p-0 border-0 bg-transparent text-[length:var(--vtg-column-settings-icon-size)] text-[color:var(--color-on-surface)] cursor-pointer transition-colors duration-200 hover:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        popup: '[--vtg-table-popup-panel-radius:var(--vtg-column-settings-radius)] [--vtg-table-popup-panel-shadow:var(--vtg-column-settings-shadow)] flex flex-col [--vtg-table-popup-width:var(--vtg-column-settings-width)] max-w-[calc(100vw-16px)]',
        densityPopup: '[--vtg-table-popup-panel-radius:var(--vtg-column-settings-radius)] [--vtg-table-popup-panel-shadow:var(--vtg-column-settings-shadow)] min-w-[80px]',
        density: 'block w-full border-0 rounded-[var(--vtg-btn-border-radius-sm)] px-3 py-[5px] text-left text-[length:var(--vtg-table-font-size)] font-normal leading-[var(--vtg-table-line-height)] bg-transparent cursor-pointer hover:bg-[color:var(--color-control-item-hover-bg)] aria-checked:bg-[color:var(--color-control-item-active-bg)] aria-checked:text-[color:var(--color-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        header: 'flex items-center justify-between gap-3 h-8 mb-2 px-2',
        heading: 'group inline-flex items-center gap-2 cursor-pointer font-normal',
        reset: 'shrink-0 border-0 bg-transparent p-0 text-[color:var(--color-primary)] text-[length:var(--vtg-table-font-size)] font-semibold cursor-pointer hover:text-[color:var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        columns: 'm-0 max-h-[280px] overflow-auto list-none px-2 py-2',
        children: 'm-0 list-none pl-6',
        item: 'm-0 p-0 pb-1',
        row: 'relative flex min-w-0 items-center gap-1 select-none [&[draggable=true]]:cursor-grab [&[draggable=true]]:active:cursor-grabbing [&[draggable=false]]:cursor-not-allowed',
        rowDragging: 'rounded-[var(--vtg-btn-border-radius-sm)] bg-[color:var(--color-control-item-active-bg)] ring-1 ring-inset ring-[color:var(--color-primary)]',
        rowDropAbove: 'pointer-events-none absolute right-0 top-0 z-[1] h-[2px] rounded-[1px] left-[calc(var(--vtg-column-settings-icon-size)+var(--vtg-checkbox-size)+16px)] bg-[color:var(--vtg-table-row-drop-indicator-color)]',
        rowDropBelow: 'pointer-events-none absolute right-0 bottom-0 z-[1] h-[2px] rounded-[1px] left-[calc(var(--vtg-column-settings-icon-size)+var(--vtg-checkbox-size)+16px)] bg-[color:var(--vtg-table-row-drop-indicator-color)]',
        rowDropDot: 'pointer-events-none absolute start-[-6px] top-[-3px] h-2 w-2 rounded-full border-2 border-[color:var(--vtg-table-row-drop-indicator-color)] bg-transparent',
        dragHandle: 'inline-flex w-[var(--vtg-column-settings-icon-size)] shrink-0 items-center justify-center mr-2 select-none text-[color:var(--color-muted)]',
        pinActions: 'inline-flex shrink-0 items-center gap-0.5',
        pinAction: 'inline-flex items-center justify-center h-5 w-5 p-0 border-0 rounded-[var(--vtg-btn-border-radius-sm)] bg-transparent text-[color:var(--color-muted)] cursor-pointer hover:text-[color:var(--color-primary)] hover:bg-[color:var(--color-control-item-hover-bg)] aria-pressed:text-[color:var(--color-primary)] disabled:cursor-not-allowed disabled:text-[color:var(--color-text-disabled)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)]',
        pinIcon: 'h-[var(--vtg-column-settings-pin-icon-size,14px)] w-[var(--vtg-column-settings-pin-icon-size,14px)]',
        group: 'm-0 list-none p-0',
        groupTitle: 'py-1 text-[length:var(--vtg-table-font-size)] text-[color:var(--color-muted)]',
        groupColumns: 'm-0 list-none p-0',
        label: 'group flex min-w-0 flex-1 min-h-6 items-center gap-1 cursor-pointer has-[:disabled]:cursor-not-allowed has-[:disabled]:text-[color:var(--color-text-disabled)]',
        checkboxControl: 'relative inline-flex shrink-0 h-[var(--vtg-checkbox-size)] w-[var(--vtg-checkbox-size)]',
        checkbox: 'peer m-0 h-full w-full appearance-none border border-[color:var(--color-border)] rounded-[var(--vtg-checkbox-border-radius)] bg-[color:var(--color-surface)] cursor-inherit transition-colors duration-300 checked:bg-[color:var(--color-primary)] checked:border-[color:var(--color-primary)] group-hover:enabled:border-[color:var(--color-primary)] group-hover:enabled:checked:bg-[color:var(--color-primary-hover)] group-hover:enabled:checked:border-transparent disabled:bg-[color:var(--color-bg-disabled)] disabled:border-[color:var(--color-border)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-primary)] indeterminate:bg-[color:var(--color-primary)] indeterminate:border-[color:var(--color-primary)]',
        checkMark: 'pointer-events-none absolute box-content top-1/2 left-1/2 w-[3px] h-[7px] border border-transparent border-l-0 border-t-0 border-[color:var(--vtg-checkbox-check-color,#fff)] [transform:translate(-45%,_-60%)_rotate(45deg)] [transform-origin:center] peer-disabled:border-[color:var(--color-text-placeholder)]',
        indeterminateMark: 'pointer-events-none absolute left-0 right-0 top-[5px] w-[12px] rounded-none translate-x-0 translate-y-0 h-[2px] bg-[color:var(--vtg-checkbox-indeterminate-color,#fff)] [transform:scale(.5)]',
        labelText: 'min-w-0 flex-1 truncate px-1',
        empty: 'px-2 py-2 text-[color:var(--color-muted)]',
      },
    },
  },
})

CSS variables ​

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

Type Declarations ​

Toolbar types
ts
import type { VNodeChild } from 'vue'
import type {
  TableColumnsType,
  TableColumnSettingsProps,
  TableColumnSettingsOptions,
  TableColumnSettingsSize,
  TableColumnSettingsSlots,
  SlotProps,
  ToolbarThemeConfig,
  VTableGuildToolbarLocale,
} from '@vtable-guild/vtable-guild'

export interface TableToolbarOptions extends TableColumnSettingsOptions {
  reload?: boolean
  fullScreen?: boolean
}

export interface TableToolbarSearchConfig {
  placeholder?: string
  clearable?: boolean
}

export interface TableToolbarProps<TRecord extends object = Record<string, unknown>> {
  title?: VNodeChild
  columns?: TableColumnsType<TRecord>
  size?: TableColumnSettingsSize
  options?: false | TableToolbarOptions
  loading?: boolean
  search?: boolean | TableToolbarSearchConfig
  searchValue?: string
  multipleLine?: boolean
  disabled?: boolean
  fullscreenTarget?: () => HTMLElement | null | undefined
  columnSettings?: Pick<
    TableColumnSettingsProps<TRecord>,
    'locale' | 'ui' | 'class' | 'getPopupContainer'
  >
  locale?: Partial<VTableGuildToolbarLocale>
  ui?: SlotProps<ToolbarThemeConfig>
  class?: string
}

export interface TableToolbarSlotProps<TRecord extends object = Record<string, unknown>> {
  columns: TableColumnsType<TRecord>
  size: TableColumnSettingsSize
  loading: boolean
  disabled: boolean
  fullscreen: boolean
  fullscreenAvailable: boolean
  reload: () => void
  toggleFullscreen: () => Promise<void>
  searchValue: string
  updateSearchValue: (value: string) => void
  submitSearch: (value?: string) => void
  clearSearch: () => void
}

export interface TableToolbarSlots<TRecord extends object = Record<string, unknown>> {
  title?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
  actions?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
  settings?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
  search?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
  filter?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
  extra?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
  columnLabel?: TableColumnSettingsSlots<TRecord>['columnLabel']
}
ts
export interface TableColumnSettingsOptions {
  density?: boolean
  setting?: boolean
  fixed?: boolean
  draggable?: boolean
}
ts
export interface VTableGuildToolbarLocale {
  searchPlaceholder?: string
  search?: string
  clearSearch?: string
  label: string
  reload: string
  fullScreen: string
  exitFullScreen: string
}
ts
export type ToolbarThemeConfig = typeof toolbarTheme
export type ToolbarSlots = keyof ToolbarThemeConfig['slots']