Skip to content

Commit 4f6acb8

Browse files
committed
feat(VBreadcrumbs): pass props and width to items
1 parent 97a20f6 commit 4f6acb8

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131
"bgColor": "3.4.0"
3232
}
3333
},
34+
"VBreadcrumbs": {
35+
"props": {
36+
"itemProps": "3.11.0"
37+
}
38+
},
39+
"VBreadcrumbsItem": {
40+
"props": {
41+
"width": "3.11.0",
42+
"maxWidth": "3.11.0"
43+
}
44+
},
3445
"VBtn": {
3546
"props": {
3647
"text": "3.2.0",
@@ -331,4 +342,4 @@
331342
"transitionDuration": "3.10.0"
332343
}
333344
}
334-
}
345+
}

packages/vuetify/src/components/VBreadcrumbs/VBreadcrumbs.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { makeTagProps } from '@/composables/tag'
1818

1919
// Utilities
2020
import { computed, toRef } from 'vue'
21-
import { genericComponent, propsFactory, useRender } from '@/util'
21+
import { genericComponent, isObject, propsFactory, useRender } from '@/util'
2222

2323
// Types
2424
import type { PropType } from 'vue'
@@ -47,6 +47,7 @@ export const makeVBreadcrumbsProps = propsFactory({
4747
type: Array as PropType<readonly BreadcrumbItem[]>,
4848
default: () => ([]),
4949
},
50+
itemProps: Boolean,
5051

5152
...makeComponentProps(),
5253
...makeDensityProps(),
@@ -139,6 +140,7 @@ export const VBreadcrumbs = genericComponent<new <T extends BreadcrumbItem>(
139140
key={ index }
140141
disabled={ index >= array.length - 1 }
141142
{ ...(typeof item === 'string' ? { title: item } : item) }
143+
{ ...(props.itemProps && isObject(raw) ? raw : {}) }
142144
v-slots={{
143145
default: slots.title ? () => slots.title?.({ item, index }) : undefined,
144146
}}

packages/vuetify/src/components/VBreadcrumbs/VBreadcrumbsItem.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Composables
22
import { useTextColor } from '@/composables/color'
33
import { makeComponentProps } from '@/composables/component'
4+
import { makeDimensionProps, useDimension } from '@/composables/dimensions'
45
import { makeRouterProps, useLink } from '@/composables/router'
56
import { makeTagProps } from '@/composables/tag'
67

78
// Utilities
89
import { computed } from 'vue'
9-
import { genericComponent, propsFactory, useRender } from '@/util'
10+
import { genericComponent, pick, propsFactory, useRender } from '@/util'
1011

1112
export const makeVBreadcrumbsItemProps = propsFactory({
1213
active: Boolean,
@@ -17,6 +18,7 @@ export const makeVBreadcrumbsItemProps = propsFactory({
1718
title: String,
1819

1920
...makeComponentProps(),
21+
...pick(makeDimensionProps(), ['width', 'maxWidth']),
2022
...makeRouterProps(),
2123
...makeTagProps({ tag: 'li' }),
2224
}, 'VBreadcrumbsItem')
@@ -29,6 +31,7 @@ export const VBreadcrumbsItem = genericComponent()({
2931
setup (props, { slots, attrs }) {
3032
const link = useLink(props, attrs)
3133
const isActive = computed(() => props.active || link.isActive?.value)
34+
const { dimensionStyles } = useDimension(props)
3235

3336
const { textColorClasses, textColorStyles } = useTextColor(
3437
() => isActive.value ? props.activeColor : props.color
@@ -49,6 +52,7 @@ export const VBreadcrumbsItem = genericComponent()({
4952
]}
5053
style={[
5154
textColorStyles.value,
55+
dimensionStyles.value,
5256
props.style,
5357
]}
5458
aria-current={ isActive.value ? 'page' : undefined }

0 commit comments

Comments
 (0)