Skip to content

Commit fcf392b

Browse files
committed
feat(VDatePicker): add new prop header-color
allows you to set a different color for the header when also using the color prop
1 parent d96798a commit fcf392b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"eventColor": "Sets the color for event dot. It can be string (all events will have the same color) or `object` where attribute is the event date and value is boolean/color/array of colors for specified date or `function` taking date as a parameter and returning boolean/color/array of colors for that date.",
88
"events": "Array of dates or object defining events or colors or function returning boolean/color/array of colors.",
99
"expandIcon": "Icon used for **view-mode** toggle.",
10+
"headerColor": "Allows you to set a different color for the header when used in conjunction with the `color` prop.",
1011
"hideHeader": "Hides the header.",
1112
"hideWeekdays": "Hides the weekdays.",
1213
"landscape": "Changes the picker to landscape mode.",

packages/vuetify/src/components/VDatePicker/VDatePicker.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const makeVDatePickerProps = propsFactory({
5858
type: String,
5959
default: '$vuetify.datePicker.header',
6060
},
61+
headerColor: String,
6162

6263
...makeVDatePickerControlsProps(),
6364
...makeVDatePickerMonthProps({
@@ -136,6 +137,7 @@ export const VDatePicker = genericComponent<new <
136137

137138
return value && adapter.isValid(value) ? value : today
138139
})
140+
const headerColor = computed(() => props.headerColor ?? props.color)
139141

140142
const month = ref(Number(props.month ?? adapter.getMonth(adapter.startOfMonth(internal.value))))
141143
const year = ref(Number(props.year ?? adapter.getYear(adapter.startOfYear(adapter.setMonth(internal.value, month.value)))))
@@ -275,13 +277,15 @@ export const VDatePicker = genericComponent<new <
275277
const datePickerYearsProps = omit(VDatePickerYears.filterProps(props), ['modelValue'])
276278

277279
const headerProps = {
280+
color: headerColor.value,
278281
header: header.value,
279282
transition: headerTransition.value,
280283
}
281284

282285
return (
283286
<VPicker
284287
{ ...pickerProps }
288+
color={ headerColor.value }
285289
class={[
286290
'v-date-picker',
287291
`v-date-picker--${viewMode.value}`,

0 commit comments

Comments
 (0)