A simple svelte scrollable date picker component. A native ios/android like date picker for the web.
Add it to your svelte project:
$ npm i svelte-date-picker-scroller --save
Then, pop it into the component that suites you:
<script>
import DatePickerScroller from 'svelte-date-picker-scroller';
</script>
<DatePickerScroller />
Property | Type | Required? | Description |
---|---|---|---|
selectedDate | Date |
Initial selected date to which the date picker will auto scroll to on mount | |
maxDate | Date |
Max date that can be picked | |
minDate | Date |
Min date that can be picked | |
noOfVisibleRows | number |
No of rows that need to be visible in the date picker window | |
rowItemHeight | number |
Row item height in px. | |
rowItemStyles | object |
Row item custom style object | |
activeRowItemStyles | object |
Active row item custom style object |
day
- Slot for rendering day textday: number
- day index (-1 for filler(empty item))month
- Slot for rendering month textmonth: number
- month index (-1 for filler(empty item))year
- Slot for rendering year textyear: number
- year (-1 for filler(empty item))activeRowHighlighter
- Slot for the active row highlight overlayselection
- Fired after any of the (day/month/year) selection changes.detail
type: Date
Found an problem? Submit an issue
Everything you need to build a Svelte library, powered by create-svelte
.
Read more about creating a library in the docs.
If you're seeing this, you've probably already done this step. Congrats!
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
Once you've created a project and installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
Everything inside src/lib
is part of your library, everything inside src/routes
can be used as a showcase or preview app.
To build your library:
npm run package
To create a production version of your showcase app:
npm run build
You can preview the production build with npm run preview
.
To deploy your app, you may need to install an adapter for your target environment.
Go into the package.json
and give your package the desired name through the "name"
option. Also consider adding a "license"
field and point it to a LICENSE
file which you can create from a template (one popular option is the MIT license).
To publish your library to npm:
npm publish