Skip to content

Commit 8a6c279

Browse files
committed
feat(VDivider): add variant prop
1 parent 60367cd commit 8a6c279

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"inset": "Adds indentation (72px) for **normal** dividers, reduces max height for **vertical**.",
55
"length": "Sets the dividers length. Default unit is px.",
66
"thickness": "Sets the dividers thickness. Default unit is px.",
7+
"variant": "Applies `border-style`.",
78
"vertical": "Displays dividers vertically."
89
}
910
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128
},
129129
"VDivider": {
130130
"props": {
131-
"gradient": "3.11.0"
131+
"gradient": "3.11.0",
132+
"variant": "3.11.0"
132133
}
133134
},
134135
"VExpansionPanels": {

packages/docs/src/examples/v-divider/prop-gradient.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
<template>
22
<v-container class="d-flex">
33
<div class="d-flex flex-column gr-4 py-8 flex-grow-1">
4-
<v-divider class="my-3" color="red" style="height: 300px;" thickness="3" gradient></v-divider>
5-
<v-divider thickness="3" gradient>OR</v-divider>
4+
<v-divider color="red" opacity=".7" thickness="3" gradient></v-divider>
5+
<v-divider opacity=".7" thickness="3" gradient>OR</v-divider>
66
<v-divider
77
color="primary"
8-
style="border-style: double"
8+
opacity=".7"
99
thickness="12"
10+
variant="double"
1011
gradient
1112
>
1213
AND
1314
</v-divider>
1415
</div>
1516
<div class="d-flex gc-8 px-8">
16-
<v-divider color="red" thickness="3" gradient vertical></v-divider>
17-
<v-divider thickness="3" gradient vertical>OR</v-divider>
17+
<v-divider color="red" opacity=".7" thickness="3" gradient vertical></v-divider>
18+
<v-divider opacity=".7" thickness="3" gradient vertical>OR</v-divider>
1819
<v-divider
1920
color="primary"
20-
style="border-style: double"
21+
opacity=".7"
2122
thickness="12"
23+
variant="double"
2224
gradient
2325
vertical
2426
>

packages/vuetify/src/components/VDivider/VDivider.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ import { makeThemeProps, provideTheme } from '@/composables/theme'
1010
import { computed } from 'vue'
1111
import { convertToUnit, genericComponent, propsFactory, useRender } from '@/util'
1212

13+
// Types
14+
import type { PropType } from 'vue'
15+
1316
type DividerKey = 'borderRightWidth' | 'borderTopWidth' | 'height' | 'width'
1417
type DividerStyles = Partial<Record<DividerKey, string>>
1518

19+
const allowedVariants = ['dotted', 'dashed', 'solid', 'double'] as const
20+
type Variant = typeof allowedVariants[number]
21+
1622
export const makeVDividerProps = propsFactory({
1723
color: String,
1824
gradient: Boolean,
@@ -21,6 +27,11 @@ export const makeVDividerProps = propsFactory({
2127
opacity: [Number, String],
2228
thickness: [Number, String],
2329
vertical: Boolean,
30+
variant: {
31+
type: String as PropType<Variant>,
32+
default: 'solid',
33+
validator: (v: any) => allowedVariants.includes(v),
34+
},
2435

2536
...makeComponentProps(),
2637
...makeThemeProps(),
@@ -66,6 +77,7 @@ export const VDivider = genericComponent()({
6677
dividerStyles.value,
6778
textColorStyles.value,
6879
{ '--v-border-opacity': props.opacity },
80+
{ 'border-style': props.variant },
6981
props.style,
7082
]}
7183
aria-orientation={

0 commit comments

Comments
 (0)