Skip to content
ZikZuk UI

FocusView

Stripe FocusView

One task started from somewhere else — “Rotate credentials” on a record, a quick create from a list. A panel slides in from the right over a dimmed page (200ms in, 150ms out), 30rem or 48rem wide and full width on phones, with the title at the top, the body scrolling and a footer with a secondary action on the left and one primary on the right. While there are unsaved changes, every way of closing asks first.

pnpm add @zikzuk/ui
import { FocusView, useFocusView, DISCARD_MESSAGES } from "@zikzuk/ui";

Rotate credentials

Type something, then press Esc or Cancel.

When to use

  • A short task launched from a record page or a list, after which the person returns where they were.
  • Pass confirmCloseMessages only while there are unsaved changes.

Not for

  • A record's own page — every record gets a page.
  • A chain of panels: one at a time.

Props

PropTypeDescription
shownbooleanWhether it is open. Without it the view manages its own, starting open.
setShown(shown: boolean) => voidCalled with false when someone closes it (after any confirmation).
titlestringThe task.
eyebrowReactNodeA small grey line above the title: where it was started from.
descriptionReactNodeOne line under the title.
childrenReactNodeThe body; it scrolls.
primaryActionReactElementThe one primary button, right of the footer.
secondaryActionReactElementA secondary button, left of the footer.
cancelLabelstringWithout secondaryAction: a built-in outline Cancel that closes through the confirmation.
footerContentReactNodeBeside the actions: a status line.
size"small" | "large"
Default "small"
30rem or 48rem; always full width on phones.
confirmCloseMessagesConfirmCloseMessagesAsk before closing — DISCARD_MESSAGES or your own words.
classNamestringExtra classes on the outer element.