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.
npm install @litopis/dom
<form>
<div id="appointment-picker"></div>
<button type="submit">Save</button>
</form>
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().
<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.
<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.
import "@litopis/dom/styles/base.css";