@molecule/app-mini-calendar-svelte

Feature · mini-calendar · App (browser) · v1.1.2 · Apache-2.0

Month-view calendar with day selection and prev/next navigation

npm install @molecule/app-mini-calendar-svelte

npm · Source on GitHub

How it works

@molecule/app-mini-calendar-svelte is a ready-made mini-calendar feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

<script lang="ts">
  import { setMoleculeContext } from '@molecule/app-svelte'
  import { MiniCalendar } from '@molecule/app-mini-calendar-svelte'

  setMoleculeContext({ i18n: i18nProvider })

  let selected = $state<Date | undefined>(new Date(2026, 5, 15))
</script>

<MiniCalendar
  {selected}
  onSelect={(date) => {
    selected = date
    console.log(date.toISOString())
  }}
  locale="en-US"
/>

Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte

Reference

Svelte mini month-view calendar.

Exports <MiniCalendar> — compact day picker with prev/next navigation, Intl-localized weekday + month names, controlled-optional selected + month props, and an isDisabled day predicate. It is the Svelte counterpart of @molecule/app-mini-calendar-react: same props (React names), same DOM for the same input, same ClassMap tokens and the same callbacks.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

<script lang="ts">
  import { setMoleculeContext } from '@molecule/app-svelte'
  import { MiniCalendar } from '@molecule/app-mini-calendar-svelte'

  setMoleculeContext({ i18n: i18nProvider })

  let selected = $state<Date | undefined>(new Date(2026, 5, 15))
</script>

<MiniCalendar
  {selected}
  onSelect={(date) => {
    selected = date
    console.log(date.toISOString())
  }}
  locale="en-US"
/>

Type

feature

Installation

npm install @molecule/app-mini-calendar-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

MiniCalendarProps

Props for MiniCalendar — the same props (React names) as @molecule/app-mini-calendar-react.

interface MiniCalendarProps {
  /** Controlled selected date (ISO yyyy-mm-dd or Date). */
  selected?: Date | string
  /** Called when the user picks a day. */
  onSelect?: (date: Date) => void
  /** Controlled visible month. If omitted the component tracks its own. */
  month?: Date
  /** Called when the user navigates months. */
  onMonthChange?: (date: Date) => void
  /**
   * Locale for weekday + month name formatting. Defaults to the app's active
   * locale, which follows a locale switch; an explicit `locale` still wins.
   */
  locale?: string
  /** Optional day-disabled predicate. */
  isDisabled?: (date: Date) => boolean
  /** Extra classes. */
  className?: string
}

Constants

MiniCalendar

const MiniCalendar: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-svelte ^1.1.0
  • svelte ^5.0.0

Runtime Dependencies

  • @molecule/app-svelte
  • @molecule/app-ui
  • @molecule/app-ui-svelte
  • svelte

Requires a wired ClassMap bond (setClassMap(...) at startup) — getClassMap() throws before wiring, and the prev/next buttons come from @molecule/app-ui-svelte.

Weekday and month names come from Intl.DateTimeFormat(locale) — an explicit locale prop wins, otherwise the app's active locale, so they follow a locale switch. The prev/next buttons' aria-labels go through t() (miniCalendar.aria.previousMonth / miniCalendar.aria.nextMonth, English defaultValues); translations live in the @molecule/app-locales-mini-calendar bond.

When month is supplied the visible month is fully controlled — wire onMonthChange too or the arrows will appear dead. The grid always renders 6 weeks; days outside the visible month render dimmed and remain clickable unless isDisabled filters them.

Translations

Translation strings are provided by @molecule/app-locales-mini-calendar.