@molecule/app-page-chrome-svelte

Feature · page-chrome · App (browser) · v1.1.3 · Apache-2.0

Svelte page-header / hero-section primitives for SaaS apps

npm install @molecule/app-page-chrome-svelte

npm · Source on GitHub

How it works

@molecule/app-page-chrome-svelte is a ready-made page-chrome 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 { HeroSection, PageHeader } from '@molecule/app-page-chrome-svelte'
  import { Button } from '@molecule/app-ui-svelte'

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

<PageHeader title="Projects" subtitle="Manage your active projects">
  {#snippet actions()}
    <Button onclick={() => (open = true)}>New project</Button>
  {/snippet}
</PageHeader>

<HeroSection
  eyebrow="Welcome back"
  title="Your workspace"
  description="Everything you need to ship faster."
>
  {#snippet primaryAction()}
    <Button variant="solid">Get started</Button>
  {/snippet}
</HeroSection>

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

Reference

Svelte page-header and hero-section primitives — the Svelte counterpart of @molecule/app-page-chrome-react: the same props (React names), the same DOM for the same input.

Exports:

  • <PageHeader> — top-of-page header with breadcrumbs + title/subtitle + leading icon + right-aligned actions + meta row. emphasis="extrabold" switches the title to the larger dashboard treatment.
  • <HeroSection> — dashboard/landing hero with text + optional media column; align="center" for marketing-style heroes.

Both accept className for per-brand accent styling and dataMolId for AI-agent selectors. Node props are snippets (preferred) or plain text.

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 { HeroSection, PageHeader } from '@molecule/app-page-chrome-svelte'
  import { Button } from '@molecule/app-ui-svelte'

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

<PageHeader title="Projects" subtitle="Manage your active projects">
  {#snippet actions()}
    <Button onclick={() => (open = true)}>New project</Button>
  {/snippet}
</PageHeader>

<HeroSection
  eyebrow="Welcome back"
  title="Your workspace"
  description="Everything you need to ship faster."
>
  {#snippet primaryAction()}
    <Button variant="solid">Get started</Button>
  {/snippet}
</HeroSection>

Type

feature

Installation

npm install @molecule/app-page-chrome-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

PageHeaderProps

Props accepted by the PageHeader component.

interface PageHeaderProps {
  /** Primary heading (usually `t('...')`): text, or a snippet. */
  title: string | Snippet
  /** Optional subheading rendered below the title: text, or a snippet. */
  subtitle?: string | Snippet
  /** Optional leading icon next to the title: text, or a snippet. */
  icon?: string | Snippet
  /** Optional breadcrumb trail rendered above the title row: text, or a snippet. */
  breadcrumbs?: string | Snippet
  /** Right-aligned actions (buttons, menus, etc.): text, or a snippet. */
  actions?: string | Snippet
  /** Optional meta row below the title/subtitle: text, or a snippet. */
  meta?: string | Snippet
  /**
   * Title emphasis level. Both values resolve their weight through
   * `cm.fontWeight(...)`, so the class is a real, theme-scanned utility.
   * - `'normal'` (default) — 3xl `cm.fontWeight('bold')`, for general /
   *   reusable list-page headers.
   * - `'extrabold'` — the larger 4xl `cm.fontWeight('extrabold')` dashboard
   *   treatment (`font-extrabold` is safelisted by `@molecule/app-ui-tailwind`'s
   *   base.css, so it always generates).
   */
  emphasis?: 'normal' | 'extrabold'
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
  /** Extra classes on the outer wrapper. */
  className?: string
}

HeroSectionProps

Props accepted by the HeroSection component.

interface HeroSectionProps {
  /** Small eyebrow line above the headline: text, or a snippet. */
  eyebrow?: string | Snippet
  /** Primary headline: text, or a snippet. */
  title: string | Snippet
  /** Supporting description: text, or a snippet. */
  description?: string | Snippet
  /** Primary call-to-action: text, or a snippet. */
  primaryAction?: string | Snippet
  /** Optional secondary call-to-action: text, or a snippet. */
  secondaryAction?: string | Snippet
  /** Optional visual / illustration slot, positioned to the right at md+. */
  media?: string | Snippet
  /** Horizontal alignment — defaults to `start`. */
  align?: 'start' | 'center'
  /** Extra classes. */
  className?: string
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
}

Constants

HeroSection

const HeroSection: LegacyComponentType
const PageHeader: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.13.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-svelte ^1.1.0
  • svelte ^5.29.0

Runtime Dependencies

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

Not to be confused with @molecule/app-ui-svelte's own <PageHeader> (props: title/description/actions/breadcrumbs): THIS PageHeader takes subtitle (not description) and adds icon, meta, and emphasis. Import from the package that matches the props you pass. Styling resolves via getClassMap() from @molecule/app-ui, so a ClassMap bond (e.g. @molecule/app-ui-tailwind) must be wired before render.