Skip to content

Commit a87a3fd

Browse files
authored
feat(VTreeview): add footer slot (#22130)
resolves #22100
1 parent 859e78c commit a87a3fd

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

packages/api-generator/src/locale/en/VTreeview.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"slots": {
4242
"append": "Appends content after label.",
4343
"prepend": "Prepends content before label.",
44-
"header": "Slot for custom header.",
44+
"header": "Slot for expandable nodes (all items that are not leafs).",
45+
"footer": "Slot for footer below expanded children.",
4546
"subheader": "Slot for custom subheader.",
4647
"divider": "Slot for custom divider."
4748
},

packages/docs/src/data/new-in.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@
264264
},
265265
"slots": {
266266
"header": "3.10.0",
267+
"footer": "3.11.0",
267268
"toggle": "3.10.0"
268269
}
269270
},

packages/vuetify/src/components/VTreeview/VTreeviewChildren.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export type VTreeviewChildrenSlots<T> = {
3838
internalItem: InternalListItem<T>
3939
loading: boolean
4040
}
41+
footer: {
42+
item: T
43+
internalItem: InternalListItem<T>
44+
loading: boolean
45+
}
4146
divider: { props: InternalListItem['props'] }
4247
subheader: { props: InternalListItem['props'] }
4348
}
@@ -224,15 +229,18 @@ export const VTreeviewChildren = genericComponent<new <T extends InternalListIte
224229
)
225230
},
226231
default: () => (
227-
<VTreeviewChildren
228-
{ ...treeviewChildrenProps }
229-
items={ children }
230-
indentLinesVariant={ props.indentLinesVariant }
231-
parentIndentLines={ indentLines.children }
232-
isLastGroup={ nextItemHasChildren }
233-
returnObject={ props.returnObject }
234-
v-slots={ slots }
235-
/>
232+
<>
233+
<VTreeviewChildren
234+
{ ...treeviewChildrenProps }
235+
items={ children }
236+
indentLinesVariant={ props.indentLinesVariant }
237+
parentIndentLines={ indentLines.children }
238+
isLastGroup={ nextItemHasChildren }
239+
returnObject={ props.returnObject }
240+
v-slots={ slots }
241+
/>
242+
{ slots.footer?.({ item: item.raw, internalItem: item, loading }) }
243+
</>
236244
),
237245
}}
238246
</VTreeviewGroup>

0 commit comments

Comments
 (0)