-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(VDateInput): create new component (#19680)
- Loading branch information
1 parent
5e40cc8
commit e9d132f
Showing
16 changed files
with
484 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"props": { | ||
"hideWeekdays": "Hide the days of the week letters.", | ||
"transition": "The transition used when changing months into the future", | ||
"reverseTransition": "The transition used when changing months into the past" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"props": { | ||
"landscape": "Puts the picker into landscape mode.", | ||
"hideHeader": "Hide the picker header." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"props": { | ||
"displayValue": "The value that determines the month to show. This is different from modelValue, which determines the selected value.", | ||
"month": "The current month number to show", | ||
"weekdays": "An array of weekdays to display.", | ||
"weeksInMonth": "A dynamic number of weeks in a month will grow and shrink depending on how many days are in the month. A static number always shows 7 weeks.", | ||
"year": "The current year number to show" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/docs/src/examples/v-date-input/misc-passenger.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<v-card class="mx-auto" max-width="420"> | ||
<v-layout> | ||
<v-system-bar color="#4603c0"> | ||
<v-icon icon="mdi-square"></v-icon> | ||
|
||
<v-icon icon="mdi-circle"></v-icon> | ||
|
||
<v-icon icon="mdi-triangle"></v-icon> | ||
</v-system-bar> | ||
|
||
<v-app-bar color="#6200ee" title="Passenger information" flat> | ||
<template v-slot:prepend> | ||
<v-btn icon="mdi-arrow-left"></v-btn> | ||
</template> | ||
</v-app-bar> | ||
|
||
<v-main> | ||
<v-container class="pt-8"> | ||
<v-text-field | ||
label="Name" | ||
model-value="John Leider" | ||
variant="outlined" | ||
></v-text-field> | ||
|
||
<v-date-input | ||
label="Date of birth" | ||
prepend-icon="" | ||
variant="outlined" | ||
persistent-placeholder | ||
></v-date-input> | ||
|
||
<v-text-field label="Address" variant="outlined"></v-text-field> | ||
<v-text-field label="City" variant="outlined"></v-text-field> | ||
|
||
<div class="d-flex ga-2"> | ||
<v-text-field label="State" variant="outlined"></v-text-field> | ||
|
||
<v-text-field label="Zip code" variant="outlined"></v-text-field> | ||
</div> | ||
</v-container> | ||
</v-main> | ||
</v-layout> | ||
|
||
<template v-slot:actions> | ||
<v-btn color="#4603c0" disabled>Prev</v-btn> | ||
|
||
<v-spacer></v-spacer> | ||
|
||
<v-btn color="#4603c0">Next</v-btn> | ||
</template> | ||
</v-card> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<div class="d-flex justify-center"> | ||
<v-date-input | ||
v-model="model" | ||
label="Select a date" | ||
max-width="368" | ||
></v-date-input> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { shallowRef } from 'vue' | ||
const model = shallowRef(null) | ||
</script> | ||
|
||
<script> | ||
export default { | ||
data: () => ({ | ||
model: null, | ||
}), | ||
} | ||
</script> |
24 changes: 24 additions & 0 deletions
24
packages/docs/src/examples/v-date-input/prop-multiple-range.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<div class="d-flex justify-center"> | ||
<v-date-input | ||
v-model="model" | ||
label="Select range" | ||
max-width="368" | ||
multiple="range" | ||
></v-date-input> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { shallowRef } from 'vue' | ||
const model = shallowRef(null) | ||
</script> | ||
|
||
<script> | ||
export default { | ||
data: () => ({ | ||
model: null, | ||
}), | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<div class="d-flex justify-center"> | ||
<v-date-input | ||
v-model="model" | ||
label="Select day(s)" | ||
max-width="368" | ||
multiple | ||
></v-date-input> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { shallowRef } from 'vue' | ||
const model = shallowRef(null) | ||
</script> | ||
|
||
<script> | ||
export default { | ||
data: () => ({ | ||
model: null, | ||
}), | ||
} | ||
</script> |
22 changes: 22 additions & 0 deletions
22
packages/docs/src/examples/v-date-input/prop-prepend-icon.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<v-row dense> | ||
<v-col cols="12" md="6"> | ||
<v-date-input | ||
label="Select a date" | ||
prepend-icon="" | ||
prepend-inner-icon="$calendar" | ||
variant="solo" | ||
></v-date-input> | ||
|
||
</v-col> | ||
|
||
<v-col cols="12" md="6"> | ||
<v-date-input | ||
label="Select a date" | ||
prepend-icon="" | ||
variant="solo" | ||
></v-date-input> | ||
|
||
</v-col> | ||
</v-row> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<ExamplesUsageExample | ||
v-model="model" | ||
:code="code" | ||
:name="name" | ||
:options="options" | ||
> | ||
<div> | ||
<v-date-input v-bind="props"></v-date-input> | ||
</div> | ||
|
||
<template v-slot:configuration> | ||
<v-checkbox v-model="clear" label="Clearable"></v-checkbox> | ||
|
||
<v-checkbox v-model="disabled" label="Disabled"></v-checkbox> | ||
</template> | ||
</ExamplesUsageExample> | ||
</template> | ||
|
||
<script setup> | ||
const name = 'v-date-input' | ||
const model = ref('default') | ||
const options = ['outlined', 'underlined', 'solo', 'solo-filled', 'solo-inverted'] | ||
const clear = ref(false) | ||
const counter = ref(false) | ||
const disabled = ref(false) | ||
const props = computed(() => { | ||
return { | ||
clearable: clear.value || undefined, | ||
counter: counter.value || undefined, | ||
disabled: disabled.value || undefined, | ||
label: 'Date input', | ||
variant: model.value === 'default' ? undefined : model.value, | ||
} | ||
}) | ||
const slots = computed(() => { | ||
return `` | ||
}) | ||
const code = computed(() => { | ||
return `<${name}${propsToString(props.value)}>${slots.value}</${name}>` | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--- | ||
emphasized: true | ||
meta: | ||
nav: Date inputs | ||
title: Date input component | ||
description: The date input is a specialized input that provides a clean interface for selecting dates, showing detailed selection information. | ||
keywords: date input, date picker, date field | ||
related: | ||
- /components/date-pickers/ | ||
- /components/text-fields/ | ||
- /components/menus/ | ||
features: | ||
label: 'C: VDateInput' | ||
report: true | ||
github: /labs/VDateInput/ | ||
--- | ||
|
||
# Date inputs | ||
|
||
The `v-date-input` component combines a text field with a date picker. It is meant to be a direct replacement for a standard date input. | ||
|
||
<PageFeatures /> | ||
|
||
::: warning | ||
|
||
This feature requires [v3.6.0](/getting-started/release-notes/?version=v3.6.0) | ||
|
||
::: | ||
|
||
## Installation | ||
|
||
Labs components require a manual import and installation of the component. | ||
|
||
```js { resource="src/plugins/vuetify.js" } | ||
import { VDateInput } from 'vuetify/labs/VDateInput' | ||
|
||
export default createVuetify({ | ||
components: { | ||
VDateInput, | ||
}, | ||
}) | ||
``` | ||
|
||
## Usage | ||
|
||
At its core, the `v-date-input` component is a basic container that extends [v-text-field](/components/text-fields). | ||
|
||
<ExamplesUsage name="v-date-input" /> | ||
|
||
<PromotedEntry /> | ||
|
||
## API | ||
|
||
| Component | Description | | ||
| - | - | | ||
| [v-date-input](/api/v-date-input/) | Primary component | | ||
| [v-date-picker](/api/v-date-picker/) | Date picker component | | ||
| [v-text-field](/api/v-text-field/) | Text field component | | ||
|
||
<ApiInline hide-links /> | ||
|
||
## Guide | ||
|
||
The `v-date-input` component is a replacement for the standard date input. It provides a clean interface for selecting dates and shows detailed selection information. | ||
|
||
### Props | ||
|
||
The `v-date-input` component extends the [v-text-field](/components/text-fields/) and [v-date-picker](/components/date-pickers/) component; and supports all of their props. | ||
|
||
#### Model | ||
|
||
The default model value is a Date object, but is displayed as formatted text in the input.. | ||
|
||
<ExamplesExample file="v-date-input/prop-model" /> | ||
|
||
#### Multiple | ||
|
||
Using the **multiple** prop, the default model value is an empty array. | ||
|
||
<ExamplesExample file="v-date-input/prop-multiple" /> | ||
|
||
#### Range | ||
|
||
Using the multiple prop with a value of **range**, select 2 dates to select them and all the dates between them. | ||
|
||
<ExamplesExample file="v-date-input/prop-multiple-range" /> | ||
|
||
#### Calendar icon | ||
|
||
You can move the calendar icon within the input or entirely by utilizing the **prepend-icon** and **prepend-inner-icon** properties. | ||
|
||
<ExamplesExample file="v-date-input/prop-prepend-icon" /> | ||
|
||
## Examples | ||
|
||
The following are a collection of examples that demonstrate more advanced and real world use of the `v-date-input` component. | ||
|
||
### Passenger | ||
|
||
In this example, the `v-date-input` component is used to select a date of birth. | ||
|
||
<ExamplesExample file="v-date-input/misc-passenger" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.