Drawer

A drawer is a component that slides in from the side of the screen. It is typically used to display additional content, such as a detail view or a list of options.

TypeResource
DesignFigma
MobileMobile Storybook
CodeGitlab

Drawer Preview

Usage

id.co.biofarma.binduiandroid.components.drawer.Drawer;
val items = listOf(
    DrawerItem(id = "1", label = "Dashboard", icon = Icons.Default.Home),
    DrawerItem(id = "2", label = "Profile", icon = Icons.Default.Person),
    DrawerItem(id = "3", label = "Settings", icon = Icons.Default.Settings)
)
Drawer(
    items = items,
    isShowFooter = true,
    drawerPosition = DrawerPosition.LEFT,
    drawerHeaderStyle = DrawerHeaderStyle(
        title = "Drawer Title",
        subtitle = "Subtitle",
    ),
    onCloseClick = {
        scope.launch {
            drawerState.close()
        }
    },
    primaryButton = DrawerButton(
        text = "Info",
    ),
    secondaryButton = DrawerButton(
        text = "Close",
    ),
    drawerState = drawerState,
)

Examples

Position (optional)

Use position right or left to display the footer as appropriate.

Drawer Example Position


Can remove footer if you don’t want to use footer in drawer.

Drawer Example Position


Props

PropsRequiredDefaultTypedescription
selectedItemfalse-DrawerItemThe currently selected item in the drawer.
drawerStatefalse-DrawerStateThe status of the drawer (open or closed).
drawerHeaderStylefalse-DrawerHeaderStyleCustom style for drawer headers.
itemsfalse-List<DrawerItem>List of items to be displayed in the drawer.
isDarkModefalselightlight , darkThe mode of the drawer (light , dark).
onCloseClickfalse-(DrawerItem?) -> Unit = {}A callback function that is called when the drawer is closed or the close button is clicked.
isShowFooterfalsetruebooleanIf false, the footer in the drawer will not be displayed.
itemSpacerfalse-Dp = 8.dpThe distance between items in the drawer.
selectedColorfalse-ColorThe color used to mark the selected item drawer.
itemGroupSpacerfalse-Dp = 11.dpThe distance between groups of items in the drawer.
primaryButtonfalse-DrawerButton? = nullA main button that can be added in the drawer section.
secondaryButtonfalse-DrawerButton? = nullSecondary buttons that can be added in the drawer section.
itemContentfalse-(@Composable (item: DrawerItem, selectedItem: DrawerItem?, isSelected: Boolean, onClick: (DrawerItem?) -> Unit) -> Unit)? = nullCustom content that can be displayed for each item in the drawer.
itemGroupfalse-(@Composable ( item: DrawerItem) -> Unit)? = nullCustom item groups that can be used to group items in a drawer.
drawerPositionfalseleftleft , rightThe position of the drawer (left , right).
contentfalse-@Composable () -> UnitCustom content that can be displayed inside the drawer, such as headers or footers.
BIND © Biofarma Innovate Next-level Design .