Toolbar shapes
Configure the compact toolbar through DocumentEditorConfiguration.toolbar: one or two rows, docked or floating, collapsible or not. On pages the toolbar always docks above the rulers; only a pageless editor floats it.
dart
import 'package:vyuh_document_editor/vyuh_document_editor.dart';
DocumentEditor buildToolbar(DocumentEditorController controller) =>
DocumentEditor(
controller: controller,
configuration: DocumentEditorConfiguration(
toolbar: DocumentToolbarConfiguration(
rows: DocumentWorkspaceToolbarRows.doubleRow,
placement: DocumentToolbarPlacement.floating,
collapsible: true,
initiallyExpanded: false,
actionIds: {
HistoryActionId.undo,
HistoryActionId.redo,
MarkActionId.bold,
MarkActionId.italic,
MarkActionId.underline,
},
),
),
);Choose visible controls
The toolbar shows installed actions. actionIds and groups narrow them, and menus gather some into a single trigger.
Action IDs are typed: each owner declares its own set (HistoryActionId.undo, MarkActionId.bold, TableActionId.insert, KatexActionId.insert), so a toolbar can only name an action that exists. See Typed identifiers.
Hiding is not disabling. Use configuration.policy to disable actions and configuration.shortcuts for keyboard overrides.
Group related actions
DocumentToolbarConfiguration.menus takes DocumentToolbarMenuConfigurations. Each picks action IDs or groups, a label and a placement group; useActiveLabel shows the selected action on the trigger. An action in a menu is not also a button, and an empty menu disappears.
The default menu, DocumentToolbarMenuConfiguration.paragraphStyle, holds the paragraph and heading actions and previews each level's typography. Pass menus: const [] for one button per action.
Toolbar surface
decoration draws the toolbar's own surface. Every kind keeps the same insets, so tools never move when you switch.
| Decoration | Draws | Use it |
|---|---|---|
DocumentToolbarDecoration.divider() | One rule under the tools | Inside a bordered card (docked default) |
DocumentToolbarDecoration.filled(radius:) | A quiet tone fill | Docked on a plain background |
DocumentToolbarDecoration.elevated(radius:) | A card with one soft shadow | Floating (floating default) |
DocumentToolbarDecoration.outlined(radius:) | A card with a hairline outline | Standalone on a plain background |
DocumentToolbarDecoration.none() | Nothing | A host that frames the tools itself |
Pass the host's corner radius as radius to match it.
dart
DocumentEditorConfiguration(
toolbar: DocumentToolbarConfiguration(
collapsible: true,
// Inside a rounded card: no second outline beside the card's own border.
decoration: const DocumentToolbarDecoration.divider(),
),
)Keyboard editing
| Action | Shortcut |
|---|---|
| Bold / italic / underline | Command or Ctrl + B / I / U |
| Undo / redo | Command or Ctrl + Z / Shift + Z |
| Link | Command or Ctrl + K |
| Extend selection | Shift + arrow keys |
| Paragraph / line break | Enter / Shift + Enter |
Focus
Formatting actions keep typing focus. Set DocumentEditor(autofocus: true) to start ready to type, or pass your own focusNode and restore it after your dialogs. The link action needs a link request handler.