JengaNavigationRailItem

fun JengaNavigationRailItem(label: String, selected: Boolean, onClick: () -> Unit, icon: @Composable () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, showDot: Boolean = false, minHeight: Dp = JengaTheme.components.navigationRailItem?.minHeight ?: JengaNavigationRailItemDefaults.MinHeight, shape: Shape = JengaNavigationRailItemDefaults.shape, contentPadding: PaddingValues = JengaNavigationRailItemDefaults.contentPadding, textStyle: TextStyle = JengaNavigationRailItemDefaults.textStyle, selectedTextStyle: TextStyle = textStyle.merge(JengaTheme.components.navigationRailItem?.selectedTextStyle), colors: JengaNavigationRailItemColors = JengaNavigationRailItemDefaults.colors())(source)

A full-width destination row for a side navigation list (e.g. the rail of a landscape or tablet layout): an icon and a label, with a filled background when selected. Stack items in a column; the caller owns the layout.

Parameters

label

the destination name.

selected

whether this item is the current destination.

onClick

called when the item is tapped.

icon

the destination icon; inherits the content color.

modifier

the Modifier for this item.

enabled

whether the item is interactive.

showDot

whether a small attention dot follows the label.

minHeight

the minimum item height; defaults to the theme's value, else JengaNavigationRailItemDefaults.MinHeight.

shape

the item shape.

contentPadding

padding inside the item.

textStyle

the label text style.

selectedTextStyle

the label text style while selected; defaults to textStyle with the theme's JengaNavigationRailItemStyle.selectedTextStyle merged on top.

colors

the color set; defaults to JengaNavigationRailItemDefaults.colors.

Samples

var selected by remember {
    mutableIntStateOf(
        value = 0,
    )
}
Column(
    content = {
        JengaNavigationRailItem(
            label = "Tickets",
            selected = selected == 0,
            onClick = { selected = 0 },
            icon = {
                JengaIcon(
                    imageVector = JengaIcons.Ticket,
                    contentDescription = null,
                )
            },
        )
        JengaNavigationRailItem(
            label = "Work orders",
            selected = selected == 1,
            onClick = { selected = 1 },
            icon = {
                JengaIcon(
                    imageVector = JengaIcons.Wrench,
                    contentDescription = null,
                )
            },
            showDot = true,
        )
    },
)