BlogPlaygroundOne

VDataTable API


Props
name
type
default
  | Record<string, any>
  | ((
      data: Pick<
        ItemKeySlot<any>,
        'value' | 'item' | 'column' | 'index' | 'internalItem'
      >,
    ) => Record<string, any>)
undefined

An object of additional props to be passed to each <td> in the table body. Also accepts a function that will be called for each cell. If the same prop is defined both here and in cellProps in a headers object, the value from the headers object will be used.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$collapse'

Icon to display when the expandable row is expanded.

string
undefined

Applies a color to checkboxes, page size dropdown and sort badges in the table header.

FilterFunction
undefined

Function to filter items.

unknown
undefined

Function used on specific keys within the item object. customFilter is skipped for columns with customKeyFilter specified.

unknown
undefined

Function used on specific keys within the item object. customSort is skipped for columns with customKeySort specified.

'default' | 'comfortable' | 'compact'
'default'

Adjusts the vertical height of the table rows.

boolean
false

Toggles rendering of sort button.

string[]
[]

Array of expanded items. Can be bound to external variable using v-model:expanded.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$expand'

Icon to display when the expandable row is collapsed.

boolean
false

Expands item when the row is clicked.

string | string[]
undefined

Array of specific keys to filter on the item.

'every' | 'some' | 'union' | 'intersection'
'intersection'

Controls how the results of customFilter and customKeyFilter are combined. All modes only apply customFilter to columns not specified in customKeyFilter.

  • some: There is at least one match from either the custom filter or the custom key filter.
  • every: All columns match either the custom filter or the custom key filter.
  • union: There is at least one match from the custom filter, or all columns match the custom key filters.
  • intersection: There is at least one match from the custom filter, and all columns match the custom key filters.
  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$first'

First icon.

string
'$vuetify.dataFooter.firstPage'

Label for first page.

boolean
false

Use the fixed-footer prop together with the height prop to fix the footer to the bottom of the table.

boolean
false

Fixed header to top of table.

SortItem[]
[]

Configures attributes (and sort order) to group items together. Can be customized further with group-header and group-summary slots.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$tableGroupCollapse'

Icon to display when the row group is expanded.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$tableGroupExpand'

Icon to display when the row group is collapsed.

unknown
undefined

Pass props to the default header. See v-data-table-headers API for more information.

{
  readonly key?:
    | (string & {})
    | 'data-table-group'
    | 'data-table-select'
    | 'data-table-expand'
    | undefined
  readonly value?: SelectItemKey<any>
  readonly title?: string | undefined
  readonly fixed?: boolean | 'end' | 'start' | undefined
  readonly align?: 'end' | 'start' | 'center' | undefined
  readonly width?: string | number | undefined
  readonly minWidth?: string | number | undefined
  readonly maxWidth?: string | number | undefined
  readonly nowrap?: boolean | undefined
  readonly indent?: number | undefined
  readonly headerProps?: { readonly [x: string]: any } | undefined
  readonly cellProps?:
    | { readonly [x: string]: any }
    | HeaderCellPropsFunction
    | undefined
  readonly sortable?: boolean | undefined
  readonly sort?: DataTableCompareFunction<any> | undefined
  readonly sortRaw?: DataTableCompareFunction<any> | undefined
  readonly filter?: FilterFunction | undefined
  readonly children?: readonly any[] | undefined
}[]
undefined

An array of objects that each describe a header column.

string | number
undefined

Set an explicit height of table.

boolean
false

Hides the default body.

boolean
false

Hides the default footer.

boolean
false

Hides the default header.

boolean
false

Hides the menu when there are no options to show. Useful for preventing the menu from opening before results are fetched asynchronously. Also has the effect of opening the menu when the items array changes if not already open.

boolean
false

Adds a hover effects to a table rows.

'asc' | 'desc'
'asc'

Specifies the initial sort order when an unsorted column is clicked.

any[]
[]

An array of strings or objects used for automatically generating children components.

SelectItemKey
null

Property on supplied items that indicates whether the item is selectable.

string | number
10

Changes how many items per page should be visible. Can be bound to external variable using v-model:itemsPerPage… Setting this prop to -1 will display all items on the page.

(number | { title: string; value: number })[]
[
  {value: 10, title: '10'},
  {value: 25, title: '25'},
  {value: 50, title: '50'},
  {value: 100, title: '100'},
  {value: -1, title: '$vuetify.dataFooter.itemsPerPageAll'}
]

Array of options to show in the items-per-page dropdown.

string
'$vuetify.dataFooter.itemsPerPageText'

Text for items-per-page dropdown.

SelectItemKey
'id'

Property on supplied items that contains its value.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$last'

Last icon.

string
'$vuetify.dataFooter.lastPage'

Label for last page.

string | boolean
false

Displays linear progress bar. Can either be a String which specifies which color is applied to the progress bar (any material color or theme color - primary, secondary, success, info, warning, error) or a Boolean which uses the component color (set by color prop - if it’s supported by the component) or the primary color.

string
'$vuetify.dataIterator.loadingText'

Text shown when the data is loading.

boolean
false

Determines the display mode of the component. If true, the component will be displayed in mobile mode. If false, the component will be displayed in desktop mode. If null, will be based on the current mobile-breakpoint

number | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
undefined

Overrides the display configuration default screen size that the component should be considered in mobile.

unknown
[]

The v-model value of the component. If component supports the multiple prop, this defaults to an empty array.

  | boolean
  | { key: 'ctrl'; mode: 'prepend' | 'append'; modifier: 'shift' | 'alt' }
false

Let user sort by multiple properties/columns.

  • key: (optional) when set to ctrl, user is required to hold a keyboard key (Ctrl on PC and Command on Mac)
  • mode: when user selects a new column to sort by, it will be set first (prepend) or last (append) in the sort priority. Defaults to append
  • modifier: (optional) allows user to use both multi-sort modes (append and prepend) simultaneously
boolean
false

Forces sorting on the column(s).

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$next'

Next icon.

string
'$vuetify.dataFooter.nextPage'

Label for next page.

string
'$vuetify.noDataText'

Text shown when no items are provided to the component.

boolean
false

Disables all item filtering.

string | number
1

The current displayed page number (1-indexed).

'item' | 'auto' | 'any'
'any'

Controls how pagination counts items.

  • item paginates by individual items,
  • auto paginates by top-level groups and falls back to regular items if group-by is empty,
  • any paginates by both items and groups combined
string
'$vuetify.dataFooter.pageText'

Label for page number.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$prev'

Previous icon.

string
'$vuetify.dataFooter.prevPage'

Label for previous page.

boolean
false

Changes the selection behavior to return the object directly rather than the value specified with item-value.

  | Record<string, any>
  | ((
      data: Pick<ItemKeySlot<any>, 'item' | 'index' | 'internalItem'>,
    ) => Record<string, any>)
undefined

An object of additional props to be passed to each <tr> in the table body. Also accepts a function that will be called for each row.

string
undefined

Text input used to filter items.

'all' | 'page' | 'single'
'page'

Defines the strategy of selecting items in the list. Possible values are: ‘single’ (only one item can be selected at a time), ‘page’ (‘Select all’ button will select only items on the current page), ‘all’ (‘Select all’ button will select all items in the list).

boolean
false

Show current page number between prev/next icons.

boolean
false

Shows the expand toggle in default rows.

boolean
false

Shows the select checkboxes in both the header and rows (if using default rows).

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$sortAsc'

Icon used for ascending sort button.

SortItem[]
[]

Changes which item property (or properties) should be used for sort order. Can be bound to external variable using v-model:sortBy

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
'$sortDesc'

Icon used for descending sort button.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
undefined

Icon used for unsorted columns. By default it uses either sortAscIcon or sortDescIcon depending on initialSortOrder, but can be customized to show a neutral icon instead.

boolean
false

Deprecated, use fixed-header instead.

'odd' | 'even'
null

Applies a background to either even or odd rows.

string | (new () => any) | FunctionalComponent
'div'

Specify a custom tag used on the root element.

string
undefined

Specify a theme for this component and all of its children.

(a: any, b: any) => boolean
undefined

Apply a custom comparison algorithm to compare model-value and values contains in the items prop.

string | number
undefined

Sets the width for the component.

Events
name
type
[any]

Emits with the items currently being displayed.

[any]

Emits when the expanded items are updated.

[any]

Emits when the group-by prop is updated.

[number]

Emits when the items-per-page prop is updated.

[unknown]

Emits when the component’s model changes.

[any]

Emits when pagination related properties (page, itemsPerPage, sortBy, groupBy, search) is updated.

[number]

Emits when the page prop is updated.

[any]

Emits when the sortBy prop is updated.

Slots
{ column: InternalDataTableHeader selectAll: (value: boolean) => void isSorted: (column: InternalDataTableHeader) => boolean toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void sortBy: SortItem[] someSelected: boolean allSelected: boolean getSortIcon: ( column: InternalDataTableHeader, ) => | string | (string | [string, number])[] | (new () => any) | FunctionalComponent }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ item: Group; count: number; props: Record<string, unknown> }
{ props: Record<string, unknown> }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ index: number item: any internalItem: DataTableItem isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isSelected: (items: SelectableItem | SelectableItem[]) => boolean toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void } & { columns: InternalDataTableHeader[] }
never
{ index: number item: Group columns: InternalDataTableHeader[] isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isSelected: (items: SelectableItem | SelectableItem[]) => boolean toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void toggleGroup: (group: Group) => void isGroupOpen: (group: Group) => boolean }
{ index: number item: GroupSummary columns: InternalDataTableHeader[] toggleGroup: (group: Group) => void }
{ column: InternalDataTableHeader selectAll: (value: boolean) => void isSorted: (column: InternalDataTableHeader) => boolean toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void sortBy: SortItem[] someSelected: boolean allSelected: boolean getSortIcon: ( column: InternalDataTableHeader, ) => | string | (string | [string, number])[] | (new () => any) | FunctionalComponent }
{ column: InternalDataTableHeader selectAll: (value: boolean) => void isSorted: (column: InternalDataTableHeader) => boolean toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void sortBy: SortItem[] someSelected: boolean allSelected: boolean getSortIcon: ( column: InternalDataTableHeader, ) => | string | (string | [string, number])[] | (new () => any) | FunctionalComponent }
{ headers: InternalDataTableHeader[][] columns: InternalDataTableHeader[] sortBy: SortItem[] someSelected: boolean allSelected: boolean toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void selectAll: (value: boolean) => void getSortIcon: ( column: InternalDataTableHeader, ) => | string | (string | [string, number])[] | (new () => any) | FunctionalComponent isSorted: (column: InternalDataTableHeader) => boolean }
{ index: number item: any internalItem: DataTableItem isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isSelected: (items: SelectableItem | SelectableItem[]) => boolean toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void } & { columns: InternalDataTableHeader[] } & { props: Record<string, any> }
Omit<ItemKeySlot<any>, 'value'> & { props: Record<string, unknown> }
Omit<ItemKeySlot<any>, 'value'> & { props: Record<string, unknown> }
{ color: string; isActive: boolean }
never
never
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }
{ page: number itemsPerPage: number sortBy: SortItem[] pageCount: number toggleSort: ( column: InternalDataTableHeader, event: KeyboardEvent | PointerEvent, mandatory: boolean, ) => void setItemsPerPage: (value: number) => void prevPage: () => void nextPage: () => void setPage: (value: number) => void someSelected: boolean allSelected: boolean isSelected: (items: SelectableItem | SelectableItem[]) => boolean select: (items: SelectableItem[], value: boolean) => void selectAll: (value: boolean) => void toggleSelect: (item: SelectableItem, index: number, event: MouseEvent) => void isExpanded: (item: DataTableItem) => boolean toggleExpand: (item: DataTableItem) => void isGroupOpen: (group: Group) => boolean toggleGroup: (group: Group) => void items: any[] internalItems: DataTableItem[] groupedItems: (DataTableItem | Group | GroupSummary)[] columns: InternalDataTableHeader[] headers: InternalDataTableHeader[][] }

Slot for custom rendering of a header cell.

Slot for custom rendering of a row cell.

Slot to replace the default table <tbody>.

Appends elements to the end of the default table <tbody>.

Prepends elements to the start of the default table <tbody>.

Slot for custom rendering of a data table footer.

Slot to replace the default rendering of the <colgroup> element.

Slot for custom rendering of a group.

Slot for custom rendering of a header cell with the select checkbox.

The default Vue slot.

Slot for custom rendering of an expanded row.

Adds content to the empty space in the footer.

Slot for custom rendering of a group header.

Slot for custom rendering of a group summary.

Slot to replace the default v-icon used when expanding header.

Slot to replace the default v-checkbox-btn in header.

An array of objects that each describe a header column.

Slot to replace the default rendering of a row.

Slot to replace the default v-icon used when expanding rows.

Slot to replace the default v-checkbox-btn used when selecting rows.

Slot for custom loader (displayed when loading prop is equal to true).

Defines content for when loading is true and no items are provided.

Defines content for when no items are provided.

Slot to replace the default table <tbody>.

Slot to replace the default table <tfoot>.

Slot to replace the default table <thead>.

Slot to add content above the table.

SASS Variables