@molecule/app-editor-layout-svelte

Feature · editor-layout · App (browser) · v1.1.3 · Apache-2.0

Editor scaffold: top bar with save/publish, main canvas, optional side panel

npm install @molecule/app-editor-layout-svelte

npm · Source on GitHub

How it works

@molecule/app-editor-layout-svelte is a ready-made editor-layout 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 { EditorLayout } from '@molecule/app-editor-layout-svelte'
  import { EditorToolbar } from '@molecule/app-editor-toolbar-svelte'
  import ArticleEditor from './ArticleEditor.svelte'
  import MetadataPanel from './MetadataPanel.svelte'
</script>

<EditorLayout sidePanelOpen={true}>
  {#snippet topBar()}
    <EditorToolbar title="Untitled post" />
  {/snippet}
  {#snippet canvas()}
    <ArticleEditor />
  {/snippet}
  {#snippet sidePanel()}
    <MetadataPanel />
  {/snippet}
</EditorLayout>

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

Reference

Svelte editor layout scaffold.

Exports EditorLayout — sticky top bar + main canvas + optional side panel. It is the Svelte counterpart of @molecule/app-editor-layout-react: the same props (React names) and the same DOM for the same input. Used for blog post editors, product editors, bot flow editors, etc.

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 { EditorLayout } from '@molecule/app-editor-layout-svelte'
  import { EditorToolbar } from '@molecule/app-editor-toolbar-svelte'
  import ArticleEditor from './ArticleEditor.svelte'
  import MetadataPanel from './MetadataPanel.svelte'
</script>

<EditorLayout sidePanelOpen={true}>
  {#snippet topBar()}
    <EditorToolbar title="Untitled post" />
  {/snippet}
  {#snippet canvas()}
    <ArticleEditor />
  {/snippet}
  {#snippet sidePanel()}
    <MetadataPanel />
  {/snippet}
</EditorLayout>

Type

feature

Installation

npm install @molecule/app-editor-layout-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

EditorLayoutProps

Props accepted by the EditorLayout component.

interface EditorLayoutProps {
  /**
   * Sticky top bar — typically title + save/publish buttons + status
   * indicator, as a snippet.
   */
  topBar?: Snippet
  /** Main editing canvas (wysiwyg, drawable area, form, code editor). */
  canvas?: Snippet
  /** Optional right-side settings / metadata panel, as a snippet. */
  sidePanel?: Snippet
  /** Side-panel position — defaults to `'right'`. */
  sidePanelPosition?: 'left' | 'right'
  /** Whether the side panel is currently visible. */
  sidePanelOpen?: boolean
  /** Extra classes. */
  className?: string
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
}

Constants

EditorLayout

const EditorLayout: 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.0.0

Runtime Dependencies

  • @molecule/app-svelte

  • @molecule/app-ui

  • @molecule/app-ui-svelte

  • svelte

  • The scaffold claims the FULL viewport height (h-screen flex column). Render it as the page root; nesting it below another fixed-height app shell produces double scrollbars.

  • The side panel container sets flex-shrink 0 but NO width — your sidePanel content must define its own width.

  • topBar is wrapped in a sticky container by the layout itself (unlike <DetailPageLayout>); the slot does not need its own stickiness, but should bring a surface background.

  • ArticleEditor and MetadataPanel above are your own components.

  • Styling resolves through getClassMap() — requires a wired ClassMap bond (standard molecule app setup). No text of its own.