Documentation Index
Fetch the complete documentation index at: https://mahmoud-b28887f9.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
KPdfViewerToolbar is controlled entirely through five configuration data classes. You compose them together into a KPdfViewerToolbarConfig that you pass to the config parameter of KPdfViewerToolbar, and separately a KPdfViewerToolbarStyle for visual appearance. Every class ships with a defaults() companion factory so you can use .copy(…) to override only the fields you care about without boilerplate.
KPdfViewerToolbarConfig
The top-level configuration object. Holds visibility, string labels, and icon slots for every toolbar chip.Controls which chips are rendered. All chips are visible by default. See
KPdfViewerToolbarVisibility below.Provides the label text (and lambda formatters) for every chip. See
KPdfViewerToolbarStrings below.Provides the optional leading icon composable for every chip. See
KPdfViewerToolbarIcons below.KPdfViewerToolbarConfig.defaults() is a @Composable function that returns an instance populated with KPdfViewerToolbarVisibility(), KPdfViewerToolbarStrings.defaults(), and KPdfViewerToolbarIcons.defaults().
KPdfViewerToolbarVisibility
Controls which chips the toolbar renders. Every field is aBoolean that defaults to true, so all chips are shown unless you explicitly set a field to false.
Show the page summary chip that displays the current page number and total page count. Rendered with the
Accent chip style. Default: true.Show the zoom-out chip. The chip is automatically disabled when the viewer is already at
minZoom. Default: true.Show the read-only zoom percentage chip. Rendered with the
Tonal chip style. Default: true.Show the zoom-in chip. The chip is automatically disabled when the viewer is already at
maxZoom. Default: true.Show the save chip. Tapping it calls
viewerState.requestSave() internally. Default: true.Show the share chip. You supply the
onShareClick handler to KPdfViewerToolbar directly; the SDK does not implement sharing. Default: true.Show the thumbnail-strip toggle chip. Its label and icon change based on the current
isThumbnailStripVisible value. Default: true.KPdfViewerToolbarStrings
Provides every text label shown in the toolbar. Lambda fields receive runtime values so you can produce dynamic strings without holding external state.Formats the page summary chip label. Receives the 1-based current page number and the total page count. Default:
"Page $currentPage / $pageCount", or "Page --" when pageCount is 0.Formats the zoom percentage label. Receives the current zoom level as an integer percentage (e.g.
150 for 1.5×). Default: "$zoomPercent%".Label for the zoom-out chip. Default:
"Zoom Out".Label for the zoom-in chip. Default:
"Zoom In".Label for the save chip. Default:
"Save".Label for the share chip. Default:
"Share".Formats the thumbnail-toggle chip label. Receives
true when the strip is currently visible. Default: "Hide Thumbnails" when visible, "Show Thumbnails" when hidden.KPdfViewerToolbarStrings.defaults() returns the defaults described above. It is a plain (non-@Composable) factory.
KPdfViewerToolbarIcons
Provides the optional leading icon composable for each chip. Every field is typed asKPdfToolbarIcon?, which is a typealias for @Composable () -> Unit. Set a field to null to remove the leading icon for that chip.
Leading icon for the page summary chip. Default: a text glyph
"Pg".Leading icon for the zoom percentage chip. Default: a text glyph
"%".Leading icon for the zoom-out chip. Default: a text glyph
"-".Leading icon for the zoom-in chip. Default: a text glyph
"+".Leading icon for the save chip. Default: a text glyph
"S".Leading icon for the share chip. Default: a text glyph
"Sh".Leading icon shown on the thumbnail-toggle chip when the strip is currently visible. Default: a text glyph
"T".Leading icon shown on the thumbnail-toggle chip when the strip is currently hidden. Default: a text glyph
"T".KPdfViewerToolbarIcons.defaults() is a @Composable function that returns the default text-glyph icons listed above.
KPdfViewerToolbarStyle
Controls the visual appearance of the toolbar container and every chip. All color values are resolved at composition time fromMaterialTheme.colorScheme, so the toolbar automatically adapts to light and dark themes.
Shape applied to the toolbar row container. Default:
RoundedCornerShape(24.dp).Gradient color stops for the horizontal background brush of the toolbar container. Default: a three-stop gradient derived from
surface, surfaceContainerLowest, and surfaceVariant.Stroke color for the toolbar container border. Default:
outlineVariant at 80% opacity.Stroke width for the toolbar container border. Default:
1.dp.Shape applied to every chip. Default:
RoundedCornerShape(18.dp).Container color for
Default-appearance chips (zoom-out, zoom-in, save, share). Default: surface at 92% opacity.Container color for
Tonal-appearance chips (zoom percentage). Default: surfaceVariant at 82% opacity.Container color for
Accent-appearance chips (page summary, active thumbnail toggle). Default: primaryContainer at 92% opacity.Container color for disabled chips (zoom-out at min zoom, zoom-in at max zoom). Default:
surfaceVariant at 55% opacity.Stroke width applied to all chip borders. Default:
1.dp.Padding applied inside the toolbar container, surrounding the chip row. Default:
14.dp.Horizontal spacing between chips. Default:
10.dp.Minimum width enforced on every chip via
Modifier.widthIn(min = …). Prevents very short labels from producing narrow chips. Default: 88.dp.KPdfViewerToolbarStyle.defaults() is a @Composable function that resolves all color values from the current MaterialTheme.colorScheme.
Customization example
Override only the fields you need using.copy(…). The example below hides the share chip, localizes the save and zoom labels, replaces the zoom icons with Icon composables from Material3, and increases the minimum chip width.
Notes
KPdfViewerToolbarConfig.defaults()andKPdfViewerToolbarIcons.defaults()andKPdfViewerToolbarStyle.defaults()are@Composablefunctions. Call them inside a composable scope; do not call them from a ViewModel or outside composition.KPdfViewerToolbarStrings.defaults()is a plain (non-@Composable) factory and can be called anywhere.- The toolbar uses Material3
AssistChipinternally. Chip colors and shapes are applied viaAssistChipDefaults, so they respect Material3 theming and accessibility contrast requirements. - The chip row is horizontally scrollable, so all chips remain accessible even on narrow screens without any configuration change.