All Projects → 6eDesign → Svelte Calendar

6eDesign / Svelte Calendar

Licence: mit
A lightweight datepicker with neat animations and a unique UX.

Projects that are alternatives of or similar to Svelte Calendar

Vue Calendar
🏆 基于 vue 2.0 开发的轻量,高性能日历组件
Stars: ✭ 828 (+196.77%)
Mutual labels:  datepicker, calendar-component
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (+53.76%)
Mutual labels:  datepicker, calendar-component
Primedatepicker
PrimeDatePicker is a tool that provides picking a single day, multiple days, and a range of days.
Stars: ✭ 292 (+4.66%)
Mutual labels:  datepicker, calendar-component
s-date-range-picker
📅 A date range picker built with Svelte
Stars: ✭ 13 (-95.34%)
Mutual labels:  svelte, datepicker
react-calendar
A no dependencies, lightweight and feature-rich ⚡ calendar component for react.
Stars: ✭ 68 (-75.63%)
Mutual labels:  datepicker, calendar-component
Date Picker
Duet Date Picker is an open source version of Duet Design System’s accessible date picker. Try live example at https://duetds.github.io/date-picker/
Stars: ✭ 1,325 (+374.91%)
Mutual labels:  datepicker, calendar-component
Vue Functional Calendar
Vue.js Functional Calendar | Component/Package
Stars: ✭ 314 (+12.54%)
Mutual labels:  datepicker, calendar-component
praecox-datepicker
A date picker built with Svelte.Simple and flexible, supporting functions such as single selection, multiple selection, disabling, and marking.
Stars: ✭ 66 (-76.34%)
Mutual labels:  datepicker, calendar-component
Blazor.PersianDatePicker
A free JavaScript Jalali (Persian) and Gregorian (Miladi) dual datepicker library for Blazor applications
Stars: ✭ 40 (-85.66%)
Mutual labels:  datepicker, calendar-component
svelty-picker
Simple date & time picker in svelte
Stars: ✭ 38 (-86.38%)
Mutual labels:  svelte, datepicker
svelte-interview-questions
Concepts and Questions related to Svelte - Part of official Svelte resources list
Stars: ✭ 18 (-93.55%)
Mutual labels:  svelte
actus
A monorepo for a self learning command palette driven by a final state machine implemented in XState.
Stars: ✭ 43 (-84.59%)
Mutual labels:  svelte
vue2-calendar
A lightweight calendar component for Vue2
Stars: ✭ 54 (-80.65%)
Mutual labels:  calendar-component
SENT-template
Skip setup and start code with SENT (Sapper Express Node Template) and other tools
Stars: ✭ 69 (-75.27%)
Mutual labels:  svelte
svelte-webcomponents
A ready-to-use project template to build custom elements (web components) with Svelte 3 with support and examples for web components, jest, sass, nested components with props, eslinting, stylelinting, Github actions, propagating custom events from shadow-DOM to real-DOM etc.
Stars: ✭ 22 (-92.11%)
Mutual labels:  svelte
kumiko
A kumiko pattern generator, based on any image
Stars: ✭ 42 (-84.95%)
Mutual labels:  svelte
svelte-algolia
Svelte plugin for keeping Algolia indices in sync with custom data fetching functions.
Stars: ✭ 17 (-93.91%)
Mutual labels:  svelte
svelte-search
Accessible, customizable Svelte search component
Stars: ✭ 17 (-93.91%)
Mutual labels:  svelte
rollup-plugin-svelte-hot
Fork of official rollup-plugin-svelte with added HMR support (for both Nollup or Rollup)
Stars: ✭ 49 (-82.44%)
Mutual labels:  svelte
Curi
A JavaScript router for single-page applications
Stars: ✭ 262 (-6.09%)
Mutual labels:  svelte

svelte-calendar

A small date picker built with Svelte 3. Demo available here: demo page.

Installation

npm i -D svelte-calendar

Basic usage

<script>
  import Datepicker from 'svelte-calendar';
</script>

<Datepicker start={minDate} end={maxDate} />

Props

prop name type default
start date one year in past
end date one year in future
selected date today
formattedSelected string today
dateChosen boolean false
selectableCallback function null
format string | function '#{m}/#{d}/#{Y}'
daysOfWeek array En-US Locale (see below)
monthsOfYear array En-US Locale (see below)
style string ""

start and end

These properties set the minimum and maximum dates that will be rendered by this calendar. It is recommended that you do not leave these as their defaults and supply values which suit your application's needs.

selected and formattedSelected

Bind to these properties to observe the selected date as either a date or a string. Use selected to set the day which is selected by default.

dateChosen

Bind to this property to observe whether a user has selected a day.

selectableCallback

Provide a function which accepts a date and returns a boolean determining whether a day between start and end is selectable. For example, use this to prevent weekend days from being selected.

format

Date formatting uses timeUtils formatting (MM/DD/YYYY by default). If you would like to use a different formatting library, supply a function which accepts a date and returns a string.

daysOfWeek and monthsOfYear

These two props are used to internationalize the calendar. The default values are:

export let daysOfWeek = [
  ['Sunday', 'Sun'],
  ['Monday', 'Mon'],
  ['Tuesday', 'Tue'],
  ['Wednesday', 'Wed'],
  ['Thursday', 'Thu'],
  ['Friday', 'Fri'],
  ['Saturday', 'Sat']
];

export let monthsOfYear = [
  ['January', 'Jan'],
  ['February', 'Feb'],
  ['March', 'Mar'],
  ['April', 'Apr'],
  ['May', 'May'],
  ['June', 'Jun'],
  ['July', 'Jul'],
  ['August', 'Aug'],
  ['September', 'Sep'],
  ['October', 'Oct'],
  ['November', 'Nov'],
  ['December', 'Dec']
];

style

This prop allows you to style the div which wraps the Datepicker component. This can be useful, for instance, if you'd like to do something like make the component full-width or display: block; (by default the element is inline-block). If you would like to style the button that triggers the opening of the datepicker we recommend you pass a custom element (button/link/etc) to the component via its default slot.

Kitchen Sink Example:

<script>
  const daysOfWeek = [
    [ 'Domingo', 'Dom' ],
    [ 'Lunes', 'Lun' ],
    [ 'Martes', 'Mar' ],
    [ 'Miércoles', 'Mié' ],
    [ 'Jueves', 'Jue' ],
    [ 'Viernes', 'Vie' ],
    [ 'Sábado', 'Sáb' ],
  ];
  const monthsOfYear = [
    [ 'Enero', 'Ene' ],
    [ 'Febrero', 'Feb' ],
    [ 'Marzo', 'Mar' ],
    [ 'Abril', 'Abr' ],
    [ 'Mayo', 'May' ],
    [ 'Junio', 'Jun' ],
    [ 'Julio', 'Jul' ],
    [ 'Agosto', 'Ago' ],
    [ 'Septiembre', 'Sep' ],
    [ 'Octubre', 'Oct' ],
    [ 'Noviembre', 'Nov' ],
    [ 'Diciembre', 'Dic' ],
  ];
</script>

<Datepicker
  bind:formattedSelected={selectedDateFormatted}
  bind:selected={selectedDate}
  bind:dateChosen={userHasChosenDate}
  start={threeDaysInPast}
  end={inThirtyDays}
  selectableCallback={filterWeekends}
  daysOfWeek={daysOfWeek}
  monthsOfYear={monthsOfYear}
  format={date => dayjs(date).format('DD/MM/YYYY')}
/>

Developing/Modifying Svelte-Calendar Guide

Note that you will need to have Node.js installed.

Install the dependencies...

cd svelte-calendar
npm install

...then start Rollup:

npm run dev

Navigate to localhost:5000. You should see your app running. Edit a component file in src, save it, and your browser will reload the page so you can see your changes automatically.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].