Toolbar Item
One toolbar entry. Fully immutable; safe for Compose stability.
The id preserves the existing R.id.pspdf__menu_option_* identity used by customers' Espresso/UIAutomator tests (loophole P1-12). The testTag is auto-derived from this id at render time.
The actionId is a stable string used for action dispatch and state save/restore (ADR-Toolbar-4). Action lambdas are never persisted; saved state is keyed by actionId so it survives process death even if id (an R.id integer) changes across SDK versions. Producers should derive actionId from the resource entry name of id (e.g. "pspdf__menu_option_search") or from a namespaced custom string (e.g. "my.app.sign").
Pre-Phase 0 scaffolding (loophole P1-13).
Inheritors
Types
A simple tappable toolbar button.
The toolbar edge an item is aligned to.
Where an item is allowed to appear, making each ToolbarItem self-describe its placement rather than the grouping layer reading the legacy Menu's showAsAction. Mirrors the AppCompat SHOW_AS_ACTION_* semantics the View toolbar used.
A toolbar item that opens a submenu of nested children when tapped.
A toolbar button that reflects a selected/unselected state (e.g. an annotation tool).
Properties
Accessibility label and overflow-menu text for this item.
How this item renders its icon.
Whether this item shows in the row, collapses into overflow, or is always pinned to overflow.
Which edge of the toolbar this item is grouped against.
Per-item dynamic state (enabled / selected / visible).
Functions
A copy of this item with newState as its dynamic state.
A copy of this item with ToolbarItemState.isEnabled set to enabled; this when unchanged.
A copy of this item with ToolbarItemState.isSelected set to selected; this when unchanged.