ToolbarItem

sealed interface ToolbarItem

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

Link copied to clipboard
data class Button(val actionId: String, val id: Int, val contentDescription: String, val icon: ToolbarIcon, val state: ToolbarItemState = ToolbarItemState.Default, val position: ToolbarItem.ItemEdge = ItemEdge.Start) : ToolbarItem

A simple tappable toolbar button.

Link copied to clipboard

The toolbar edge an item is aligned to.

Link copied to clipboard
data class Submenu(val actionId: String, val id: Int, val contentDescription: String, val icon: ToolbarIcon, val state: ToolbarItemState = ToolbarItemState.Default, val position: ToolbarItem.ItemEdge = ItemEdge.Start, val children: PersistentList<ToolbarItem> = persistentListOf()) : ToolbarItem

A toolbar item that opens a submenu of nested children when tapped.

Link copied to clipboard
data class Toggle(val actionId: String, val id: Int, val contentDescription: String, val icon: ToolbarIcon, val state: ToolbarItemState = ToolbarItemState.Default, val position: ToolbarItem.ItemEdge = ItemEdge.Start) : ToolbarItem

A toolbar button that reflects a selected/unselected state (e.g. an annotation tool).

Properties

Link copied to clipboard
abstract val actionId: String

Stable string identifier used for action dispatch and state save/restore.

Link copied to clipboard

Accessibility label and overflow-menu text for this item.

Link copied to clipboard
abstract val icon: ToolbarIcon

How this item renders its icon.

Link copied to clipboard
@get:IdRes
abstract val id: Int

Resource id (R.id.pspdf__menu_option_*) preserving the legacy test identity of this item.

Link copied to clipboard

Which edge of the toolbar this item is grouped against.

Link copied to clipboard
abstract val state: ToolbarItemState

Per-item dynamic state (enabled / selected / visible).