@molecule/app-editor-toolbar-vue
Feature · editor-toolbar · App (browser) · v1.1.1 · Apache-2.0
Top editor toolbar with title + version badge + primary/secondary action buttons
npm install @molecule/app-editor-toolbar-vueHow it works
@molecule/app-editor-toolbar-vue 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.
import { createApp, defineComponent, h } from 'vue'
import { EditorToolbar } from '@molecule/app-editor-toolbar-vue'
const Page = defineComponent({
setup() {
return () =>
h(EditorToolbar, {
title: 'My Blog Post',
badge: h('span', 'Draft'),
primaryActions: [
{ id: 'save', label: 'Save', onClick: () => save(), variant: 'outline' },
{
id: 'publish',
label: 'Publish',
onClick: () => publish(),
variant: 'solid',
color: 'primary',
},
],
})
},
})
createApp(Page).mount('#app')Works with: @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue editor-top toolbar.
Exports <EditorToolbar> — title + badge + primary/secondary action groups —
and the ToolbarAction shape. Pair it with <EditorLayout> from
@molecule/app-editor-layout-vue 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
import { createApp, defineComponent, h } from 'vue'
import { EditorToolbar } from '@molecule/app-editor-toolbar-vue'
const Page = defineComponent({
setup() {
return () =>
h(EditorToolbar, {
title: 'My Blog Post',
badge: h('span', 'Draft'),
primaryActions: [
{ id: 'save', label: 'Save', onClick: () => save(), variant: 'outline' },
{
id: 'publish',
label: 'Publish',
onClick: () => publish(),
variant: 'solid',
color: 'primary',
},
],
})
},
})
createApp(Page).mount('#app')
Type
feature
Installation
npm install @molecule/app-editor-toolbar-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
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 node. */
label: VNodeChild
/** Optional leading icon inside the button. */
icon?: VNodeChild
/**
* 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. Passed as a prop or as the same-named slot — both work. */
title: VNodeChild
/** Optional version / status badge next to the title. */
badge?: VNodeChild
/** 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?: VNodeChild
/** Sticky top — defaults to true. */
sticky?: boolean
/** Extra classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
}
Constants
EditorToolbar
Editor-page top toolbar — title + optional version/status badge + primary actions (Save, Publish, Test) + secondary icon actions.
Renders React's exact DOM: the title row (leading, <h1>, badge) and the
actions row, with the same ClassMap tokens, the 1px divider between
non-empty primary and secondary groups, and the sticky inline style by
default (sticky defaults to true). Action labels render verbatim — the
component has no t() calls of its own.
const EditorToolbar: DefineComponent<
ExtractPropTypes<{
title: null
badge: null
primaryActions: { type: PropType<ToolbarAction[]>; default: () => never[] }
secondaryActions: { type: PropType<ToolbarAction[]>; default: () => never[] }
leading: null
sticky: { type: BooleanConstructor; default: boolean }
className: StringConstructor
dataMolId: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
title: null
badge: null
primaryActions: { type: PropType<ToolbarAction[]>; default: () => never[] }
secondaryActions: { type: PropType<ToolbarAction[]>; default: () => never[] }
leading: null
sticky: { type: BooleanConstructor; default: boolean }
className: StringConstructor
dataMolId: StringConstructor
}>
> &
Readonly<{}>,
{ primaryActions: ToolbarAction[]; secondaryActions: ToolbarAction[]; sticky: boolean },
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeEditorToolbarPropsin./types.js).
Returns: The toolbar component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.5.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
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-vue; requires a wired ClassMap bond (standard molecule app setup). Node-valued props accept either a prop or a same-named slot.