Skip to content

feat(VDataTable): add mobile header slot#21429

Merged
J-Sek merged 8 commits into
vuetifyjs:devfrom
webdevnerdstuff:feat/VDataTable-add-moble-header-slot
May 20, 2026
Merged

feat(VDataTable): add mobile header slot#21429
J-Sek merged 8 commits into
vuetifyjs:devfrom
webdevnerdstuff:feat/VDataTable-add-moble-header-slot

Conversation

@webdevnerdstuff

Copy link
Copy Markdown
Contributor

Description

Replaces:
#19743

Related:
#19749
#19730

Markup:

<template>
  <v-data-table
    :headers="headers"
    :items="desserts"
    :mobile="true"
    item-value="name"
    items-per-page="5"
    page="1"
    theme="dark"
    show-select
  >
    <template #[`mobile.header`]="props">
      <v-checkbox
        v-bind="props"
        v-model="props.allSelected"
        :indeterminate="props.someSelected && !props.allSelected"
        hide-details
        @click="props.selectAll(!props.allSelected)"
      />
      <v-spacer />
      <v-btn
        color="primary"
        @click="props.selectAll(true)"
      >
        Select All
      </v-btn>
    </template>
  </v-data-table>
</template>

<script setup lang="ts">
  import { ref } from 'vue'

  const headers = ref([
    {
      title: 'Dessert (100g serving)',
      align: 'start',
      sortable: false,
      key: 'name',
    },
    {
      title: 'Calories',
      key: 'calories',
      sortable: false,
    },
    {
      title: 'Fat (g)',
      key: 'fat',
    // sortable: false,
    },
  ] as const)
  const desserts = ref([
    {
      name: 'Frozen Yogurt',
      calories: 159,
      fat: 6,
    },
    {
      name: 'Ice cream sandwich with some really long name',
      calories: 237,
      fat: 9,
    },
    {
      name: 'Eclair',
      calories: 262,
      fat: 16,
    },
    {
      name: 'Cupcake',
      calories: 305,
      fat: 3.7,
    },
    {
      name: 'Gingerbread',
      calories: 356,
      fat: 16,
    },
    {
      name: 'Jelly bean',
      calories: 375,
      fat: 0,
    },
    {
      name: 'Lollipop',
      calories: 392,
      fat: 0.2,
    },
    {
      name: 'Honeycomb',
      calories: 408,
      fat: 3.2,
    },
    {
      name: 'Donut',
      calories: 452,
      fat: 25,
    },
    {
      name: 'KitKat',
      calories: 518,
      fat: 26,
    },
  ])
</script>

@KaelWD KaelWD force-pushed the dev branch 2 times, most recently from 6331ca7 to 564ccc8 Compare September 10, 2025 13:29
@J-Sek J-Sek force-pushed the dev branch 3 times, most recently from a7fa817 to 2e2cddb Compare October 8, 2025 15:22
@J-Sek J-Sek force-pushed the dev branch 2 times, most recently from 5b257fd to 86800d9 Compare March 29, 2026 00:37
@J-Sek J-Sek merged commit c0bdb9c into vuetifyjs:dev May 20, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants