Surface
A passive visual surface container with Shadcn variants, borders, elevation, action profiles, and state styling.
Surface is a passive visual container inheriting the Base Surface input contract, applying Shadcn backgrounds, borders, radii, elevation, and state paint while leaving semantic and interaction ownership to the enclosing control. The examples on this page use the Shadcn Rhea style preset.
Preview
Section titled “Preview”<div class="flex max-w-lg flex-col gap-3">
<shadcn-surface-root variant="outline" radius="lg">
<div class="flex items-center justify-between gap-4 p-4">
<div>
<div class="text-sm font-medium">Workspace Sync</div>
<div class="text-xs opacity-75">
Automatically backs up changes across devices.
</div>
</div>
<shadcn-surface-root
variant="secondary"
radius="full"
border="none"
>
<div class="px-2.5 py-0.5 text-xs font-medium">Active</div>
</shadcn-surface-root>
</div>
</shadcn-surface-root>
<shadcn-surface-root variant="muted" radius="md" border="none">
<div class="px-4 py-3 text-sm">
Draft saved locally. Publish when ready to share with your
team.
</div>
</shadcn-surface-root>
<div class="flex flex-wrap items-center gap-3">
<shadcn-surface-root variant="solid" radius="md" focus-visible>
<div class="px-4 py-2 text-sm font-medium">
Publish Release
</div>
</shadcn-surface-root>
<shadcn-surface-root
variant="accent"
radius="md"
elevation="raised"
>
<div class="px-4 py-2 text-sm font-medium">
Elevated Callout
</div>
</shadcn-surface-root>
</div>
</div>Installation
Section titled “Installation”This component is available from workspace source. In your application, install the CLI, Shadcn prototypes and target adapter built from the same workspace revision, then initialize the project with that CLI. Run the locally installed CLI to generate the facade.
npm exec -- proto-ui add wc shadcn-surface
Replace wc with react, vue, or vue2 to generate the facade for your target framework.
Import surfaceRoot from @proto.ui/prototypes-shadcn/surface (or the package root) and adapt it to your runtime:
import * as React from 'react';import { createReactAdapter } from '@proto.ui/adapter-react';import { surfaceRoot } from '@proto.ui/prototypes-shadcn/surface';
const Surface = createReactAdapter(React)(surfaceRoot);
export function Summary() { return ( <Surface variant="muted" radius="md" border="none"> <div className="p-4">Saved locally</div> </Surface> );}Passive boundaries and composition
Section titled “Passive boundaries and composition”hovered,focusVisible,pressed, andcurrentare forwarded from an enclosing interactive component; Surface registers no event listeners, tab stops, or ARIA roles. ComposeButtonor a native<a>element whenever you need interactive semantics.- Outer layout and inner padding stay with your composition. Pass
tone="inherit"to nestedTextchildren so they inherit foreground contrast fromsolidoraccentsurfaces. - Enable
fadeto maptransitionStatefrom Base Transition to opacity (closedandleavingmap to0;enteringandenteredmap to1), reading--pui-surface-transition-duration(default0ms) on Web.
Examples
Section titled “Examples”Variants
Section titled “Variants”All seven surface variants, covering cards, secondary fills, quiet muted containers, accents, solid emphasis, transparent shells, and the 80% black scrim backdrop.
<div class="grid max-w-xl grid-cols-1 gap-3 sm:grid-cols-2">
<shadcn-surface-root variant="outline" radius="md">
<div class="p-3 text-sm">outline</div>
</shadcn-surface-root>
<shadcn-surface-root variant="secondary" radius="md">
<div class="p-3 text-sm">secondary</div>
</shadcn-surface-root>
<shadcn-surface-root variant="muted" radius="md" border="none">
<div class="p-3 text-sm">muted</div>
</shadcn-surface-root>
<shadcn-surface-root variant="accent" radius="md">
<div class="p-3 text-sm">accent</div>
</shadcn-surface-root>
<shadcn-surface-root variant="solid" radius="md" border="none">
<div class="p-3 text-sm font-medium">solid</div>
</shadcn-surface-root>
<shadcn-surface-root variant="transparent" radius="md">
<div class="p-3 text-sm">transparent</div>
</shadcn-surface-root>
<shadcn-surface-root
variant="scrim"
radius="sm"
border="none"
class="sm:col-span-2"
>
<div class="px-3 py-2 text-xs font-medium text-white">
scrim — 80% black backdrop
</div>
</shadcn-surface-root>
</div>Radius, border, and elevation
Section titled “Radius, border, and elevation”Combine radius, border, and elevation to form pills, dividers, flat panels, or raised callouts.
<div class="flex flex-col gap-4">
<div class="flex flex-wrap gap-2">
<shadcn-surface-root variant="outline" radius="none">
<div class="px-3 py-1.5 text-xs">none</div>
</shadcn-surface-root>
<shadcn-surface-root variant="outline" radius="sm">
<div class="px-3 py-1.5 text-xs">sm</div>
</shadcn-surface-root>
<shadcn-surface-root variant="outline" radius="md">
<div class="px-3 py-1.5 text-xs">md</div>
</shadcn-surface-root>
<shadcn-surface-root variant="outline" radius="lg">
<div class="px-3 py-1.5 text-xs">lg</div>
</shadcn-surface-root>
<shadcn-surface-root variant="outline" radius="xl">
<div class="px-3 py-1.5 text-xs">xl</div>
</shadcn-surface-root>
<shadcn-surface-root variant="outline" radius="full">
<div class="px-3 py-1.5 text-xs">full</div>
</shadcn-surface-root>
</div>
<div class="grid grid-cols-3 gap-3">
<shadcn-surface-root variant="outline" radius="md" border="all">
<div class="p-3 text-xs">border="all"</div>
</shadcn-surface-root>
<shadcn-surface-root
variant="transparent"
radius="none"
border="bottom"
>
<div class="p-3 text-xs">border="bottom"</div>
</shadcn-surface-root>
<shadcn-surface-root
variant="muted"
radius="md"
border="none"
elevation="raised"
>
<div class="p-3 text-xs">raised</div>
</shadcn-surface-root>
</div>
</div>Visual states and text inheritance
Section titled “Visual states and text inheritance”Illustrates caller-supplied hovered, current, focusVisible, pressed (with actionProfile="rhea" enabling the 1px press offset), and foreground inheritance via Text tone="inherit".
<div class="flex flex-col gap-3">
<shadcn-surface-root variant="outline" radius="md" hovered>
<div class="p-3 text-sm">Hovered item</div>
</shadcn-surface-root>
<shadcn-surface-root
variant="transparent"
radius="md"
border="none"
current
>
<div class="p-3 text-sm">Current nav item</div>
</shadcn-surface-root>
<shadcn-surface-root variant="outline" radius="md" focus-visible>
<div class="p-3 text-sm">Keyboard focus ring</div>
</shadcn-surface-root>
<shadcn-surface-root
variant="solid"
action-profile="rhea"
pressed
>
<div class="p-3">
<shadcn-text-root tone="inherit" size="sm" weight="medium">
Pressed Rhea action · inherited text
</shadcn-text-root>
</div>
</shadcn-surface-root>
</div>Action profiles
Section titled “Action profiles”Opt into explicit actionProfile recipes to match Shadcn button radii, borders, and focus rings across modern profiles and new-york-v4 without replacing the native interactive owner.
<div class="flex flex-col gap-3">
<div class="flex flex-wrap gap-2">
<shadcn-surface-root action-profile="rhea" variant="solid">
<div class="px-3 py-1.5 text-xs">Rhea Primary</div>
</shadcn-surface-root>
<shadcn-surface-root action-profile="luma" variant="secondary">
<div class="px-3 py-1.5 text-xs">Luma Secondary</div>
</shadcn-surface-root>
<shadcn-surface-root action-profile="nova" variant="outline">
<div class="px-3 py-1.5 text-xs">Nova Outline</div>
</shadcn-surface-root>
<shadcn-surface-root action-profile="lyra" variant="outline">
<div class="px-3 py-1.5 text-xs">Lyra Sharp</div>
</shadcn-surface-root>
<shadcn-surface-root
action-profile="new-york-v4"
variant="outline"
focus-visible
>
<div class="px-3 py-1.5 text-xs">New York Focused</div>
</shadcn-surface-root>
</div>
</div>Fading with Transition
Section titled “Fading with Transition”Drive opacity smoothly via fade, transitionState, and --pui-surface-transition-duration while keeping presence and focus gating on the enclosing controller.
<shadcn-surface-root
id="fade-scrim"
variant="scrim"
radius="md"
border="none"
fade
transition-state="entered"
style="--pui-surface-transition-duration: 240ms"
>
<div class="p-4 text-sm font-medium text-white">
Transition-driven scrim surface (240ms)
</div>
</shadcn-surface-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const scrim = document.querySelector('#fade-scrim');
setElementProps(scrim, {
fade: true,
transitionState: 'leaving',
});
</script>The following props belong to Root (removing a prop restores its default):
| Prop | Type | Default |
|---|---|---|
variant | 'transparent' 'outline' 'secondary' 'muted' 'accent' 'solid' 'scrim' | outline |
radius | 'default' 'none' 'sm' 'md' 'lg' 'xl' 'full' | default |
border | 'all' 'bottom' 'none' | all |
elevation | 'none' 'raised' | none |
actionProfile | 'none' 'vega' 'nova' 'maia' 'lyra' 'mira' 'luma' 'sera' 'rhea' 'new-york-v4' 'new-york' | none |
transitionState | 'closed' 'entering' 'entered' 'leaving' | entered |
fade | boolean | false |
hovered | boolean | false |
focusVisible | boolean | false |
pressed | boolean | false |
current | boolean | false |
@proto.ui/prototypes-shadcn/surface also exports ShadcnSurfaceRootProps, SurfaceRootProps, SurfaceRootExposes, and the passive Web composition helper shadcnActionAppearance (ShadcnActionAppearanceOptions).