ToolbarItemsProvider

fun interface ToolbarItemsProvider

Customizes the main-toolbar items declaratively.

This is the Compose-toolbar replacement for the removed onCreateOptionsMenu / onPrepareOptionsMenu path: set it with com.pspdfkit.ui.PdfUi.setToolbarItemsProvider. Instead of mutating an android.view.Menu, return the items you want shown — add custom items, drop or reorder default ones, or copy an item with updated com.pspdfkit.compose.toolbar.state.ToolbarItemState (enabled / selected / visible). Each item's ToolbarItem.overflowBehavior decides whether it shows in the row or collapses into the overflow menu, so the result does not need to be pre-grouped.

The provider is re-invoked whenever the toolbar is refreshed; call com.pspdfkit.ui.PdfActivity.invalidateToolbarItems to force a refresh when your own state changes (the declarative analogue of invalidateOptionsMenu).

Functions

Link copied to clipboard
abstract fun provideToolbarItems(defaultItems: List<ToolbarItem>): List<ToolbarItem>