Flatpickr component for Preact ported from react-flatpickr.
Install the package by running: npm install --save preact-flatpickr
or yarn add preact-flatpickr
import 'flatpickr/dist/themes/material_green.css' import { Component, h } from 'preact' import Flatpickr from 'preact-flatpickr' class App extends Component { constructor() { super(); this.state = { date: new Date() }; } render(props, state) { return ( <Flatpickr value={state.date} onChange={date => { this.setState({date}) }} /> ) } }
flatpickr options
: you can pass all flatpickr parameters
to props.options
props.options
<Flatpickr options={{minDate: '2017-01-01'}} />
You can import the style for flatpickr manually, like so: import 'flatpickr/dist/themes/theme.css'
or you can use the theme
attribute:
<Flatpickr theme="material_green" value={date} onChange={date => { this.setState({date}) }} />
Learn more about the themes here.
Every Flatpickr configuration option is available. You can check out every option here.
I'm new to Preact, so don't bite my head off. 😊
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4