Litopis GitHub

Integrations / Web Components

Web Components

@litopis/elements registers the <litopis-date-picker> custom element.

Installation

sh
npm install @litopis/elements @litopis/dom
ts
import "@litopis/elements";
import "@litopis/dom/styles/base.css";

Example

HTML attributes

Component options use kebab-case attribute names.

html
<litopis-date-picker
  mode="popover"
  first-day-of-week="1"
  close-on-select="false"
  clear-button
  format="dd.mm.yyyy"
  label="Start date"
  today-button
></litopis-date-picker>

Range

Use one name. Split fields submit it as name[start] and name[end].

html
<litopis-date-picker
  selection="range"
  layout="split"
  name="stay"
  start="2026-06-12"
  end="2026-06-18"
></litopis-date-picker>

Value property

Read or set value as an ISO date string in YYYY-MM-DD format.

ts
import type { LitopisDatePickerElement } from "@litopis/elements";

const picker = document.querySelector<LitopisDatePickerElement>(
  "litopis-date-picker",
);

if (picker) {
  picker.value = "2026-07-19";
  console.log(picker.value);
}

CDN

Use the browser bundle without a build step. Replace VERSION with an exact version.

html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@litopis/dom@VERSION/styles/base.css" />
<script src="https://cdn.jsdelivr.net/npm/@litopis/elements@VERSION/dist/index.global.js"></script>

Styling

Import a Litopis stylesheet, then override its CSS variables or selectors as needed.

Styling guide →