Imperative Surface Imperative Surface

Surface

Surface is the main public API.

import { Surface } from 'imperative-surface';

Static APIs

Surface.Dialog.present

Surface.Dialog.present<T = any>(
  args?: DialogArgs<T>
): Promise<T | null | undefined>

Presents a centered dialog.

Surface.Sheet.present

Surface.Sheet.present<T = any>(
  args?: SheetArgs<T>
): Promise<T | null | undefined>

Presents an edge-attached sheet.

Layout components

The Surface class also exposes:

  • Surface.Body
  • Surface.Header
  • Surface.Content
  • Surface.Footer

These are intended to provide a consistent surface layout while remaining normal React components.

Example

const value = await Surface.Dialog.present<number>({
  body: ({ pop }) => (
    <Surface.Body>
      <Surface.Content>
        <button onClick={() => pop(42)}>Return 42</button>
      </Surface.Content>
    </Surface.Body>
  ),
});

On this page