@molecule/app-footer-vue

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-vue

npm · Source on GitHub

How it works

@molecule/app-footer-vue 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.

import { createApp, defineComponent, h } from 'vue'
import { moleculePlugin, createI18nPlugin, createRouterPlugin } from '@molecule/app-vue'
import { AppFooter } from '@molecule/app-footer-vue'

const Shell = defineComponent({
  setup() {
    const loadContent = async (key: 'privacyPolicy' | 'termsOfService') => {
      // lazy-load the legal HTML into the i18n catalog before the modal opens
    }
    return () => h(AppFooter, { appName: 'Bearing', aboutHref: 'https://example.com', loadContent })
  },
})

const app = createApp(Shell)
app.use(createI18nPlugin(i18nProvider))
app.use(createRouterPlugin(router))
app.mount('#app')

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

Reference

App-shell footer — About link, Privacy/Terms surfaces (in-place modals or route links), language-picker modal, and version display.

Vue counterpart of @molecule/app-footer-react: the same props (React names), the same DOM for the same input, the same ClassMap tokens and i18n keys. Reproduces the Footer pattern that appears in 9 flagship apps with one line of variation (external WEBSITE_URL vs internal /about — handled here 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

import { createApp, defineComponent, h } from 'vue'
import { moleculePlugin, createI18nPlugin, createRouterPlugin } from '@molecule/app-vue'
import { AppFooter } from '@molecule/app-footer-vue'

const Shell = defineComponent({
  setup() {
    const loadContent = async (key: 'privacyPolicy' | 'termsOfService') => {
      // lazy-load the legal HTML into the i18n catalog before the modal opens
    }
    return () => h(AppFooter, { appName: 'Bearing', aboutHref: 'https://example.com', loadContent })
  },
})

const app = createApp(Shell)
app.use(createI18nPlugin(i18nProvider))
app.use(createRouterPlugin(router))
app.mount('#app')

Type

feature

Installation

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

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 a router
   * link that navigates in-app.
   */
  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'` — links to `/privacy` / `/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

App-shell footer — About link, Privacy/Terms modals, language picker, version.

Reproduces the Footer pattern that appears in 9 flagship apps with one line of variation (external WEBSITE_URL vs internal /about). Privacy/Terms HTML is loaded lazily through the loadContent callback when supplied, then rendered from the bonded i18n catalog (content.privacyPolicy, content.termsOfService). Those keys are EMPTY by default (the app supplies its real legal HTML); until it does, the modal shows a clear footer.legalNotConfigured placeholder rather than a silently-blank modal.

Vue counterpart of @molecule/app-footer-react's AppFooter — the same props (React names), the same DOM for the same input.

const AppFooter: DefineComponent<
  ExtractPropTypes<{
    appName: { type: StringConstructor; required: true }
    aboutHref: { type: StringConstructor; required: true }
    legalMode: { type: PropType<'modal' | 'route'>; default: string }
    loadContent: {
      type: PropType<(key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void>
      default: undefined
    }
    privacyTo: { type: StringConstructor; default: string }
    termsTo: { type: StringConstructor; default: string }
    className: StringConstructor
    dataMolId: StringConstructor
  }>,
  () => VNodeChild,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      appName: { type: StringConstructor; required: true }
      aboutHref: { type: StringConstructor; required: true }
      legalMode: { type: PropType<'modal' | 'route'>; default: string }
      loadContent: {
        type: PropType<(key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void>
        default: undefined
      }
      privacyTo: { type: StringConstructor; default: string }
      termsTo: { type: StringConstructor; default: string }
      className: StringConstructor
      dataMolId: StringConstructor
    }>
  > &
    Readonly<{}>,
  {
    legalMode: 'modal' | 'route'
    loadContent: (key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void
    privacyTo: string
    termsTo: string
  },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see AppFooterProps).

Returns: The footer component.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-vue ^1.1.0
  • @molecule/app-vue ^3.6.0 || ^4.0.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-ui
  • @molecule/app-ui-vue
  • @molecule/app-vue
  • vue

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

  • Must render inside BOTH the binding's router plugin (the About link and legalMode="route" links navigate through useRouter(), which throws outside it) and its i18n plugin — useTranslation() needs a provider (the bonded @molecule/app-i18n provider also satisfies it). 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 locale 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 a legal-default locale 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 with the locales your app actually translated.

Translations

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