PeakUI

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-surface and its matching foreground
  • .surface--secondary - bg-surface-secondary and its matching foreground
  • .surface--tertiary - bg-surface-tertiary and its matching foreground
  • .surface--transparent - Transparent background; keeps the base text color

Slots

  • [data-slot="surface"] - The root element

API Reference

Surface

PropTypeDefaultDescription
childrenReactNode-The content to place on the surface (required)
variant'default' | 'secondary' | 'tertiary' | 'transparent''default'Surface level
classNamestring-Additional classes
renderDOMRenderFunction<'div', undefined>-Replaces the rendered <div> with your own element

Every other attribute of a <div> is accepted.

On this page