@molecule/app-onboarding-modal-svelte

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

npm · Source on GitHub

How it works

@molecule/app-onboarding-modal-svelte 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.

<script lang="ts">
  import { OnboardingModal, type OnboardingStep } from '@molecule/app-onboarding-modal-svelte'

  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.' },
  ]

  let open = $state(true)
</script>

<OnboardingModal {open} {steps} onClose={() => (open = false)} onComplete={() => (open = false)} />

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

Reference

Svelte multi-step onboarding overlay.

Exports <OnboardingModal> and the OnboardingStep type. It is the Svelte 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

<script lang="ts">
  import { OnboardingModal, type OnboardingStep } from '@molecule/app-onboarding-modal-svelte'

  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.' },
  ]

  let open = $state(true)
</script>

<OnboardingModal {open} {steps} onClose={() => (open = false)} onComplete={() => (open = false)} />

Type

feature

Installation

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

API

Interfaces

OnboardingStep

A single step in an onboarding flow, with a title, body, and optional media. Node-valued fields take a Svelte snippet (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: ReactNodeProp
  /** Step body. */
  body: ReactNodeProp
  /** Optional media / illustration. */
  media?: ReactNodeProp
}

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

const OnboardingModal: 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 and a Svelte i18n provider ancestor — the composed Modal / Button (from @molecule/app-ui-svelte) 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 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.