Skip to main content

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.
data class KPdfViewerToolbarConfig(
    val visibility: KPdfViewerToolbarVisibility,
    val strings: KPdfViewerToolbarStrings,
    val icons: KPdfViewerToolbarIcons,
)
visibility
KPdfViewerToolbarVisibility
required
Controls which chips are rendered. All chips are visible by default. See KPdfViewerToolbarVisibility below.
strings
KPdfViewerToolbarStrings
required
Provides the label text (and lambda formatters) for every chip. See KPdfViewerToolbarStrings below.
icons
KPdfViewerToolbarIcons
required
Provides the optional leading icon composable for every chip. See KPdfViewerToolbarIcons below.
Companion: 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 a Boolean that defaults to true, so all chips are shown unless you explicitly set a field to false.
data class KPdfViewerToolbarVisibility(
    val showPageSummary: Boolean = true,
    val showZoomOut: Boolean = true,
    val showZoomPercentage: Boolean = true,
    val showZoomIn: Boolean = true,
    val showSave: Boolean = true,
    val showShare: Boolean = true,
    val showThumbnailToggle: Boolean = true,
)
showPageSummary
Boolean
Show the page summary chip that displays the current page number and total page count. Rendered with the Accent chip style. Default: true.
showZoomOut
Boolean
Show the zoom-out chip. The chip is automatically disabled when the viewer is already at minZoom. Default: true.
showZoomPercentage
Boolean
Show the read-only zoom percentage chip. Rendered with the Tonal chip style. Default: true.
showZoomIn
Boolean
Show the zoom-in chip. The chip is automatically disabled when the viewer is already at maxZoom. Default: true.
showSave
Boolean
Show the save chip. Tapping it calls viewerState.requestSave() internally. Default: true.
showShare
Boolean
Show the share chip. You supply the onShareClick handler to KPdfViewerToolbar directly; the SDK does not implement sharing. Default: true.
showThumbnailToggle
Boolean
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.
data class KPdfViewerToolbarStrings(
    val pageSummaryText: (currentPage: Int, pageCount: Int) -> String,
    val zoomPercentageText: (zoomPercent: Int) -> String,
    val zoomOutText: String,
    val zoomInText: String,
    val saveText: String,
    val shareText: String,
    val thumbnailToggleText: (isVisible: Boolean) -> String,
)
pageSummaryText
(currentPage: Int, pageCount: Int) -> String
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.
zoomPercentageText
(zoomPercent: Int) -> String
Formats the zoom percentage label. Receives the current zoom level as an integer percentage (e.g. 150 for 1.5×). Default: "$zoomPercent%".
zoomOutText
String
Label for the zoom-out chip. Default: "Zoom Out".
zoomInText
String
Label for the zoom-in chip. Default: "Zoom In".
saveText
String
Label for the save chip. Default: "Save".
shareText
String
Label for the share chip. Default: "Share".
thumbnailToggleText
(isVisible: Boolean) -> String
Formats the thumbnail-toggle chip label. Receives true when the strip is currently visible. Default: "Hide Thumbnails" when visible, "Show Thumbnails" when hidden.
Companion: 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 as KPdfToolbarIcon?, which is a typealias for @Composable () -> Unit. Set a field to null to remove the leading icon for that chip.
typealias KPdfToolbarIcon = @Composable () -> Unit

data class KPdfViewerToolbarIcons(
    val pageSummaryIcon: KPdfToolbarIcon? = null,
    val zoomPercentageIcon: KPdfToolbarIcon? = null,
    val zoomOutIcon: KPdfToolbarIcon? = null,
    val zoomInIcon: KPdfToolbarIcon? = null,
    val saveIcon: KPdfToolbarIcon? = null,
    val shareIcon: KPdfToolbarIcon? = null,
    val thumbnailVisibleIcon: KPdfToolbarIcon? = null,
    val thumbnailHiddenIcon: KPdfToolbarIcon? = null,
)
pageSummaryIcon
KPdfToolbarIcon?
Leading icon for the page summary chip. Default: a text glyph "Pg".
zoomPercentageIcon
KPdfToolbarIcon?
Leading icon for the zoom percentage chip. Default: a text glyph "%".
zoomOutIcon
KPdfToolbarIcon?
Leading icon for the zoom-out chip. Default: a text glyph "-".
zoomInIcon
KPdfToolbarIcon?
Leading icon for the zoom-in chip. Default: a text glyph "+".
saveIcon
KPdfToolbarIcon?
Leading icon for the save chip. Default: a text glyph "S".
shareIcon
KPdfToolbarIcon?
Leading icon for the share chip. Default: a text glyph "Sh".
thumbnailVisibleIcon
KPdfToolbarIcon?
Leading icon shown on the thumbnail-toggle chip when the strip is currently visible. Default: a text glyph "T".
thumbnailHiddenIcon
KPdfToolbarIcon?
Leading icon shown on the thumbnail-toggle chip when the strip is currently hidden. Default: a text glyph "T".
Companion: 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 from MaterialTheme.colorScheme, so the toolbar automatically adapts to light and dark themes.
data class KPdfViewerToolbarStyle(
    val containerShape: Shape,
    val containerGradientColors: List<Color>,
    val containerBorderColor: Color,
    val containerBorderWidth: Dp,
    val chipShape: Shape,
    val chipColor: Color,
    val tonalChipColor: Color,
    val accentChipColor: Color,
    val disabledChipColor: Color,
    val chipBorderColor: Color,
    val tonalChipBorderColor: Color,
    val accentChipBorderColor: Color,
    val disabledChipBorderColor: Color,
    val chipBorderWidth: Dp,
    val chipContentColor: Color,
    val tonalChipContentColor: Color,
    val accentChipContentColor: Color,
    val disabledChipContentColor: Color,
    val contentPadding: Dp,
    val itemSpacing: Dp,
    val minChipWidth: Dp,
)
containerShape
Shape
Shape applied to the toolbar row container. Default: RoundedCornerShape(24.dp).
containerGradientColors
List<Color>
Gradient color stops for the horizontal background brush of the toolbar container. Default: a three-stop gradient derived from surface, surfaceContainerLowest, and surfaceVariant.
containerBorderColor
Color
Stroke color for the toolbar container border. Default: outlineVariant at 80% opacity.
containerBorderWidth
Dp
Stroke width for the toolbar container border. Default: 1.dp.
chipShape
Shape
Shape applied to every chip. Default: RoundedCornerShape(18.dp).
chipColor
Color
Container color for Default-appearance chips (zoom-out, zoom-in, save, share). Default: surface at 92% opacity.
tonalChipColor
Color
Container color for Tonal-appearance chips (zoom percentage). Default: surfaceVariant at 82% opacity.
accentChipColor
Color
Container color for Accent-appearance chips (page summary, active thumbnail toggle). Default: primaryContainer at 92% opacity.
disabledChipColor
Color
Container color for disabled chips (zoom-out at min zoom, zoom-in at max zoom). Default: surfaceVariant at 55% opacity.
chipBorderWidth
Dp
Stroke width applied to all chip borders. Default: 1.dp.
contentPadding
Dp
Padding applied inside the toolbar container, surrounding the chip row. Default: 14.dp.
itemSpacing
Dp
Horizontal spacing between chips. Default: 10.dp.
minChipWidth
Dp
Minimum width enforced on every chip via Modifier.widthIn(min = …). Prevents very short labels from producing narrow chips. Default: 88.dp.
Companion: 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.
KPdfViewerToolbar(
    state = viewerState,
    isThumbnailStripVisible = thumbnailsVisible,
    onThumbnailToggle = { thumbnailsVisible = it },
    config = KPdfViewerToolbarConfig.defaults().copy(
        visibility = KPdfViewerToolbarVisibility(
            showShare = false,  // hide the share chip entirely
        ),
        strings = KPdfViewerToolbarStrings.defaults().copy(
            saveText = "Export",
            zoomOutText = "Smaller",
            zoomInText = "Bigger",
            pageSummaryText = { current, total ->
                if (total == 0) "—" else "$current of $total"
            },
            thumbnailToggleText = { visible ->
                if (visible) "Close Strip" else "Open Strip"
            },
        ),
        icons = KPdfViewerToolbarIcons.defaults().copy(
            zoomOutIcon = {
                Icon(
                    imageVector = Icons.Default.ZoomOut,
                    contentDescription = "Zoom out",
                )
            },
            zoomInIcon = {
                Icon(
                    imageVector = Icons.Default.ZoomIn,
                    contentDescription = "Zoom in",
                )
            },
            saveIcon = {
                Icon(
                    imageVector = Icons.Default.Download,
                    contentDescription = "Save",
                )
            },
        ),
    ),
    style = KPdfViewerToolbarStyle.defaults().copy(
        minChipWidth = 96.dp,
        itemSpacing = 8.dp,
    ),
)

Notes

  • KPdfViewerToolbarConfig.defaults() and KPdfViewerToolbarIcons.defaults() and KPdfViewerToolbarStyle.defaults() are @Composable functions. 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 AssistChip internally. Chip colors and shapes are applied via AssistChipDefaults, 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.