Litopis GitHub

Integrations

Choose a package for your framework or use the DOM package directly. Each framework guide starts with a complete component example.

Packages

Plain DOM

Install @litopis/dom. Add a container to your form and mount the picker.

sh
npm install @litopis/dom
html
<form>
  <div id="appointment-picker"></div>
  <button type="submit">Save</button>
</form>
ts
import { createDatePicker } from "@litopis/dom";
import "@litopis/dom/styles/base.css";

const root = document.querySelector<HTMLElement>("#appointment-picker");

if (root) {
  const picker = createDatePicker(root, {
    mode: "popover",
    label: "Appointment date",
    name: "appointment",
  });

  picker.getISOValue();
}

Place your input directly inside the root with slot="input" before calling createDatePicker().

html
<div id="picker">
  <input slot="input" class="my-input" placeholder="Choose a date" />
</div>

Litopis keeps the supplied input and its classes. Put your UI library's input class on this element to keep its native field styling. For DaisyUI, use input and input-lg with validator for its invalid-state color. See the DaisyUI guide.

html
<div id="picker">
  <input slot="input" class="input input-lg validator" placeholder="Choose a date" />
</div>

See the API reference for options and controller methods.

CSS

Packages do not load CSS. Import one Litopis stylesheet in your application entry.

ts
import "@litopis/dom/styles/base.css";
Styling guide →