⌘K

NativeVStack

A customizable vertical stack (VStack) block for Nativeblocks.

@NativeBlock(
    name: "Native VStack",
    keyType: "NATIVE_VSTACK",
    description: "Nativeblocks VStack block",
    version: 1
)
struct NativeVStack<Content: View>: View 

NativeVStack allows you to stack child views vertically with alignment, spacing, padding, and styling options. It also supports click events and customizable layout direction.

Features:

  • Customizable alignment (horizontal and vertical).

  • Configurable spacing between child views.

  • Support for padding, frame sizing, and background styling.

  • Layout direction options (LTR or RTL).

  • Shadow and border customization.

Example:

NativeVStack(
    content: { _ in
         Text("Top Left Aligned")
           .padding()
    },
    alignmentHorizontal: "center",
    alignmentVertical: "top",
    spacing: 10,
    backgroundColor: "#ffffff",
    onClick: { print("VStack clicked") }
)

Inheritance

View

Properties

content

The content of the VStack, provided as a slot.

@NativeBlockSlot(description: "The content to display inside the VStack.")
    var content: (BlockIndex) -> Content

alignmentHorizontal

The horizontal alignment of the VStack's content.

@NativeBlockProp(
        description: "The horizontal alignment of the VStack's content.",
        valuePicker: NativeBlockValuePicker.DROPDOWN,
        valuePickerOptions: [
            NativeBlockValuePickerOption("leading", "leading"),
            NativeBlockValuePickerOption("trailing", "trailing"),
            NativeBlockValuePickerOption("center", "center"),
        ],
        valuePickerGroup: NativeBlockValuePickerPosition("Alignment")
    )
    var alignmentHorizontal: String = "leading"

alignmentVertical

The vertical alignment of the VStack's content.

@NativeBlockProp(
        description: "The vertical alignment of the VStack's content.",
        valuePicker: NativeBlockValuePicker.DROPDOWN,
        valuePickerOptions: [
            NativeBlockValuePickerOption("top", "top"),
            NativeBlockValuePickerOption("bottom", "bottom"),
            NativeBlockValuePickerOption("center", "center"),
            NativeBlockValuePickerOption("firstTextBaseline", "firstTextBaseline"),
            NativeBlockValuePickerOption("lastTextBaseline", "lastTextBaseline"),
        ],
        valuePickerGroup: NativeBlockValuePickerPosition("Alignment")
    )
    var alignmentVertical: String = "top"

spacing

The spacing between child views in the VStack.

@NativeBlockProp(
        description: "The spacing between child views in the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Alignment")
    )
    var spacing: CGFloat = 0

direction

The layout direction of the VStack (LTR or RTL).

@NativeBlockProp(
        description: "The layout direction of the VStack.",
        valuePicker: NativeBlockValuePicker.DROPDOWN,
        valuePickerOptions: [
            NativeBlockValuePickerOption("LTR", "LTR"),
            NativeBlockValuePickerOption("RTL", "RTL"),
        ],
        valuePickerGroup: NativeBlockValuePickerPosition("Direction")
    )
    var direction: String = "LTR"

paddingTop

The top padding inside the VStack.

@NativeBlockProp(
        description: "The top padding inside the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Padding")
    )
    var paddingTop: CGFloat = 0

paddingLeading

The leading (left) padding inside the VStack.

@NativeBlockProp(
        description: "The leading padding inside the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Padding")
    )
    var paddingLeading: CGFloat = 0

paddingBottom

The bottom padding inside the VStack.

@NativeBlockProp(
        description: "The bottom padding inside the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Padding")
    )
    var paddingBottom: CGFloat = 0

paddingTrailing

The trailing (right) padding inside the VStack.

@NativeBlockProp(
        description: "The trailing padding inside the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Padding")
    )
    var paddingTrailing: CGFloat = 0

frameWidth

The width of the VStack's frame.

@NativeBlockProp(
        description: "The width of the VStack's frame.",
        valuePicker: NativeBlockValuePicker.COMBOBOX_INPUT,
        valuePickerOptions: [
            NativeBlockValuePickerOption("notSet", "notSet"),
            NativeBlockValuePickerOption("infinity", "infinity"),
        ],
        valuePickerGroup: NativeBlockValuePickerPosition("Size")
    )
    var frameWidth: String = "notSet"

frameHeight

The height of the VStack's frame.

@NativeBlockProp(
        description: "The height of the VStack's frame.",
        valuePicker: NativeBlockValuePicker.COMBOBOX_INPUT,
        valuePickerOptions: [
            NativeBlockValuePickerOption("notSet", "notSet"),
            NativeBlockValuePickerOption("infinity", "infinity"),
        ],
        valuePickerGroup: NativeBlockValuePickerPosition("Size")
    )
    var frameHeight: String = "notSet"

backgroundColor

The background color of the VStack.

@NativeBlockProp(
        description: "The background color of the VStack.",
        valuePicker: NativeBlockValuePicker.COLOR_PICKER,
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var backgroundColor: String = "#00000000"

cornerRadius

The corner radius of the VStack.

@NativeBlockProp(
        description: "The corner radius of the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var cornerRadius: CGFloat = 0

borderColor

The border color of the VStack.

@NativeBlockProp(
        description: "The border color of the VStack.",
        valuePicker: NativeBlockValuePicker.COLOR_PICKER,
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var borderColor: String = "#00000000"

borderWidth

The border width of the VStack.

@NativeBlockProp(
        description: "The border width of the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var borderWidth: CGFloat = 0

shadowColor

The shadow color of the VStack.

@NativeBlockProp(
        description: "The shadow color of the VStack.",
        valuePicker: NativeBlockValuePicker.COLOR_PICKER,
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var shadowColor: String = "#00000000"

shadowRadius

The shadow radius of the VStack.

@NativeBlockProp(
        description: "The shadow radius of the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var shadowRadius: CGFloat = 0

shadowX

The horizontal shadow offset of the VStack.

@NativeBlockProp(
        description: "The horizontal shadow offset of the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var shadowX: CGFloat = 0

shadowY

The vertical shadow offset of the VStack.

@NativeBlockProp(
        description: "The vertical shadow offset of the VStack.",
        valuePickerGroup: NativeBlockValuePickerPosition("Background")
    )
    var shadowY: CGFloat = 0

onClick

Triggered when the VStack is clicked.

@NativeBlockEvent(description: "Triggered when the VStack is clicked.")
    var onClick: () -> Void

body

var body: some View