Surface
A themed surface level for content and nested controls
Usage
import {Surface} from "@peakui/react";Examples
Variants
transparent paints no background of its own and keeps the base text color.
Nested Levels
Each level provides SurfaceContext, telling nested components which level they sit on.
Customization
Tailwind CSS
Padding, radius and shadow are consumer-side: the block itself ships none of them.
<Surface className="rounded-3xl p-6 shadow-surface">Content</Surface>Global CSS
@layer components {
.surface--secondary {
@apply bg-default text-default-foreground;
}
}Styling Reference
PeakUI follows the BEM methodology, so variants and states are plain class names you can target.
CSS Classes
The Surface component uses these CSS classes (view source styles):
Base Classes
.surface- Base surface styles: relative, with the default text color
Variant Classes
.surface--default-bg-surfaceand its matching foreground.surface--secondary-bg-surface-secondaryand its matching foreground.surface--tertiary-bg-surface-tertiaryand its matching foreground.surface--transparent- Transparent background; keeps the base text color
Slots
[data-slot="surface"]- The root element
API Reference
Surface
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content to place on the surface (required) |
variant | 'default' | 'secondary' | 'tertiary' | 'transparent' | 'default' | Surface level |
className | string | - | Additional classes |
render | DOMRenderFunction<'div', undefined> | - | Replaces the rendered <div> with your own element |
Every other attribute of a <div> is accepted.