style object. Dimensions and spacing use native density-independent units unless a property explicitly accepts a percentage string.
Styles apply only to the node where you set them. They do not inherit or cascade to descendants.
Set typography, color, spacing, and other values explicitly on each node that needs them. This is
also true for registered class styles.
text is the inline-text exception for children, not for style inheritance. A text node can
contain nested text nodes, and each nested text node can contribute its own inline styling. Nodes
such as box, row, column, img, or button nested inside text are ignored as text
children; 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
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
spacingis a parent layout gap. It is horizontal in arowand vertical in acolumn.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:
row the gap is horizontal. In a column it is vertical. 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. Do not
use margin on the scrollable for leading or trailing edge space because it reduces the usable scroll
area.
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:
Typography
Transforms and opacity
Transforms do not change layout measurement; they move or resize the rendered result.
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.
Styling best practices
- Prefer
paddingovermarginfor scrollable and pager edge spacing. - Prefer
spacingon a parent row or column for consistent child gaps. - Use
weightfor proportional space in linear layouts. - Use
clipwhen rounded corners should clip child content. - Keep layout values stable and use React state for visual changes.
- Do not rely on
style.transitionfor pressed or selected interaction feedback; usegestureDetectorwith shared values andanimatedPropswhen feedback must animate.