Surface

A themed container at one of three elevations.

  • Composed
  • New in 0.1
import { Surface, surfacePrimitive } from "nitro-ui-sdk/surface";
HeroUI Native
Surface
Expo UI
Surface
  • Surface example screen, light appearance
    Light
  • Surface example screen, dark appearance
    Dark
On this page

Surface is a themed container at one of three elevations: the surface, surfaceSecondary and surfaceTertiary tokens, with a token radius and padding and an optional light-mode shadow. It is the building block under cards, grouped lists and panels.

Use Card when the content has a title, body and footer or the whole container is pressable, and GlassSurface for floating chrome on Liquid Glass.

Anatomy

import { Surface } from "nitro-ui-sdk/surface";

<Surface />;
Part Description
root The container: token fill, cornerRadius with a continuous curve, padding, optional shadow.surface.

Surface.Root is the same component as Surface.

Usage

import { Surface } from "nitro-ui-sdk/surface";
import { Text } from "nitro-ui-sdk/text";

<Surface>
  <Text>Twelve deliveries completed.</Text>
</Surface>;

Variants and sizes

Variant Fill
default surface
secondary surfaceSecondary
tertiary surfaceTertiary

There are no sizes: radius (any RadiusToken, default card) and padding (any SpacingToken, default lg) set the shape.

import { Surface } from "nitro-ui-sdk/surface";
import { Text } from "nitro-ui-sdk/text";

<Surface variant="secondary" radius="lg" padding="md" shadow>
  <Text variant="headline">Nested panel</Text>
</Surface>;

States

Surface has no interactive states. shadow casts shadow.surface in light mode; dark mode defines no surface shadow, so surfaces separate by fill alone.

Props

Surface

Prop Type Default Description
variant "default" | "secondary" | "tertiary" "default" Elevation step.
shadow boolean false Casts shadow.surface in light mode.
radius RadiusToken "card" Corner radius token.
padding SpacingToken "lg" Inner padding token.
styles SurfaceStyles Style resolver for root.
layout LayoutStyleProps Merged over the padding.
children ReactNode Content.

Controller API

Surface has no value or commands, so it has no controller.

Styles

import { Surface, type SurfaceStyles } from "nitro-ui-sdk/surface";

const styles: SurfaceStyles = {
  root: ({ tokens, variant, state }) => ({
    layout: { padding: tokens.spacing[state.padding], gap: tokens.spacing.sm, borderWidth: variant === "tertiary" ? 1 : 0 },
    style: { borderColor: tokens.colors.border },
  }),
};
<Surface styles={styles} />;

The single part is root. Resolvers receive { tokens, variant, size: "md", state } with state: { shadow: boolean; radius: RadiusToken; padding: SpacingToken }.

Accessibility

Surface is not an accessibility element and carries no semantics; VoiceOver reads its children one by one. Give the content its own headings and labels.

Agent API

Read-only. Surface adds no agent entry; controls inside it register themselves.

Platform notes

iOS Android
Surface Composed View with token fill, radius and boxShadow. Verified in the iOS harness. Same composed view. Shadows require renderer support (API 31 or later). Written, compile-only on this machine.