@molecule/app-editor-layout-vue

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

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

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

npm · Source on GitHub

How it works

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

import { createApp, defineComponent, h } from 'vue'
import { EditorLayout } from '@molecule/app-editor-layout-vue'
import { EditorToolbar } from '@molecule/app-editor-toolbar-vue'

const Editor = defineComponent({
  setup() {
    return () =>
      h(EditorLayout, {
        topBar: h(EditorToolbar, { title: 'Untitled post' }),
        canvas: h(ArticleEditor),
        sidePanel: h(MetadataPanel),
        sidePanelOpen: true,
      })
  },
})

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

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

Reference

Vue editor layout scaffold.

Exports <EditorLayout> — sticky top bar + main canvas + optional side panel. It is the Vue 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

import { createApp, defineComponent, h } from 'vue'
import { EditorLayout } from '@molecule/app-editor-layout-vue'
import { EditorToolbar } from '@molecule/app-editor-toolbar-vue'

const Editor = defineComponent({
  setup() {
    return () =>
      h(EditorLayout, {
        topBar: h(EditorToolbar, { title: 'Untitled post' }),
        canvas: h(ArticleEditor),
        sidePanel: h(MetadataPanel),
        sidePanelOpen: true,
      })
  },
})

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

Type

feature

Installation

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

API

Interfaces

EditorLayoutProps

Props accepted by the EditorLayout component.

interface EditorLayoutProps {
  /**
   * Sticky top bar — typically title + save/publish buttons + status
   * indicator. Passed as a prop or as the same-named slot — both work.
   */
  topBar?: VNodeChild
  /** Main editing canvas (wysiwyg, drawable area, form, code editor). */
  canvas?: VNodeChild
  /**
   * Optional right-side settings / metadata panel. Passed as a prop or as the
   * same-named slot — both work.
   */
  sidePanel?: VNodeChild
  /** 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

Three-region editor scaffold: sticky top bar + main canvas + optional collapsible side panel.

Used by blog post editors, product-listing editors, chatbot flow editors, design canvases, etc. Node props (topBar, canvas, sidePanel) arrive as a prop AND a same-named slot; components accept either.

const EditorLayout: DefineComponent<
  ExtractPropTypes<{
    topBar: null
    canvas: null
    sidePanel: null
    sidePanelPosition: { type: PropType<'left' | 'right'>; default: string }
    sidePanelOpen: { type: BooleanConstructor; default: boolean }
    className: StringConstructor
    dataMolId: StringConstructor
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      topBar: null
      canvas: null
      sidePanel: null
      sidePanelPosition: { type: PropType<'left' | 'right'>; default: string }
      sidePanelOpen: { type: BooleanConstructor; default: boolean }
      className: StringConstructor
      dataMolId: StringConstructor
    }>
  > &
    Readonly<{}>,
  { sidePanelPosition: 'left' | 'right'; sidePanelOpen: boolean },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see EditorLayoutProps).

Returns: The editor layout component.

Injection Notes

Requirements

Peer dependencies:

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

Runtime Dependencies

  • @molecule/app-ui

  • @molecule/app-ui-vue

  • @molecule/app-vue

  • vue

  • 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; the slot does not need its own stickiness, but should bring a surface background.

  • Node-valued props (topBar, canvas, sidePanel) arrive as a prop AND a same-named slot; components accept either.

  • 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.