style object. Dimensions and spacing use native density-independent units unless a property explicitly accepts a percentage string.
Use the class prop to apply registered style classes, including the app’s theme classes. Classes
are resolved in order, then the inline style is applied over them. See App theme styles
for the classes the host provides.
Styles apply only to the node where you set them, including registered class styles. They do not
inherit or cascade to descendants, so set typography, color, spacing, and other values on each node
that needs them.
A text node can contain nested text nodes, each with its own inline styling. Other nodes nested
inside text, such as box, row, column, img, or button, are ignored; place them beside the
text node in a layout container instead. See the text node reference for an
example.
Property reference
Colors and backgrounds
Shape and borders
Corner names use logical start/end so they work with the app’s layout direction.
Spacing and layout
For
scrollable and pager, prefer padding for edge spacing because margin reduces the usable scroll area.
Size
Alignment
Typography
Transforms and opacity
Transforms do not change layout measurement; they move or resize the rendered result.
How layout alignment works
horizontalAlignment and verticalAlignment are applied by the parent container to its direct
children. They do not change the alignment of descendants deeper in the tree. Set the property on
the box, row, or column that owns the children you want to align.
Container behavior
The default alignment is
start horizontally and top vertically. start and end are logical
directions, so they follow the app’s layout direction.
box: align overlaid children
box measures its children in the same bounds and uses both alignment properties to place them.
This is useful for badges, overlays, and centered empty states.
row: main-axis and cross-axis alignment
For a row, horizontal alignment controls the child group along the row. Vertical alignment
controls each child across the row’s height.
weight to consume remaining horizontal space. Weighted children share that space
proportionally; weight has no layout effect on a child inside a box.
column: main-axis and cross-axis alignment
For a column, vertical alignment controls the child group along the column. Horizontal alignment
controls each child across the column’s width.
weight to consume remaining vertical space:
Alignment versus text alignment
These properties act at different levels:
To center a heading both within its container and within its own width, use the container’s
horizontalAlignment: "center" and the text node’s textAlignment: "center".
Spacing, padding, and margin
paddingadds space inside the container, so alignment and child layout happen inside the remaining content area.marginadds space outside the node. It changes the node’s placement in its parent; it does not create a gap between that node’s own children.- On
box,spacingdoes not arrange overlaid children. Use padding, explicit sizes, or arow/columnwhen you need regular gaps.
Spacing in layout and scrolling nodes
spacing is interpreted by the node that owns the children. It is not a universal margin and it
does not add space around the outside edge of a node.
row and column
Use spacing on the parent instead of adding margins to every child:
spacing applies between children, not before the first or after the last; use padding for those
edges.
scrollable
scrollable uses spacing between direct scroll items. Use padding for the viewport and content
edges:
horizontal; the same spacing becomes the vertical gap.
pager
pager uses spacing as the distance between pages, not as an inner gap within each page. Use
the page’s own padding for inner content and the pager’s padding for viewport edges:
Gradients
Use helpers from@napps/nodes:
linearGradient, radialGradient, sweepGradient, conicGradient, and stop. Structured gradients accept type, angle, centerX, centerY, center, radius, colors, stops, and positions.
Named styles
StyleRegistry stores reusable styles globally within the runtime:
Interaction feedback
Do not rely onstyle.transition for pressed or selected interaction feedback. A gesture has a
native lifecycle, so use gestureDetector with a shared value when the visual change needs to be
reliable or animated. Use React state and a normal style update when the selected state does not
need animation.
onFinalize to
restore the visual state when the gesture ends or is cancelled.