Skip to content

Surface

@Composable



fun Surface(
    contentAlignment: Alignment = Alignment.TopStart, 
    modifier: Modifier = Modifier, 
    texture: String = "surface", 
    variant: String = ThemeVariants.DEFAULT, 
    stateName: String = TextureStates.DEFAULT, 
    drawOverContent: Boolean = false, 
    content: @Composable



 () -> Unit
)

A net.kernelpanicsoft.archie.gui.layout.Box-like layout node that paints a themed background texture behind its children.

The texture is resolved from the current LocalTheme by texture key and variant, and is drawn nine-sliced if the theme defines it as such, otherwise stretched to fit like a simple sprite (in which case the surface has a minimum size matching the sprite's own). Panel builds on top of this to add content padding.

Parameters

  • contentAlignment: Alignment of content within the surface, as in net.kernelpanicsoft.archie.gui.layout.Box.

  • modifier: Additional modifiers applied to the layout node.

  • texture: The themed texture key to look up via LocalTheme.

  • variant: The theme variant of texture to use. See ThemeVariants.

  • stateName: The TextureStates key to look up within variant - most callers never need to touch this (TextureStates.DEFAULT, a plain idle surface, covers the common case), but a caller with its own non-interactive state axis (e.g. NodeFrame's own obtained/unobtained) can select a different sprite per state the same way a themed widget like a button already does for its own interactive states.

  • drawOverContent: When true, texture draws after content instead of before, acting as an overlaid frame rather than a background - meant for a transparent-centered variant.