KPdfViewerToolbar is a horizontally scrollable row of AssistChip controls that connects directly to a KPdfViewerState. It displays a live page summary, zoom percentage, zoom in/out buttons, a save action, a share action, and a thumbnail strip toggle — all driven by the same state instance you pass to KPdfViewer. Every visible element, label, icon, and visual style is replaceable through configuration objects.
Signature
Parameters
KPdfViewerState
required
The shared state holder. The toolbar observes
loadState, currentPageIndex, and currentZoom to render live values and enable or disable controls.Boolean
required
Controls the appearance of the thumbnail toggle chip and is the source of truth for strip visibility. Manage this with a
remember { mutableStateOf(true) } in the parent composable.(Boolean) -> Unit
required
Called when the user taps the thumbnail toggle chip. The argument is the new desired visibility value. Update your
isThumbnailStripVisible state here.Modifier
default:"Modifier"
Applied to the outer toolbar container. Use it to set width, padding, or elevation.
(() -> Unit)?
default:"{ state.zoomIn() }"
Called when the user taps the zoom-in chip. Disabled automatically when the current zoom equals
state.config.maxZoom. Pass null to hide the chip entirely via KPdfViewerToolbarVisibility.(() -> Unit)?
default:"{ state.zoomOut() }"
Called when the user taps the zoom-out chip. Disabled automatically when the current zoom equals
state.config.minZoom. Pass null to hide the chip entirely via KPdfViewerToolbarVisibility.(() -> Unit)?
default:"{ state.requestSave() }"
Called when the user taps the save chip. The default triggers the SDK-integrated save/export flow. Pass
null to remove the chip.Called when the user taps the share chip. No default implementation is provided — supply your own platform-specific share logic. The chip is hidden when this is
null unless you set showShare = true in KPdfViewerToolbarVisibility.KPdfViewerToolbarConfig
default:"KPdfViewerToolbarConfig.defaults()"
Controls which chips are visible and what text and icons they display. See KPdfViewerToolbarConfig below.
KPdfViewerToolbarStyle
default:"KPdfViewerToolbarStyle.defaults()"
Controls the visual appearance of the toolbar container and its chips. See KPdfViewerToolbarStyle below.
KPdfViewerToolbarConfig
KPdfViewerToolbarConfig groups the three configuration objects that control what the toolbar shows and how it labels its controls.
KPdfViewerToolbarConfig.defaults() to get the default instance, then use .copy(...) to override individual fields.
KPdfViewerToolbarVisibility
Controls which chips render in the toolbar. All fields default totrue.
Boolean
default:"true"
Show the page summary chip (e.g. “Page 3 / 12”).
Boolean
default:"true"
Show the zoom-out chip.
Boolean
default:"true"
Show the current zoom percentage chip (e.g. “150%”).
Boolean
default:"true"
Show the zoom-in chip.
Boolean
default:"true"
Show the save chip.
Show the share chip.
Boolean
default:"true"
Show the thumbnail strip toggle chip.
KPdfViewerToolbarStrings
Provides the label text for each chip. Lambda fields receive live values from state so you can format strings dynamically.(currentPage: Int, pageCount: Int) -> String
Formats the page summary label. Default:
"Page 3 / 12". Receives the 1-based current page number and the total page count.(zoomPercent: Int) -> String
Formats the zoom percentage label. Default:
"150%".String
default:"\"Zoom Out\""
Label for the zoom-out chip.
String
default:"\"Zoom In\""
Label for the zoom-in chip.
String
default:"\"Save\""
Label for the save chip.
Label for the share chip.
(isVisible: Boolean) -> String
Formats the thumbnail toggle label based on current strip visibility. Default:
"Hide Thumbnails" when visible, "Show Thumbnails" when hidden.KPdfViewerToolbarIcons
Supplies a leading icon composable for each chip. All fields are optional — passnull to render a chip with no icon.
(@Composable () -> Unit)?
Icon shown in the page summary chip.
(@Composable () -> Unit)?
Icon shown in the zoom percentage chip.
(@Composable () -> Unit)?
Icon shown in the zoom-out chip.
(@Composable () -> Unit)?
Icon shown in the zoom-in chip.
(@Composable () -> Unit)?
Icon shown in the save chip.
Icon shown in the share chip.
(@Composable () -> Unit)?
Icon shown in the thumbnail toggle chip when the strip is currently visible.
Icon shown in the thumbnail toggle chip when the strip is currently hidden.
KPdfViewerToolbarStyle
Controls the visual appearance of the toolbar container and every chip variant. CallKPdfViewerToolbarStyle.defaults() for a Material3-matched default, then .copy(...) to override individual fields.
Dp
default:"88.dp"
Minimum width applied to every chip. Increase this to keep chips a consistent size when labels vary in length.
Shape
default:"RoundedCornerShape(24.dp)"
Shape of the toolbar background container.
Shape
default:"RoundedCornerShape(18.dp)"
Shape applied to every chip.
List<Color>
Horizontal gradient colors for the toolbar background. Defaults to a surface-to-surfaceVariant gradient derived from
MaterialTheme.colorScheme.Color
Color of the 1 dp border around the toolbar container.
Color
Background color for default-appearance chips (interactive action chips).
Color
Background color for tonal chips (the zoom percentage display).
Color
Background color for accent chips (the page summary and active thumbnail toggle).
Dp
default:"14.dp"
Padding inside the toolbar container, around the chip row.
Dp
default:"10.dp"
Horizontal spacing between chips.
Default usage
onShareClick defaults to null, so the share chip is not interactive unless you provide a handler. The chip still renders when showShare = true in KPdfViewerToolbarVisibility. To implement sharing, call viewerState.exportPdf() and pass the resulting bytes to your platform share sheet.Full customization example
Override labels, icons, visibility, and style in a single call using.copy(...) on the defaults.