Skip to content
ghostui

Preview

Have an existing project?

Create project

Design guidance

Use LayerCard when one task needs a primary panel and a related secondary action. The caller owns headings, labels, fields, status, and actions; LayerCard owns containment and surfaces. Normal (variant="basic") is borderless. Compact keeps one outer border. variant controls outer containment, secondaryPlacement controls reading and focus order, and primarySurface selects the paired surface hierarchy.

Keep a descriptive accessible name on the root when the content has no visible group heading. Use canonical Button and Field owners. The secondary part adds no interaction of its own.

Installation

Install

LayerCard's registry entry includes its required source dependencies. A copied Create project composition also needs the field, input, button, and dialog registry items.

Basic usage

The example's width, heading and form spacing belong to its caller layout:

layer-card-demo.css

Structures

Primary is the main caller-owned content. Secondary is the related caller-owned content and action area. Direct parts, including Fragment-wrapped parts, are normalized into the requested placement order.

Examples

Normal / top

Normal containment (variant="basic") places the secondary action above the primary Create project form.

Have an existing project?

Create project

Normal / bottom

Use bottom placement when the related action follows the primary task.

Create project

Have an existing project?

Compact / top

Compact containment removes the shell padding and keeps an outer border while preserving primary content spacing.

Have an existing project?

Create project

Compact / bottom

Compact and bottom placement are independent choices.

Create project

Have an existing project?

Secondary surface

Set primarySurface="secondary" when the primary panel should use the secondary surface. LayerCard pairs the outer and secondary surfaces with palette-200 in light mode and palette-700 in dark mode. This preserves the layer hierarchy; the panels never share the same surface token.

Create project

Have an existing project?

The secondaryVisible prop defaults to true. Set it to false in basic/compact to omit Secondary while keeping Primary in place. Composer uses this control for its initially hidden task or approval panel.

API reference

Secondary renders a div and accepts native div attributes and a ref. It has no render or density prop. Both parts accept caller-owned children and className. The root renders a section and forwards native attributes and its ref; it has no render override. Use aria-label or aria-labelledby when needed. Surfaces add no keyboard stops. secondaryPlacement and primarySurface apply to basic and compact; legacy default and stacked keep their previous composition.