⌘K

NativeSpacer

A customizable spacer block for Nativeblocks.

@NativeBlock(
    name = "Native Spacer",
    keyType = "NATIVE_SPACER",
    description = "Nativeblocks spacer block",
    version = 1
)
fun NativeSpacer()

NativeSpacer provides a flexible and configurable spacer to create adjustable spacing in layouts. It can be used to define gaps with customizable dimensions, enabling fine-tuned control over component spacing.

Features:

  • Configurable width and height.

  • Supports dynamic sizes using match or wrap.

  • Integrates seamlessly with Nativeblocks for server-driven layouts.

Example:

NativeSpacer(
    width = "match",
    height = "wrap"
)

Inheritance

Composable

Properties

width

The width of the spacer.

@NativeBlockProp(
    description = "The width of the spacer (e.g., 'match' or 'wrap').",
    valuePicker = NativeBlockValuePicker.COMBOBOX_INPUT,
    valuePickerOptions = [
        NativeBlockValuePickerOption("match", "Match parent"),
        NativeBlockValuePickerOption("wrap", "Wrap content")
    ],
    valuePickerGroup = NativeBlockValuePickerPosition("Size")
)
var width: String = "wrap"

The width determines the horizontal dimension of the spacer. It can either match its parent's width or wrap its content.

height

The height of the spacer.

@NativeBlockProp(
    description = "The height of the spacer (e.g., 'match' or 'wrap').",
    valuePicker = NativeBlockValuePicker.COMBOBOX_INPUT,
    valuePickerOptions = [
        NativeBlockValuePickerOption("match", "Match parent"),
        NativeBlockValuePickerOption("wrap", "Wrap content")
    ],
    valuePickerGroup = NativeBlockValuePickerPosition("Size")
)
var height: String = "wrap"

The height determines the vertical dimension of the spacer. It can either match its parent's height or wrap its content.