Skip to content

Conversation

@J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Sep 8, 2025

Description

  • introduces no-data slot along with hide-no-data and no-data-text props

uses VListItem instead of VTreeviewItem because the latter injects visibleIds and hides itself. VTreeviewItem was also my first pick for an element inside the custom slot - it my be confusing to many devs.

  • [TBD] VTreeviewItem might benefit from an additional filterable prop that could be passed down using VDefaultsProvider, so the same component outside of VTreeviewChildren would ignore visibleIds

resolves #21954

Markup:

<template>
  <v-app>
    <v-container max-width="500">
      <v-text-field v-model="search" prepend-inner-icon="mdi-magnify" clearable />
      <v-treeview
        v-model="model"
        :items="items"
        :search="search"
        item-value="id"
        open-all
      >
        <template #no-data>
          <v-list-item :title="`There are no results matching '${search}'`" />
        </template>
      </v-treeview>
    </v-container>
  </v-app>
</template>

<script setup>
  import { ref } from 'vue'

  const model = ref()
  const search = ref('')

  const items = [
    {
      id: 115,
      title: 'Documents',
      children: [
        {
          id: 116,
          title: 'Financial',
          children: [
            { id: 17, title: 'November.pdf' },
          ],
        },
        {
          id: 117,
          title: 'Taxes',
          children: [
            { id: 118, title: 'December.pdf' },
            { id: 119, title: 'January.pdf' },
          ],
        },
        {
          id: 120,
          title: 'Later',
          children: [
            { id: 121, title: 'Company logo.png' },
          ],
        },
      ],
    },
  ]
</script>

@J-Sek J-Sek self-assigned this Sep 8, 2025
@J-Sek J-Sek added T: feature A new feature C: VTreeview labels Sep 8, 2025
@J-Sek J-Sek linked an issue Sep 8, 2025 that may be closed by this pull request
@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 feat/vtreeview-no-data branch 2 times, most recently from 2a88d44 to 1f481aa Compare October 8, 2025 14:34
@J-Sek J-Sek force-pushed the feat/vtreeview-no-data branch from 1f481aa to a68edb0 Compare October 8, 2025 14:36
@J-Sek J-Sek force-pushed the feat/vtreeview-no-data branch from a68edb0 to 7c57977 Compare October 8, 2025 14:41
@J-Sek J-Sek force-pushed the dev branch 2 times, most recently from a7fa817 to 2e2cddb Compare October 8, 2025 15:22
@J-Sek J-Sek force-pushed the feat/vtreeview-no-data branch from 7c57977 to a87eb43 Compare October 8, 2025 15:24
@J-Sek J-Sek merged commit 6ebe9fd into vuetifyjs:dev Oct 8, 2025
10 checks passed
@J-Sek J-Sek deleted the feat/vtreeview-no-data branch October 8, 2025 15:29
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.

[Feature Request] VTreeview: "empty" and "not-found" slots

1 participant