--- title: DatePicker description: 'An example of a date picker component built with v-calendar.' --- ## Installation This example is a composition of a [Popover](/components/popover) and [v-calendar](https://github.com/nathanreyes/v-calendar). We also use [date-fns](https://date-fns.org/) to format dates. ::callout{icon="i-heroicons-light-bulb"} Note that you can use any calendar library you want. :: Let's start by installing the `v-calendar` and `date-fns` dependency: ::code-group ```bash [pnpm] pnpm add v-calendar ``` ```bash [yarn] yarn add v-calendar ``` ```bash [npm] npm install v-calendar ``` :: ## Usage You can create a `DatePicker.vue` component based on the `DatePicker` from `v-calendar`. The following example is styled based on the `primary` and `gray` colors and supports the `dark` mode. It also supports a `v-model` or `v-model.range` depending on the type of date you want to use. ```vue [components/DatePicker.vue] ``` ## Examples ### DatePicker :component-example{component="date-picker-example"} ### DateRangePicker :component-example{component="date-picker-range-example"}