@molecule/app-onboarding-modal-vue

Feature · onboarding-modal · App (browser) · v1.1.3 · Apache-2.0

Multi-step welcome / onboarding overlay with prev/next + skip

npm install @molecule/app-onboarding-modal-vue

npm · Source on GitHub

How it works

@molecule/app-onboarding-modal-vue is a ready-made onboarding-modal 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, ref } from 'vue'
import { OnboardingModal, type OnboardingStep } from '@molecule/app-onboarding-modal-vue'

const steps: OnboardingStep[] = [
  { id: 'welcome', title: 'Welcome!', body: 'Let us show you around.' },
  { id: 'features', title: 'Key Features', body: 'Build apps in minutes.' },
  { id: 'done', title: "You're all set", body: 'Start your first project.' },
]

const App = defineComponent({
  setup() {
    const open = ref(true)
    return () =>
      h(OnboardingModal, {
        open: open.value,
        steps,
        onClose: () => (open.value = false),
        onComplete: () => (open.value = false),
      })
  },
})

createApp(App).mount('#app')

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

Reference

Vue multi-step onboarding overlay.

Exports <OnboardingModal> and the OnboardingStep type. It is the Vue counterpart of @molecule/app-onboarding-modal-react: the same props (React names), the same DOM for the same input, and the same onClose / onComplete calls, so an app switches framework by changing only the package name in its imports.

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, ref } from 'vue'
import { OnboardingModal, type OnboardingStep } from '@molecule/app-onboarding-modal-vue'

const steps: OnboardingStep[] = [
  { id: 'welcome', title: 'Welcome!', body: 'Let us show you around.' },
  { id: 'features', title: 'Key Features', body: 'Build apps in minutes.' },
  { id: 'done', title: "You're all set", body: 'Start your first project.' },
]

const App = defineComponent({
  setup() {
    const open = ref(true)
    return () =>
      h(OnboardingModal, {
        open: open.value,
        steps,
        onClose: () => (open.value = false),
        onComplete: () => (open.value = false),
      })
  },
})

createApp(App).mount('#app')

Type

feature

Installation

npm install @molecule/app-onboarding-modal-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

OnboardingStep

A single step in an onboarding flow, with a title, body, and optional media. Node-valued fields take a Vue VNodeChild (or a plain string) instead of a React node.

interface OnboardingStep {
  /** Stable identity, used as the step dot's key. */
  id: string
  /** Step heading. */
  title: VNodeChild
  /** Step body. */
  body: VNodeChild
  /** Optional media / illustration. */
  media?: VNodeChild
}

OnboardingModalProps

Props accepted by the OnboardingModal component.

interface OnboardingModalProps {
  /** Whether the modal is open. */
  open: boolean
  /** Called when closing (skip / X / completion). React passes the click event for Skip and the chrome close button. */
  onClose?: (event?: unknown) => void
  /** Onboarding steps. */
  steps: OnboardingStep[]
  /** Called when the user clicks "Done" on the last step. */
  onComplete?: () => void
  /** Show "Skip" link in the footer. Defaults to true. */
  allowSkip?: boolean
  /** Initial step index (uncontrolled). */
  defaultStep?: number
}

Constants

OnboardingModal

Multi-step onboarding overlay — title + body + media, with prev/next navigation and an optional Skip link. Tracks its own step state.

Step position is UNCONTROLLED and persists across close/reopen — a user who closed on step 3 reopens on step 3. Remount the component (e.g. with a new key) to restart from defaultStep. onComplete fires only from the final-step button; closing via Skip or the chrome close button calls onClose alone — persist "onboarding seen" in onClose if skipping should count as done.

const OnboardingModal: DefineComponent<
  ExtractPropTypes<{
    open: { type: BooleanConstructor; required: true }
    onClose: { type: PropType<(event?: unknown) => void>; default: undefined }
    steps: { type: PropType<OnboardingStep[]>; default: () => never[] }
    onComplete: { type: PropType<() => void>; default: undefined }
    allowSkip: { type: BooleanConstructor; default: boolean }
    defaultStep: { type: NumberConstructor; default: number }
  }>,
  () => VNode | null,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      open: { type: BooleanConstructor; required: true }
      onClose: { type: PropType<(event?: unknown) => void>; default: undefined }
      steps: { type: PropType<OnboardingStep[]>; default: () => never[] }
      onComplete: { type: PropType<() => void>; default: undefined }
      allowSkip: { type: BooleanConstructor; default: boolean }
      defaultStep: { type: NumberConstructor; default: number }
    }>
  > &
    Readonly<{}>,
  {
    onClose: (event?: unknown) => void
    steps: OnboardingStep[]
    onComplete: () => void
    allowSkip: boolean
    defaultStep: number
  },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see OnboardingModalProps).

Returns: The onboarding overlay component, or nothing when there are no steps.

Injection Notes

Requirements

Peer dependencies:

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

Runtime Dependencies

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

Requires a wired ClassMap bond and a Vue I18n provider ancestor — the composed Modal / Button (from @molecule/app-ui-vue) and useTranslation() all depend on them. Pair with @molecule/app-locales-onboarding-modal for the Skip / Back / Next / Get-started strings in 79 languages.

Step position is UNCONTROLLED and persists across close/reopen — a user who closed on step 3 reopens on step 3. Remount the component (e.g. with a new key) to restart from defaultStep. onComplete fires only from the final-step button; closing via Skip or the chrome close button calls onClose alone — persist "onboarding seen" in onClose if skipping should count as done.

Translations

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