
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
vue-flatpickr-component
Advanced tools
Vue.js component for Flatpickr date-time picker.
Vue.js version | Package version | Branch |
---|---|---|
2.x | 8.x | 8.x |
3.x | 11.x | main |
v-model
value
npm install vue-flatpickr-component@^11
<template>
<flat-pickr v-model="date"/>
</template>
<script setup>
import {ref} from 'vue';
import flatPickr from 'vue-flatpickr-component';
import 'flatpickr/dist/flatpickr.css';
const date = ref(null);
</script>
Using Bootstrap input group and Font Awesome icons
<template>
<section>
<div class="form-group">
<label>Select a date</label>
<div class="input-group">
<flat-pickr
v-model="date"
:config="config"
class="form-control"
placeholder="Select date"
name="date"/>
<div class="input-group-append">
<button class="btn btn-default" type="button" title="Toggle" data-toggle>
<i class="fa fa-calendar"/>
<span aria-hidden="true" class="sr-only">Toggle</span>
</button>
<button class="btn btn-default" type="button" title="Clear" data-clear>
<i class="fa fa-times"/>
<span aria-hidden="true" class="sr-only">Clear</span>
</button>
</div>
</div>
</div>
<pre>Selected date is - {{date}}</pre>
</section>
</template>
<script setup>
import {ref} from 'vue';
import 'bootstrap/dist/css/bootstrap.css';
// import this component
import flatPickr from 'vue-flatpickr-component';
import 'flatpickr/dist/flatpickr.css';
// theme is optional
// try more themes at - https://flatpickr.js.org/themes/
import 'flatpickr/dist/themes/material_blue.css';
// localization is optional
import {Hindi} from 'flatpickr/dist/l10n/hi.js';
const date = ref('2022-10-28');
// Read more at https://flatpickr.js.org/options/
const config = ref({
wrap: true, // set wrap to true only when using 'input-group'
altFormat: 'M j, Y',
altInput: true,
dateFormat: 'Y-m-d',
locale: Hindi, // locale for this instance only
});
</script>
<flat-pickr v-model="date" @on-change="doSomethingOnChange" @on-close="doSomethingOnClose"/>
:config
like original flatpickr do.The component accepts these props:
Attribute | Type | Default | Description |
---|---|---|---|
v-model | 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 sensible events | Customise the events to be emitted |
<!-- Flatpickr related files -->
<link href="https://cdn.jsdelivr.net/npm/flatpickr@4/dist/flatpickr.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/flatpickr@4/dist/flatpickr.min.js"></script>
<!-- Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@3.3"></script>
<!-- Lastly add this package -->
<script src="https://cdn.jsdelivr.net/npm/vue-flatpickr-component@11"></script>
<script>
const app = Vue.createApp({})
app.component('flat-pickr', VueFlatpickr.default);
app.mount("#app");
</script>
>=20.11
and pnpm >=8.x
pre-installedpnpm install
npm start
__test__
folder.npm test
Please see CHANGELOG for more information what has changed recently.
MIT License
FAQs
Vue.js component for Flatpickr date-time picker
The npm package vue-flatpickr-component receives a total of 44,421 weekly downloads. As such, vue-flatpickr-component popularity was classified as popular.
We found that vue-flatpickr-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.