@molecule/app-editor-toolbar-solid

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-solid

npm · Source on GitHub

How it works

@molecule/app-editor-toolbar-solid 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 { EditorToolbar } from '@molecule/app-editor-toolbar-solid'

export function Page() {
  return (
    <EditorToolbar
      title="My Blog Post"
      badge={<span>Draft</span>}
      primaryActions={[
        { id: 'save', label: 'Save', onClick: () => save(), variant: 'outline' },
        {
          id: 'publish',
          label: 'Publish',
          onClick: () => publish(),
          variant: 'solid',
          color: 'primary',
        },
      ]}
    />
  )
}

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

Reference

Solid editor-top toolbar.

Exports EditorToolbar — title + badge + primary/secondary action groups — and the ToolbarAction shape. It is the Solid counterpart of @molecule/app-editor-toolbar-react: the same props and the same DOM for the same input.

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 { EditorToolbar } from '@molecule/app-editor-toolbar-solid'

export function Page() {
  return (
    <EditorToolbar
      title="My Blog Post"
      badge={<span>Draft</span>}
      primaryActions={[
        { id: 'save', label: 'Save', onClick: () => save(), variant: 'outline' },
        {
          id: 'publish',
          label: 'Publish',
          onClick: () => publish(),
          variant: 'solid',
          color: 'primary',
        },
      ]}
    />
  )
}

Type

feature

Installation

npm install @molecule/app-editor-toolbar-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

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: JSX.Element
  /** Optional leading icon inside the button. */
  icon?: JSX.Element
  /**
   * 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: JSX.Element
  /** Optional version / status badge next to the title. */
  badge?: JSX.Element
  /** 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?: JSX.Element
  /** Sticky top — defaults to true. */
  sticky?: boolean
  /** Extra classes. */
  className?: string
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
}

Functions

EditorToolbar(props)

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.

React keys each action button by p-<id> / s-<id>, so a re-ordered or re-passed array moves/keeps the rendered buttons per key. Solid's For keys by reference, so the primary buttons are keyed through stable per-id records — the record for an id is created once and reused, while the button reads the CURRENT action for its id reactively (a changed label updates in place).

function EditorToolbar(props: EditorToolbarProps): JSX.Element
  • props — Component props (see EditorToolbarProps).

Returns: The rendered toolbar.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

  • sticky defaults to TRUE and applies position: sticky; top: 0 with a TRANSPARENT background — pass a surface class via className or 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 no t() calls or locale bond of its own.

  • Prefer onClick over href: an href action 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-solid; requires a wired ClassMap bond (standard molecule app setup). Node-valued props are Solid JSX values.