⌘K

Foundation

Optional prebuilt blocks and type converters for demo, prototyping, and showcasing Nativeblocks.

Foundation is an optional package that provides ready-to-use blocks (text, button, image, layout) and type converters. Use it for demos, prototypes, and showcases. In production, bring your own design system components via @NativeBlock annotations.


Add the Dependency

build.gradle
dependencies {
    implementation("io.nativeblocks:nativeblocks-foundation-android:1.3.0")
}

Register

Call FoundationProvider.provide() after NativeblocksManager.initialize:

NativeblocksManager.initialize(...)

FoundationProvider.provide()

Provided blocks

BlockDescription
NativeBoxBox layout container
NativeColumnVertical column
NativeRowHorizontal row
NativeLazyColumnScrollable vertical list
NativeLazyRowScrollable horizontal list
NativeSpacerFlexible spacer
NativeTextText display
NativeTextFieldText input
NativeButtonButton
NativeImageImage

Provided type converters

Foundation also registers type converters so Nativeblocks can serialize/deserialize platform-specific types from frame JSON.

TypeDescription
DpDensity-independent pixel unit
ColorCompose color
LayoutDirectionLTR / RTL layout
TextUnitSP text size
AlignmentBox alignment
FontWeightFont weight
TextAlignText alignment
ContentScaleImage content scale
Arrangement.HorizontalHorizontal arrangement
Arrangement.VerticalVertical arrangement
TextOverflowText overflow behaviour
KeyboardTypeKeyboard input type