preact-flatpickr
v1.0.3
Published
Flatpickr component for Preact.
Downloads
9
Maintainers
Readme
📅 Preact Flatpickr
Flatpicker component for Preact.
Getting Started
Install the package by running:
npm install --save preact-flatpickr
Example
import { Component } from 'preact';
import Flatpickr from 'preact-flatpickr';
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
flatpickrConfig: {
'weekNumbers': true
}
}
}
render() {
return (
<div>
<Flatpickr
theme="dark"
config={this.state.flatpickrConfig}
onChange={() => console.log('You just changed the date.')}>
</Flatpickr>
</div>
);
}
}
API
Every Flatpickr configuration option is available.
You can check out every option here.
You can also set themes via the theme
attribute. Learn more about the options here.
License
- MIT
I'm new to Preact, so don't bite my head off. 😊