Skip to content

Commit 5f8abb6

Browse files
edfriasEdgar Frias
andauthored
feat(VCard): allow semantic HTML tags for content parts (#21943)
Co-authored-by: Edgar Frias <[email protected]>
1 parent 90fb4b3 commit 5f8abb6

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

packages/vuetify/src/components/VCard/VCardActions.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
// Composables
22
import { makeComponentProps } from '@/composables/component'
33
import { provideDefaults } from '@/composables/defaults'
4+
import { makeTagProps } from '@/composables/tag'
45

56
// Utilities
6-
import { genericComponent, useRender } from '@/util'
7+
import { genericComponent, propsFactory, useRender } from '@/util'
8+
9+
export const makeVCardActionsProps = propsFactory({
10+
...makeComponentProps(),
11+
...makeTagProps(),
12+
}, 'VCardActions')
713

814
export const VCardActions = genericComponent()({
915
name: 'VCardActions',
1016

11-
props: makeComponentProps(),
17+
props: makeVCardActionsProps(),
1218

1319
setup (props, { slots }) {
1420
provideDefaults({
@@ -19,15 +25,14 @@ export const VCardActions = genericComponent()({
1925
})
2026

2127
useRender(() => (
22-
<div
28+
<props.tag
2329
class={[
2430
'v-card-actions',
2531
props.class,
2632
]}
2733
style={ props.style }
28-
>
29-
{ slots.default?.() }
30-
</div>
34+
v-slots={ slots }
35+
/>
3136
))
3237

3338
return {}

packages/vuetify/src/components/VCard/VCardItem.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { VIcon } from '@/components/VIcon'
99
import { makeComponentProps } from '@/composables/component'
1010
import { makeDensityProps } from '@/composables/density'
1111
import { IconValue } from '@/composables/icons'
12+
import { makeTagProps } from '@/composables/tag'
1213

1314
// Utilities
1415
import { toDisplayString } from 'vue'
@@ -38,6 +39,7 @@ export const makeCardItemProps = propsFactory({
3839

3940
...makeComponentProps(),
4041
...makeDensityProps(),
42+
...makeTagProps(),
4143
}, 'VCardItem')
4244

4345
export const VCardItem = genericComponent<VCardItemSlots>()({
@@ -55,7 +57,7 @@ export const VCardItem = genericComponent<VCardItemSlots>()({
5557
const hasSubtitle = !!(props.subtitle != null || slots.subtitle)
5658

5759
return (
58-
<div
60+
<props.tag
5961
class={[
6062
'v-card-item',
6163
props.class,
@@ -157,7 +159,7 @@ export const VCardItem = genericComponent<VCardItemSlots>()({
157159
)}
158160
</div>
159161
)}
160-
</div>
162+
</props.tag>
161163
)
162164
})
163165

0 commit comments

Comments
 (0)