@molecule/app-footer-svelte

Feature · footer · App (browser) · v1.2.1 · Apache-2.0

App-shell footer with About link, Privacy/Terms modals (i18n-loaded HTML), language picker, and version display

npm install @molecule/app-footer-svelte

npm · Source on GitHub

How it works

@molecule/app-footer-svelte is a ready-made footer 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 { AppFooter } from '@molecule/app-footer-svelte'

  const loadContent = async (key: 'privacyPolicy' | 'termsOfService') => {
    // lazy-load the legal HTML into the i18n catalog before the modal opens
  }
</script>

<AppFooter appName="Bearing" aboutHref="https://example.com" {loadContent} />

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

Reference

Svelte app-shell footer — the Svelte counterpart of @molecule/app-footer-react, with the same props and the same DOM: About link, Privacy/Terms surfaces (in-place modals or route links), language-picker modal, and version display.

Reproduces the Footer pattern that appears in 9 flagship apps with one line of variation (external WEBSITE_URL vs internal /about — handled by detecting http/https schemes in aboutHref).

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 { AppFooter } from '@molecule/app-footer-svelte'

  const loadContent = async (key: 'privacyPolicy' | 'termsOfService') => {
    // lazy-load the legal HTML into the i18n catalog before the modal opens
  }
</script>

<AppFooter appName="Bearing" aboutHref="https://example.com" {loadContent} />

Type

feature

Installation

npm install @molecule/app-footer-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

AppFooterProps

Props for the AppFooter component.

interface AppFooterProps {
  /** Display name interpolated into the "About {{appName}}" link. */
  appName: string
  /**
   * URL or path for the About link. URLs starting with `http`/`https` are
   * rendered as `<a target="_blank">`; other values are rendered as an
   * in-app link that navigates through the router.
   */
  aboutHref: string
  /**
   * How privacy/terms surfaces are presented:
   * - `'modal'` (default) — buttons that open in-place modals with HTML pulled
   *   from the bonded i18n catalog (`content.privacyPolicy` / `content.termsOfService`).
   *   Pass `loadContent` to lazy-load the catalog body before opening.
   * - `'route'` — in-app links to `/privacy` and `/terms` for apps that render
   *   the legal pages on their own routes.
   */
  legalMode?: 'modal' | 'route'
  /**
   * Optional preloader called immediately before the privacy/terms modals
   * open. Only used when `legalMode === 'modal'`. Apps that lazy-load their
   * legal HTML pass `loadContent` from their config; apps that ship the
   * content statically can omit this.
   */
  loadContent?: AppFooterLoadContent
  /** Path for the Privacy Policy route. Only used when `legalMode === 'route'`. Default: `/privacy`. */
  privacyTo?: string
  /** Path for the Terms of Service route. Only used when `legalMode === 'route'`. Default: `/terms`. */
  termsTo?: string
  /** Extra className on the outer `<footer>` (composed with `cm.footerBar`). */
  className?: string
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
}

Types

AppFooterLoadContent

The preloader loadContent takes: called immediately before the privacy/terms modals open, so an app can lazy-load its legal HTML into the i18n catalog. Only used when legalMode === 'modal'.

type AppFooterLoadContent = (key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void

Constants

AppFooter

const AppFooter: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.6.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

The appName interpolated into the Privacy/Terms modal HTML is HTML-escaped first — the modal bodies render as raw HTML, so a markup-carrying app name must arrive as inert entities.

  • Must render inside BOTH @molecule/app-svelte's router context (setMoleculeContext({ router }) — the internal About link and legalMode="route" links navigate through it, exactly as the React footer requires a react-router-dom router) and its i18n context — useTranslation() THROWS without the provider. getClassMap() needs a bonded ClassMap (e.g. @molecule/app-ui-tailwind); version display works unbonded (the version core falls back to a web provider).
  • The privacy/terms modals render whatever HTML the i18n catalog holds under content.privacyPolicy / content.termsOfService. The companion @molecule/app-locales-footer bond ships those keys EMPTY BY DESIGN — a generic default policy would be legally wrong to present as an app's own — so the app MUST register its real legal HTML: add it to the app's locale catalog (scaffolded apps lazy-load it via loadContent from config.ts), wire the generic-template @molecule/app-locales-legal-default bond, or use legalMode="route" and render your own /privacy and /terms pages. Until content is registered the modal shows a clear footer.legalNotConfigured placeholder ("…the app owner must provide it.") instead of a blank modal — no fabricated legal text is ever shipped.
  • The language picker lists every locale registered on the i18n provider — wire i18n so only locales your app translated appear.

Translations

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