Drag handle

A grabbable bar between two panes that lets people resize them.

When to use

The vertical drag handle sits between panes of a multi-pane layout. It changes shape while it is pressed or dragged. You attach the drag behavior yourself, or let the adaptive pane scaffold do it.

Examples

Resizable split

Drag the handle.

var listWidth by remember { mutableFloatStateOf(220f) }

Row(Modifier.fillMaxWidth().height(200.dp)) {
    Box(
        Modifier.width(listWidth.dp).fillMaxHeight().background(MaterialTheme.colorScheme.surfaceContainerLow),
        contentAlignment = Alignment.Center,
    ) { Text("List") }

    VerticalDragHandle(
        modifier = Modifier
            .padding(horizontal = 8.dp)
            .draggable(
                orientation = Orientation.Horizontal,
                state = rememberDraggableState { delta -> listWidth = (listWidth + delta).coerceIn(120f, 420f) },
            ),
    )

    Box(Modifier.weight(1f).fillMaxHeight().background(MaterialTheme.colorScheme.surfaceContainerHigh), contentAlignment = Alignment.Center) {
        Text("Detail")
    }
}

Parameters

NameTypeDefaultDescription
modifierModifierModifierAdd Modifier.draggable to give the handle behavior.
sizesDragHandleSizesVerticalDragHandleDefaults.sizes()Resting and pressed size.
shapesDragHandleShapesVerticalDragHandleDefaults.shapes()Resting and pressed shape.
colorsDragHandleColorsVerticalDragHandleDefaults.colors()Resting, pressed and dragged colors.

Guidelines

Do:

Don't:

Accessibility

Related components