Basic Surface
Emits a design-system-neutral surface from fully resolved visual and interaction values.
The surface owns one Android View whose effective bounds participate in layout, input, focus, and semantics. visualHeight optionally centers only the visual fill, border, ripple, and shape inside those bounds. A caller background, border, or shape in modifier replaces the resolved surface and therefore occupies the complete effective bounds. Caller elevation replaces BasicSurfaceStyle.elevation, while caller shadow modifiers are drawn after the style shadows.
The callback runs synchronously on the renderer input thread, which is the Android main thread for the standard renderer. A non-null onClick with enabled set to false retains disabled semantics but installs no click listener or interaction layer.
Receiver
active tree builder receiving the surface node
Parameters
resolved fill, geometry, border, clipping, elevation, and shadow values
packed ARGB value provided to descendant content defaults
whether the optional click action and state layers participate in input
optional click callback; null creates a non-interactive surface
non-negative minimum effective width in dp
non-negative minimum effective height in dp
optional non-negative visual surface height centered inside effective bounds
optional accessibility role applied to the merged surface subtree
optional stable sibling identity used during reconciliation
default alignment for children without explicit box parent data
caller configuration appended after resolved surface behavior and visuals
child content emitted inside the surface
Throws
if a supplied dimension is negative
Samples
val node = buildVNodeTree {
BasicSurface(
style = BasicSurfaceStyle(
fill = Brush.SolidColor(0xFF1E4D5A.toInt()),
shape = UiShape.continuous(16.dp),
borderWidth = 1.dp,
borderColor = 0xFF8FD8E8.toInt(),
clipContent = true,
interactionIndication = UiInteractionIndication.StateLayer(
UiStateLayerColors(
pressedColor = 0x33FFFFFF,
focusedColor = 0x2AFFFFFF,
hoveredColor = 0x1FFFFFFF,
),
),
),
contentColor = 0xFFFFFFFF.toInt(),
onClick = {},
minimumHeight = 48.dp,
visualHeight = 40.dp,
) {
Text("Open")
}
}.single()
val surface = node.spec as SurfaceNodeProps
check(surface.minimumHeight == 48.dp)
check(surface.visualHeight == 40.dp)