API reference

Surface Composable

Draws a semantic container for grouped content and can optionally act as a clickable control.
Use a non-clickable surface for panel sections and custom component foundations. Supplying onClick adds press feedback, accessibility semantics, and a minimum 48dp interaction target.

Signature

@Composable
fun Surface(
    modifier: Modifier = Modifier,
    colors: SurfaceColors = SurfaceDefaults.Colors,
    shape: Shape = UiSetTheme.shapes.card,
    border: BorderStroke? = null,
    elevation: Dp = 0.dp,
    enabled: Boolean = true,
    onClick: () -> Unit? = null,
    role: Role? = null,
    interactionSource: MutableInteractionSource? = null,
    indication: UiSetIndicationSpec? = UiSetTheme.indications.standard.default,
    contentAlignment: Alignment = Alignment.TopStart,
    content: @Composable BoxScope.() -> Unit,
)

Parameters

modifier: Modifier modifier applied to the surface
colors: SurfaceColors paired container and descendant content colors
shape: Shape clipping, background, border, and shadow shape
border: BorderStroke? optional border drawn around the surface
elevation: Dp shadow elevation
enabled: Boolean whether an interactive surface accepts input
onClick: (() -> Unit)? optional click callback; null creates a display-only surface
role: Role? optional accessibility role for an interactive surface
interactionSource: MutableInteractionSource? optional interaction stream shared with callers that observe surface state; an interactive surface creates one when omitted
indication: UiSetIndicationSpec? interaction feedback split around the surface clipping boundary
contentAlignment: Alignment alignment of content within the surface
content: @Composable BoxScope.() -> Unit surface content