Skip to content

Surface ​

The glass card that floats over content: a dock, a banner, a toast, a find bar. It brings the blurred ground, the border and the shadow. You bring the radius, padding, height and position.

tsx
import { Surface } from '@adecore/ui';
tsx
import { Surface } from '@adecore/ui';

export default function SurfaceDemo() {
    return (
        <div className="relative h-48 w-full max-w-md overflow-hidden rounded-lg bg-surface-sunken">
            <div className="absolute inset-0 grid grid-cols-6 gap-2 p-3">
                {Array.from({ length: 24 }, (_, index) => (
                    <span key={index} className="rounded-md bg-accent-soft" />
                ))}
            </div>
            <Surface className="absolute inset-x-6 bottom-4 rounded-xl px-4 py-3 text-sm text-text">A surface floats over what scrolls under it.</Surface>
        </div>
    );
}

Banner, DockShell and Toasts draw on it. For a card that sits in the layout rather than over it, use a Card.

Surface takes the props of a <div>, plus render. SurfaceProps is an exported type.

A colored ground ​

On a colored ground, such as a header a person colored, button hovers and separators stay gray by default. tintStyle(color, ground?) returns custom properties that give every IconButton, ghost Button and Separator inside a shade of that color. ground is what the color is mixed into for the hover, var(--surface-raised) by default.

tsx
<header style={{ backgroundColor: headerColor, ...tintStyle(accent) }}>

Licenses and third-party notices are listed in each package.