Skip to content

Expandable - Android ​

Expandable is a layout component used for creating content that can be expanded and collapsed.

AndroidreleasedElementsreleasediOSreleasedReactreleasedVuereleased

Android ​

Syntax ​

kotlin
@Composable
fun WarpExpandable(
    modifier: Modifier = Modifier,
    title: String,
    initiallyExpanded: Boolean = false,
    type: WarpExpandableType = WarpExpandableType.Default,
    expandedContent: @Composable () -> Unit,
)

Visual options ​

Can be shown in these styles. Both can be shown either collapsed or expanded to begin with.

kotlin
enum class WarpExpandableType {
    Default,
    Box
}

Default ​

The default style for the expandable is just title with the icon button. The expanded content is a @Composable.

kotlin
WarpExpandable(
    title = "Title"
) {
    WarpText("Expandable content")
}

Boxed ​

Boxed style will show the expandable in a WarpBox with neutral style & gray background.

kotlin
WarpExpandable(
    title = "Title",
    type = WarpExpandableType.Box,
    initiallyExpanded = false
) {
    WarpText("Expandable content")
}

Legacy support ​

Not supported

Parameters ​

Required props ​

NameTypeDefaultDescription
titleStringThe title to be displayed in the expandable
expandedContent@Composable () -> UnitThe content to be shown when expanded

Optional Props ​

NameTypeDefaultDescription
modifierModifierModifierSets the modifier for the expandable
initiallyExpandedBooleanfalseIf should show expanded content
typeWarpExpandableType.Default WarpExpandableType.BoxWarpExpandableType.DefaultStyle of the expandable

Questions? ​

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system