Vue-flatPickr
Vue.js v2.x component for Flatpickr date-time picker
If you are looking for the documentation of older version then switch to respective version branch.
Features
- Reactive
v-model
value- You can change flatpickr value programmatically
- Reactive config options
- You can change config options dynamically
- Component will watch for any changes and redraw itself
- You are suggested to modify config via Vue.set
- Emits all possible events
- Compatible with Bootstrap, Bulma or any other CSS framework
- Supports wrapped mode
- Just set
wrap:true
in config and component will take care of all
- Just set
- Play nice with vee-validate validation library
Installation
Usage
Minimal example
Detailed example
This example is based on Bootstrap 4 input group
As plugin
This will register a global component <flat-pickr>
Events
- The components emits all possible events, you can listen to them in your component
- Events names has been converted to kebab-case.
- You can still pass your methods in config like original flatpickr do.
Available props
The component accepts these props:
Attribute | Type | Default | Description |
---|---|---|---|
v-model / value | String / Date Object / Array / Timestamp / null | null |
Set or Get date-picker value (required) |
config | Object | {wrap:false} |
Flatpickr configuration options |
events | Array | Array of all events | Customise the events to be emitted |
Install in non-module environments (without webpack)
- Include required files
- Use the component anywhere in your app like this
Run examples on your localhost
- Clone this repo
- You should have node-js >=6.10 <7.0.0 || >=9.x and yarn >=1.x pre-installed
- Install dependencies
yarn install
- Run webpack dev server
yarn start
- This should open the demo page at
http://localhost:8000
in your default web browser