Skip to content

NavBar ​

Sticky top navigation bar over a translucent materialBg background with a hairline bottom separator. Three-column layout: leading | centered title | trailing. A default back button (chevron + label) is shown when onBack is set and no leading slot is given. The large variant adds a left-aligned large-title row below the bar.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismNavBar

Basic usage ​

kotlin
PrismNavBar(
    title = "Title",
    onBack = { /* navigate back */ },
    trailing = { PrismIcon(PrismIcons.More, contentDescription = null) },
)

Custom leading slot ​

A leading slot overrides the default back button.

kotlin
PrismNavBar(
    title = "Inbox",
    leading = {
        PrismButton(variant = PrismButtonVariant.Plain, onClick = {}) { Text("Edit") }
    },
    trailing = { PrismIcon(PrismIcons.More, contentDescription = null) },
)

Large title ​

large renders the title as a left-aligned large-title row beneath the bar.

kotlin
PrismNavBar(
    title = "Library",
    large = true,
    trailing = { PrismIcon(PrismIcons.More, contentDescription = null) },
)

API ​

ParameterTypeDefaultDescription
modifierModifierModifierLayout modifier for the bar.
titleString?nullCentered title in the bar row (or large title when large).
leading(@Composable () -> Unit)?nullLeading slot; overrides the default back button.
trailing(@Composable () -> Unit)?nullTrailing slot, right-aligned.
onBack(() -> Unit)?nullWhen set (and no leading), renders a default back button.
backLabelString"返回"Label for the default back button.
largeBooleanfalseRender the title as a left-aligned large title below the bar row.

Released under the MIT License.