Menu
Libraries |
Category

timescape

A powerful, headless library that elegantly fills the void left by HTML's native `` and ``.

timescape is a toolkit for creating custom date and time input components. It helps you handle date and time data easily while giving you full control over the design and presentation. timescape supports multiple libraries, including React, Vue, Preact, Svelte, Solid, and native JavaScript.

Key features such as accessibility and keyboard navigation are at the core of timescape, allowing you to focus on creating user-centric date and time inputs that integrate seamlessly into your projects.

Features

  • ๐Ÿงข Headless Architecture: You control the UI โ€“ timescape handles the logic.
  • ๐Ÿงฉ Framework Compatibility: Adapters for React, Preact, Vue, Svelte, and Solid.
  • โš™ Flexible API: Hooks (or equivalents) return getters for seamless component integration. Order of inputs (i.e. format) is completely up to you by just rendering in the order you prefer.
  • ๐Ÿ‘ฅ Accessibility: Full A11y compliance, keyboard navigation and manual input.
  • โฐ Date and time flexibility: Supports min/max dates and 24/12 hour clock formats.
  • ๐Ÿชถ Lightweight: No external dependencies.
  • ๐Ÿ”€ Enhanced input fields: A supercharged <input type="date/time">, offering additional flexibility.
  • ๐Ÿคณ Touch device support: Use it on any device, including touch devices.

Options

The options passed to timescape are the initial values. timescape returns the options either as store/signal or with an updater function (depending on the library you are using).

type Options = {
  date?: Date;
  minDate?: Date | $NOW; // see more about $NOW below
  maxDate?: Date | $NOW;
  hour12?: boolean;
  wrapAround?: boolean;
  digits?: "numeric" | "2-digit";
  snapToStep?: boolean;
  wheelControl?: boolean;
  disallowPartial?: boolean
};

$NOW value

`$NOW

dateinputtimeheadlessreactsveltevuesolidjs

Comments