This page lists every key of the style prop. The keys and their types come from the generated declarations in .nsh/types/nsh/types.d.ts, so your editor checks them as you type. Layout is flexbox with a column default, numbers are points, and the CSS features are there too: grid, gradients, box shadows, filters, blend modes, outlines, transitions and keyframe animations.
For how to apply styles, combine them with classes and inherit text styles, see Styling . For the class syntax, see the Tailwind reference .
# The four interfaces
Each interface extends the one before it:
Interface Extends Used by LayoutStyleLayout of every element (flexbox, grid, sizes, spacing, position) ViewStyleLayoutStyle<View>, <Scroll>, <List>, controls and every other elementTextStyleViewStyle<Text> and <Input> (and views, whose text styles pass to the text inside them)ImageStyleViewStyle<Image>
import type { ViewStyle, TextStyle } from "nsh" ;
import { Text, View } from "nsh" ;
const card : ViewStyle = {
padding : 16 ,
borderRadius : 12 ,
backgroundColor : "#fff" ,
boxShadow : "0 4px 12px rgb(0 0 0 / 0.08)" ,
};
const title : TextStyle = { fontSize : 17 , fontWeight : "600" , color : "#111" };
< View style = {card}>
< Text style = {title}>Hello</ Text >
</ View >;
style also takes an array; entries merge left to right and falsy entries are skipped, so conditional styles need no spreading:
< View style = {[card, selected () && { borderColor : "#2563eb" , borderWidth : 2 }]} />
Note
The inline style always wins over class. Setting a key to null or undefined resets it to its default.
# Value types
Type Accepts numberPoints (density-independent). 1 is one point on iOS and one dp on Android. DimensionValuenumber (points), `${number}%` (of the parent), or "auto".LengthValuenumber (points) or `${number}%`. No "auto".ColorValueA CSS color string: #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), hsla(), oklch(), oklab(), or a named CSS color (black, white, transparent, rebeccapurple, …). NativeNodeA native animated value or a node derived from it (see nsh/animated ). Accepted by backgroundColor, opacity and the steps of transform; the value then animates on the UI thread without JS.
Strings with CSS syntax (boxShadow, backgroundImage, filter, gridTemplateColumns, …) take lengths in px and bare numbers (both points), pt, or rem (16 points).
# LayoutStyle
Layout is computed in Rust (flexbox and CSS grid). The defaults differ from CSS’s: display: "flex", flexDirection: "column", flexShrink: 0, alignContent: "flex-start", alignItems: "stretch", and no automatic minimum size. See Layout .
# Display and position
Key Type Description display"flex" | "grid" | "block" | "none"The layout of the children. "none" removes the element from layout and hides it. "block" stacks children as CSS block layout does. Default "flex". position"relative" | "absolute""absolute" takes the element out of the flow and places it by top / right / bottom / left relative to its parent. Default "relative".topDimensionValueOffset from the parent’s top edge (absolute) or from the element’s own position (relative). rightDimensionValueOffset from the right edge. In right-to-left layouts it means the end edge. bottomDimensionValueOffset from the bottom edge. leftDimensionValueOffset from the left edge. In right-to-left layouts it means the start edge. startDimensionValueLeft in left-to-right layouts, right in right-to-left ones. endDimensionValueRight in left-to-right layouts, left in right-to-left ones. zIndexnumberOrder among siblings (stable for equal values); also the native stacking order. direction"inherit" | "ltr" | "rtl"Layout direction, inherited by default. Right to left, left and right properties mean start and end.
# Flexbox
Key Type Description flexDirection"row" | "column" | "row-reverse" | "column-reverse"The main axis. Default "column". flexWrap"wrap" | "nowrap" | "wrap-reverse"Whether children wrap onto several lines. Default "nowrap". flexnumberOne number, not the CSS shorthand: a positive number sets flexGrow to it, flexShrink: 1 and flexBasis: 0; 0 makes the element inflexible; a negative number shrinks it down to its minimum size. flexGrownumberHow much of the free space the element takes. Default 0. flexShrinknumberHow much the element shrinks when space runs out. Default 0, not 1 as in CSS. flexBasisDimensionValueThe main-axis size before free space is distributed. justifyContent"flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch"Distribution of children along the main axis. Default "flex-start". alignItems"flex-start" | "flex-end" | "center" | "stretch" | "baseline"Alignment of children on the cross axis. Default "stretch". alignSelf"auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline"Overrides the parent’s alignItems for this element. alignContent"flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly"Distribution of wrapped lines (and grid tracks) on the cross axis. Default "flex-start". gapLengthValueSpace between rows and columns of children. rowGapLengthValueSpace between rows. columnGapLengthValueSpace between columns.
# Grid
Set display: "grid" to lay out children in a CSS grid. Track lists use CSS syntax.
Key Type Description gridTemplateColumnsstringColumn tracks: "repeat(3, 1fr)", "200px 1fr", minmax(), auto-fill / auto-fit, line names. gridTemplateRowsstringRow tracks, same syntax. gridAutoColumnsstringSize of implicitly created columns. gridAutoRowsstringSize of implicitly created rows. gridAutoFlow"row" | "column" | "dense" | "row dense" | "column dense"How items without a placement fill the grid. gridColumnnumber | stringColumn placement: "1 / 3", "span 2", a line number or a line name. gridColumnStartnumber | stringStart column line. gridColumnEndnumber | stringEnd column line. gridRownumber | stringRow placement, same syntax as gridColumn. gridRowStartnumber | stringStart row line. gridRowEndnumber | stringEnd row line. justifyItems"flex-start" | "flex-end" | "center" | "stretch" | "baseline"How grid items sit in their areas along the row. justifySelf"auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline"Overrides justifyItems for this item.
< View style = {{ display : "grid" , gridTemplateColumns : "repeat(3, 1fr)" , gap : 8 }}>
< View style = {{ gridColumn : "span 2" , height : 60 , backgroundColor : "#c7d2fe" }} />
< View style = {{ height : 60 , backgroundColor : "#a5b4fc" }} />
</ View >
# Size
Key Type Description widthDimensionValueWidth. heightDimensionValueHeight. minWidthLengthValueMinimum width. minHeightLengthValueMinimum height. maxWidthLengthValueMaximum width. maxHeightLengthValueMaximum height. aspectRationumberWidth divided by height; the missing dimension is computed from the other one.
# Margin
Margins accept "auto" (absorbs free space, as in flexbox) and negative values.
Key Type Description marginDimensionValueAll four sides. marginHorizontalDimensionValueLeft and right. marginVerticalDimensionValueTop and bottom. marginTopDimensionValueTop. marginRightDimensionValueRight. marginBottomDimensionValueBottom. marginLeftDimensionValueLeft. marginStartDimensionValueLeft in left-to-right layouts, right in right-to-left ones. marginEndDimensionValueThe opposite of marginStart.
# Padding
Key Type Description paddingLengthValueAll four sides. paddingHorizontalLengthValueLeft and right. paddingVerticalLengthValueTop and bottom. paddingTopLengthValueTop. paddingRightLengthValueRight. paddingBottomLengthValueBottom. paddingLeftLengthValueLeft. paddingStartLengthValueLeft in left-to-right layouts, right in right-to-left ones. paddingEndLengthValueThe opposite of paddingStart.
# ViewStyle
Everything drawn by a view. All keys of LayoutStyle apply too.
# Background
Key Type Description backgroundColorColorValue | NativeNodeThe fill color. Takes a native animated color. backgroundImagestringCSS gradients drawn over the background color: linear-gradient(...), radial-gradient(...), conic-gradient(...), several separated by commas. experimental_backgroundImagestringAlias of backgroundImage.
< View style = {{ height : 120 , borderRadius : 16 , backgroundImage : "linear-gradient(135deg, #6366f1, #ec4899)" }} />
# Borders
Key Type Description borderWidthnumberWidth of all four sides. borderTopWidthnumberTop side. borderRightWidthnumberRight side. borderBottomWidthnumberBottom side. borderLeftWidthnumberLeft side. borderStartWidthnumberStart side (left in left-to-right layouts). borderEndWidthnumberEnd side. borderColorColorValueColor of all four sides. borderTopColorColorValueTop side. borderRightColorColorValueRight side. borderBottomColorColorValueBottom side. borderLeftColorColorValueLeft side. borderStartColorColorValueStart side. borderEndColorColorValueEnd side. borderStyle"solid" | "dashed" | "dotted"Line style. Default "solid".
# Corners
Key Type Description borderRadiusnumberRadius of all four corners. borderTopLeftRadiusnumberTop-left corner. borderTopRightRadiusnumberTop-right corner. borderBottomRightRadiusnumberBottom-right corner. borderBottomLeftRadiusnumberBottom-left corner. borderTopStartRadiusnumberTop corner on the start side. borderTopEndRadiusnumberTop corner on the end side. borderBottomStartRadiusnumberBottom corner on the start side. borderBottomEndRadiusnumberBottom corner on the end side. borderCurve"circular" | "continuous""continuous": corners whose curvature eases into the edges, like iOS app icons. Where the box is too small the curve falls back to circular, so pills stay pills. Works on both platforms.
# Outline
An outline is drawn outside the border and takes no space in layout.
Key Type Description outlineWidthnumberLine width. outlineColorColorValueLine color. outlineStyle"solid" | "double" | "dashed" | "dotted" | "none" | "hidden"Line style. outlineOffsetnumberDistance from the border edge; negative values move it inside.
# Shadows
Two ways to cast a shadow: the CSS boxShadow (several layers, spread, inset) or the four shadow* keys.
Key Type Description boxShadowstringCSS box-shadow: offsets, blur, spread and color, several layers separated by commas, inset for inner shadows. shadowColorColorValueShadow color. shadowOffset{ width: number; height: number }Offset. Default { width: 0, height: -3 }. shadowOpacitynumberOpacity, 0 to 1. Default 0 (no shadow). shadowRadiusnumberBlur radius. Default 3.
< View style = {{ padding : 16 , borderRadius : 12 , backgroundColor : "#fff" ,
boxShadow : "0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px -4px rgb(0 0 0 / 0.12)" }} />
Note
On Android, shadows need a background: a view with a transparent background (text on nothing, for example) casts no shadow. For Android’s material shadow use the android={{ elevation }} prop instead of a style.
# Opacity, visibility and overflow
Key Type Description opacitynumber | NativeNode0 (invisible) to 1. Takes a native animated value. visibility"visible" | "hidden" | "collapse"Hidden views keep their space in layout (unlike display: "none"). overflow"visible" | "hidden""hidden" clips children to the view’s bounds (and corners).backfaceVisibility"visible" | "hidden""hidden": invisible while a 3D rotation turns it away.
Key Type Description transformTransformStep[]A list of steps, applied right to left like CSS. transformOriginstring | (number | string)[]The point transform acts around: keywords, percentages and lengths ("top left", "50% 0", [10, 20]). Default the center.
A TransformStep is an object with one key:
Step Value Native animated translateX, translateYnumber (points)yes scale, scaleX, scaleYnumber (factor)yes rotate, rotateZ, rotateX, rotateYnumber (degrees) or string ("45deg", "0.5rad")yes skewX, skewYnumber (degrees) or stringno perspectivenumberno
< View style = {{ transform : [{ perspective : 600 }, { rotateY : "20deg" }, { scale : 0.95 }] }} />
# Filters and blending
Key Type Description filterstringCSS filters of the view and its content: brightness(), contrast(), grayscale(), hue-rotate(), invert(), saturate(), sepia(), opacity(), blur(), drop-shadow(). backdropFilterstringCSS filters of what is behind the view, such as "blur(10px)" for frosted glass. mixBlendMode"normal" | "multiply" | "screen" | "overlay" | "darken" | "lighten" | "color-dodge" | "color-burn" | "hard-light" | "soft-light" | "difference" | "exclusion" | "hue" | "saturation" | "color" | "luminosity" | "plus-darker" | "plus-lighter"How the view blends with what is behind it.
Warning
Platform limits:
iOS applies only opacity(), brightness() up to 1 and drop-shadow() to views. <Image> takes every color filter and blur(), applied while the image is decoded.
iOS backdropFilter blur uses a system material at a fraction, an approximation of the exact radius.
Android needs API 31 for blur(), drop-shadow() and backdropFilter; below that only color filters apply. Blend modes need API 29.
# Transitions
When a transitioned property changes (from a new style, a class or a variant such as active:), the platform animates it natively. No JS runs during the animation.
Key Type Description transitionPropertystringComma-separated properties that animate: "all", "colors" (color, backgroundColor, borderColor, …), "opacity", "transform", "boxShadow", "borderRadius", "borderWidth", or "none". transitionDurationnumber | "${number}ms" | "${number}s"Milliseconds as a number, or "150ms" / "0.2s". transitionDelaynumber | "${number}ms" | "${number}s"Delay before the transition starts. transitionTimingFunction"linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "cubic-bezier(...)"The easing curve.
< View
onPress = {() => open. set ( ! open ())}
style = {{ height : open () ? 160 : 56 , opacity : open () ? 1 : 0.8 ,
transitionProperty : "opacity, transform" , transitionDuration : 200 }}
/>
# Keyframe animations
Built-in keyframe animations, run natively (Tailwind’s animate-*).
Key Type Description animationName"none" | "spin" | "ping" | "pulse" | "bounce"The animation. animationDurationnumber | "${number}ms" | "${number}s"Length of one iteration. animationDelaynumber | "${number}ms" | "${number}s"Delay before the first iteration. animationTimingFunction"linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "cubic-bezier(...)"The easing curve. animationIterationCountnumber | "infinite"How many times it runs.
For animations driven by values, gestures or springs, use nsh/animated instead.
# Pointer
Key Type Description cursor"auto" | "default" | "pointer" | "text" | "grab" | "grabbing" | "not-allowed" | ... (every CSS cursor keyword, and "none")The pointer shape over the view, for pointers (iPad trackpads, Mac Catalyst, desktops).
# TextStyle
Text styles apply to <Text> and <Input>. They are also inherited, as in CSS: text properties set on a view pass to the texts and inputs inside it, and nested <Text> spans inherit from their parent text. All keys of ViewStyle apply too. See Text .
# Font
Key Type Description colorColorValueText color. fontSizenumberSize in points. fontWeight"normal" | "bold" | number | "${number}""normal" (400), "bold" (700) or 100–900.fontFamilystringA system family, or the name an imported font evaluates to (import Inter from "./Inter.ttf"). See Fonts . fontStyle"normal" | "italic"Italic. fontVariant("small-caps" | "oldstyle-nums" | "lining-nums" | "tabular-nums" | "proportional-nums")[]OpenType number and letter forms. tabular-nums keeps digits the same width, useful for counters and timers.
# Spacing and alignment
Key Type Description lineHeightnumberLine height in points. letterSpacingnumberExtra space between characters, in points. textAlign"auto" | "left" | "center" | "right" | "justify"Horizontal alignment. textAlignVertical"auto" | "top" | "center" | "bottom"Where text shorter than its box sits (a <Text> with a height). writingDirection"auto" | "ltr" | "rtl"Base direction of the text; "auto" takes it from the content. textTransform"none" | "uppercase" | "lowercase" | "capitalize"Case transformation.
Tip
Tailwind’s leading-* and tracking-* classes set line heights as multiples of the font size and letter spacing in em, so they scale with text-* sizes.
# Decoration
Key Type Description textDecorationLine"none" | "underline" | "line-through" | "underline line-through"Lines drawn with the text. textDecorationColorColorValueColor of the lines (default the text color). textDecorationStyle"solid" | "double" | "dotted" | "dashed" | "wavy"Line style. textDecorationThicknessnumber | "auto" | "from-font"Line thickness. textUnderlineOffsetnumber | "auto"Distance of the underline from the baseline.
# Text shadow
Key Type Description textShadowColorColorValueShadow color. textShadowOffset{ width: number; height: number }Shadow offset. textShadowRadiusnumberBlur radius.
# ImageStyle
All keys of ViewStyle, plus:
Key Type Description tintColorColorValueRecolors a template image (every opaque pixel takes this color), for monochrome icons.
How an image fills its box is the resizeMode prop of <Image>, not a style; see image .
# Props that look like styles
Some settings are props in nsh, not style keys. Their Tailwind classes exist, but an explicit prop wins over the class:
Setting Prop Class Line limit numberOfLines on <Text>line-clamp-*, truncateEllipsis position ellipsizeMode on <Text>text-ellipsis, text-clipTouch pass-through pointerEventspointer-events-none, pointer-events-autoImage fit resizeMode on <Image>object-cover, object-contain, …Selectable text selectable on <Text>select-text, select-nonePlaceholder color placeholderTextColor on <Input>placeholder:text-*Material shadow (Android) android={{ elevation }}