OudsNavigationBar

fun OudsNavigationBar(modifier: Modifier = Modifier, windowInsets: WindowInsets = NavigationBarDefaults.windowInsets, content: @Composable RowScope.() -> Unit)

Navigation bars let people switch between UI views on smaller devices. They offer a persistent and convenient way to switch between primary destinations in an app.

OudsNavigationBar should contain three to five OudsNavigationBarItem, each representing a singular destination.

Parameters

modifier

Modifier applied to the navigation bar.

windowInsets

Window insets of the navigation bar.

content

Content of the navigation bar.

Samples

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Call
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Email
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.PreviewLightDark
import com.orange.ouds.core.component.OudsNavigationBar
import com.orange.ouds.core.component.OudsNavigationBarItem
import com.orange.ouds.core.component.OudsNavigationBarItemIcon
import com.orange.ouds.core.utilities.OudsPreview

fun main() { 
   //sampleStart 
   data class Menu(val label: String, val imageVector: ImageVector, val enabled: Boolean = true)

val items = listOf(
    Menu("Call", Icons.Default.Call),
    Menu("Email", Icons.Default.Email),
    Menu("Agenda", Icons.Default.DateRange, enabled = false),
    Menu("Settings", Icons.Default.Settings)
)
var selectedItemIndex: Int by rememberSaveable { mutableIntStateOf(0) }

OudsNavigationBar {
    items.forEachIndexed { index, item ->
        val isSelected = index == selectedItemIndex
        OudsNavigationBarItem(
            modifier = Modifier.weight(1f),
            selected = isSelected,
            onClick = {
                selectedItemIndex = index
                // Do something else here
            },
            icon = OudsNavigationBarItemIcon(
                imageVector = item.imageVector,
                contentDescription = item.label
            ),
            label = item.label,
            enabled = item.enabled
        )
    }
} 
   //sampleEnd
}