Litopis GitHub

Styling

Choose Base, Foundation or an adapter for your UI library.

Theme playground

Select a stylesheet to see the generated field and calendar styles.

Foundation supplies the calendar layout. Set the --litopis-* variables to match your colours, spacing and type scale.

css
@import "@litopis/dom/styles/foundation.css";

.litopis {
  --litopis-accent: var(--brand);
  --litopis-background: var(--surface);
}

Unstyled by default

Importing Litopis JavaScript adds interaction and accessible semantics, not CSS. Add your own styles when the picker needs to follow an existing design system.

The playground uses a Litopis-generated input. If you supply your own input with slot="input", Litopis keeps its classes and the host stylesheet styles that field.

Four styling layers

Choose one stylesheet. Base gives generated fields and the calendar neutral defaults. Foundation lets you define calendar tokens. Adapters map the calendar to a supported UI library's theme variables. Generated fields keep Litopis's generic field defaults.

css
@import "@litopis/dom/styles/base.css";
css
@import "@litopis/dom/styles/foundation.css";

.litopis {
  --litopis-accent: var(--brand);
  --litopis-accent-foreground: var(--on-brand);
  --litopis-background: var(--surface);
  --litopis-border: var(--outline);
  --litopis-border-width: 1px;
  --litopis-calendar-radius: 20px;
  --litopis-danger: var(--danger);
  --litopis-disabled: var(--text-disabled);
  --litopis-focus-ring: color-mix(in oklab, var(--brand) 24%, transparent);
  --litopis-foreground: var(--text);
  --litopis-muted: var(--surface-muted);
  --litopis-muted-foreground: var(--text-muted);
  --litopis-popover-shadow: 0 18px 48px rgb(0 0 0 / 12%);
  --litopis-radius: 8px;
}

CSS variables

Use these variables for colours, borders, radius, spacing and motion. They let you tune the picker without replacing its stylesheet.

Input tokens apply to Litopis-generated fields. A slotted input keeps its host classes and uses the host's input styling.

css
.litopis {
  /* Geometry */
  --litopis-width: 360px;
  --litopis-control-size: 40px;
  --litopis-comfortable-target-size: 44px;
  --litopis-day-size: 40px;
  --litopis-calendar-padding: 12px;
  --litopis-field-gap: 12px;

  /* Typography and motion */
  --litopis-font-family: inherit;
  --litopis-label-font-size: 14px;
  --litopis-transition-duration: 150ms;
  --litopis-active-scale: .96;

  /* Optional semantic refinements */
  --litopis-input-background: var(--litopis-background);
  --litopis-calendar-background: var(--litopis-background);
  --litopis-hover-background: var(--litopis-muted);
  --litopis-selected-background: var(--litopis-accent);
}

The default width follows panels: one calendar is 360px and two are capped at 720px. Override the same token when the host layout needs another responsive breakpoint.

css
.travel-picker[data-panels="2"] {
  --litopis-width: 720px;
}

@media (max-width: 42rem) {
  .travel-picker[data-panels="auto"] {
    --litopis-width: 360px;
  }
}
Group Representative tokens Controls
Theme --litopis-accent, --litopis-background, --litopis-foreground, --litopis-border Primary colors, surfaces, text and outlines
Semantic states --litopis-hover-background, --litopis-selected-background, --litopis-danger, --litopis-disabled Hover, selection, errors and unavailable dates
Geometry --litopis-width, --litopis-control-size, --litopis-day-size, --litopis-calendar-padding Calendar width, hit areas, grid and spacing
Input sizing --litopis-input-height Generated field height, independent of calendar buttons
Typography --litopis-font-family, --litopis-label-font-size, --litopis-caption-font-weight Inherited type system and component hierarchy
Focus and motion --litopis-focus-ring, --litopis-focus-width, --litopis-transition-duration, --litopis-active-scale Visible focus and interaction feedback
Popover --litopis-popover-shadow, --litopis-popover-z-index, --litopis-popover-anchor-gap Elevation and viewport positioning

Anatomy

Use these classes and data-* states when a CSS variable is not enough.

css
.litopis
.litopis[data-mode="popover"]
.litopis[data-size="comfortable"]
.litopis-input
.litopis-grid
.litopis-day[data-selected]
.litopis-day[data-today]
.litopis-day[data-outside-month]
.litopis-month-button
.litopis-year-button

Popover CSS

The popover variant uses the browser top layer and CSS anchors.

css
.litopis[data-mode="popover"] .litopis-calendar {
  position: fixed;
  max-width: calc(100vw - var(--litopis-calendar-viewport-gap));
  z-index: var(--litopis-popover-z-index);
}

.litopis-calendar[popover]:not(:popover-open) {
  display: none;
}

@supports (top: anchor(bottom)) {
  .litopis[data-mode="popover"] .litopis-calendar {
    top: anchor(bottom);
    left: anchor(left);
    margin-top: var(--litopis-popover-anchor-gap);
    position-try-fallbacks: flip-block, flip-inline;
  }
}

Theme adapters

Each adapter maps the Litopis calendar to the selected UI library's theme variables. It adds no JavaScript. Generated inputs use generic Litopis field defaults. A slotted input keeps the host classes and field styles. For example, use DaisyUI's input class directly on the supplied input.

css
@import "tailwindcss";
@import "@litopis/dom/styles/daisyui.css";
@plugin "daisyui";
css
@import "tailwindcss";
@import "shadcn/tailwind.css";
@import "@litopis/dom/styles/shadcn.css";
css
@import "bootstrap/dist/css/bootstrap.css";
@import "@litopis/dom/styles/bootstrap.css";

Import one adapter only. daisyUI maps --color-* and --radius-*. The shadcn adapter maps semantic surface and foreground pairs such as --primary, --popover and --ring. The Bootstrap adapter maps --bs-* variables and follows data-bs-theme color modes.

Overrides

Use --litopis-* variables for colour and size. Use .litopis-* selectors and data-* states for structural changes. Litopis does not add daisyUI, shadcn or Bootstrap classes. Add your UI library's input class to a supplied input yourself.