OneScript

ZStack

Layer child views on top of each other.

Layer child views in source order. Later children appear above earlier children. It also accepts Modifiers.

import { Image, Modifier, Text, ZStack } from "onescript/views"

const backgroundURL = new URL("https://example.com/background.png")

<ZStack alignment="bottomLeading">
  <Image
    url={backgroundURL}
    resizable
    modifier={Modifier.scaledToFill()}
  />
  <Text modifier={Modifier.padding(12)}>Title</Text>
</ZStack>
PropTypeDescription
alignmentZStackAlignmentChild alignment. Defaults to "center".
childrenview or view arrayChild views layered from back to front.

ZStackAlignment accepts "topLeading", "top", "topTrailing", "leading", "center", "trailing", "bottomLeading", "bottom", or "bottomTrailing".

How is this guide?

Last updated on