Android

The Android Aroma BottomSheet package provides a customisable BottomSheet.

Android | iOS


Cover image

⚡ Installation

This component requires minimum SDK 21.

Add the dependency to build.gradle.

Groovy:

dependencies {
    implementation "nl.coffeeit.aroma:bottomsheet:1.0.3"
}

KTS:

dependencies {
    implementation("nl.coffeeit.aroma:bottomsheet:1.0.3")
}

📖 Usage

To use the BottomSheet in a project, simply add it to your code like this:

BottomSheetWithContent(
    activityContentScope = { state, scope ->
        Button(onClick = {
            scope.launch {
                state.show()
            }
        }) {
            Text("This goes behind the sheet")
        }
    },
    
    sheetContent = {
        Text(text = "This goes inside the sheet")
    }
)

Two parameters are required:

activityContentScope holds the content that should be displayed initially, when the bottom sheet is hidden. It offers a state to toggle the visibility of the bottom sheet and a coroutine scope

sheetContent represents a Composable that is the the content of the actual sheet. XML can also be used here, since it can be inflated in a Composable.

⚙️ Customisation

BottomSheetWithContent accepts the following optional parameters:

  • backgroundColor A Color object to set the background of the bottom sheet
  • scrimColor A Color object to set the color of the area behind the sheet
  • width The width of the bottom sheet (default is fill screen width)
  • bottomMargin Margin for the bottom of the sheet, to make a floating variant (default 0)
  • cornerShape A RoundedCornerShape object to give the sheet rounded edges
  • accessory Decides the accessory of the BottomSheet, can be: – NONEGRABBERCLOSE_BUTTON

✏️ Changelog

The changelog can be found here.

⚠️ License

Android Aroma BottomSheet is licensed under the terms of the MIT Open Source license.