- Notifications
You must be signed in to change notification settings - Fork0
A simple datepicker UI library
License
webantic/webantic-datepicker
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A lightweight, no-css datepicker library.
Markup generated is super-minimal and confirms toRSCSS guidelines for easy styling.
Install withnpm i --save @webantic/datepicker
Just require (use something likebrowserify), give it a text input element and you're good to go.
varDatepicker=require('@webantic/datepicker')varpicker=newDatepicker(document.querySelector(".js-datepicker"))
Optionally, you can pass a config object as a second argument to the constructor. There are currently only two values:
locale: themomentjs locale to use (defaulten-gb). Currently supports:
en(US)en-gb(UK)cs(Serbia and Montenegro)es(Spain)fr(France)nl(Netherlands)
Don't ask why I picked these ones to support because I have no idea ¯\_(ツ)_/¯
format: themomentjs format for displaying the value in the input (defaultDD/MM/YYYY)
position: (default fixed) eitherabsolute orfixed. Represents the css position type. If fixed is used the popover will disappear on scroll.
hide() hides the picker
(more coming soon)
There's deliberately no styling bundled with the component but if you need something to get you started use the following:
.date-picker {& {width:100%;max-width:40rem;background:#fff;box-shadow:00.4rem0.8remrgba(0,0,0,0.4);box-sizing:border-box;padding:2rem;margin-top:1.4rem; }&:after {content:url('data:image/svg+xml;utf8,<svg height="13" width="16" xmlns="http://www.w3.org/2000/svg" version="1.1"><polygon points="0,10 7,0 14,10"></polygon></svg>');bottom:100%;left:0;right:0;position:absolute;width:1.3rem;height:1.3rem;margin:0auto;display:block; }& >.prev,& >.next {display:block;border:0.1remsolid#ddd;padding:1.5rem2rem;cursor:pointer;float:left;user-select:none; }& >.next {float:right; }& >.prev:hover,& >.next:hover {background:rgba(200,200,200,0.1); }& >.currentMonth {text-align:center;font-size:2rem;font-weight:100;margin:1.8remauto; } }.dates-display {& { }& >.dayHeading,& >.date {display:inline-block;width:14.285714%;line-height:4.5rem;text-align:center; }& >.dayHeading {font-size:1.2rem;font-weight:bold;vertical-align:bottom; }& >.date:not(.-empty){box-shadow:000.1rem#ddd;cursor:pointer; }& >.date:not(.-empty):hover {background:rgba(220,220,220,0.1); }& >.date:not(.-empty).-active {background:blue;color:#fff; } }
About
A simple datepicker UI library
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.