@molecule/app-editor-toolbar-svelte
Feature · editor-toolbar · App (browser) · v1.1.3 · Apache-2.0
Top editor toolbar with title + version badge + primary/secondary action buttons
npm install @molecule/app-editor-toolbar-svelteHow it works
@molecule/app-editor-toolbar-svelte is a ready-made editor-toolbar 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 { EditorToolbar } from '@molecule/app-editor-toolbar-svelte'
</script>
<EditorToolbar
title="My Blog Post"
primaryActions={[
{ id: 'save', label: 'Save', onClick: () => save(), variant: 'outline' },
{ id: 'publish', label: 'Publish', onClick: () => publish(), variant: 'solid' },
]}
>
{#snippet badge()}<span>Draft</span>{/snippet}
</EditorToolbar>Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte
Reference
Svelte editor-top toolbar — the Svelte counterpart of
@molecule/app-editor-toolbar-react, with the same props and the same DOM.
Exports EditorToolbar — title + badge + primary/secondary action groups —
and the ToolbarAction shape. Pair it with EditorLayout from
@molecule/app-editor-layout-svelte as its topBar slot.
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.tsJSDoc, not this file.
Quick Start
<script lang="ts">
import { EditorToolbar } from '@molecule/app-editor-toolbar-svelte'
</script>
<EditorToolbar
title="My Blog Post"
primaryActions={[
{ id: 'save', label: 'Save', onClick: () => save(), variant: 'outline' },
{ id: 'publish', label: 'Publish', onClick: () => publish(), variant: 'solid' },
]}
>
{#snippet badge()}<span>Draft</span>{/snippet}
</EditorToolbar>
Type
feature
Installation
npm install @molecule/app-editor-toolbar-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
API
Interfaces
ToolbarAction
A single action item rendered as a button (or linked button) in the toolbar.
interface ToolbarAction {
/** Stable id — the render key of the action's button. */
id: string
/** Button label — text or a snippet. */
label: Snippet | string
/** Optional leading icon inside the button. */
icon?: Snippet | string
/**
* Called when the action's button is clicked. React passes the click event
* through, so the callback may take it.
*/
onClick?: () => void
/** Renders the button inside a plain anchor with this href. */
href?: string
/** Disables the button. */
disabled?: boolean
/** Visual variant — defaults to `'ghost'`. */
variant?: 'solid' | 'outline' | 'ghost' | 'link'
/** Optional color variant for emphasis. */
color?: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'
}
EditorToolbarProps
Props accepted by the EditorToolbar component.
interface EditorToolbarProps {
/** Document title. */
title: Snippet
/** Optional version / status badge next to the title. */
badge?: Snippet
/** Primary actions (e.g. Save, Publish) rendered on the right. */
primaryActions?: ToolbarAction[]
/** Secondary icon-only actions (theme, settings, help). */
secondaryActions?: ToolbarAction[]
/** Optional leading slot (back button, breadcrumb). */
leading?: Snippet
/** Sticky top — defaults to true. */
sticky?: boolean
/** Extra classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
}
Constants
EditorToolbar
const EditorToolbar: 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.6.0svelte^5.0.0
Runtime Dependencies
-
@molecule/app-svelte -
@molecule/app-ui -
@molecule/app-ui-svelte -
svelte -
stickydefaults to TRUE and appliesposition: sticky; top: 0with a TRANSPARENT background — pass a surface class viaclassNameor page content will scroll visibly through the toolbar. -
Action
labels render verbatim (into the button and nothing else) — pass already-translated strings; the component has not()calls or locale bond of its own. -
Prefer
onClickoverhref: anhrefaction wraps the button in a plain anchor (full page navigation, and invalid button-in-anchor nesting for assistive tech). -
A 1px divider renders between the primary and secondary groups only when both are non-empty.
-
Buttons come from
@molecule/app-ui-svelte; requires a wired ClassMap bond (standard molecule app setup). Node-valued props (title,badge,leading) are snippets; an action's node fields are snippets or strings.