Skip to content

Inline Confirm

Feedback next to the control that was used, not in the corner: Copied, Saved.

1.5 kB gzipSource Registry JSON

InlineConfirm playground

Props

appearance

Installation

npx shadcn@latest add https://sproutboat.com/ikada/r/inline-confirm.json

The CLI writes components/ikada/inline-confirm.tsx and merges the ikada theme into your CSS. Or take it from the package: import { InlineConfirm } from "@sproutboat/ikada";

Usage

import { InlineConfirm } from "@/components/ikada/inline-confirm";

<InlineConfirm message="Saved">
  {({ confirm }) => <Button onClick={confirm}>Save settings</Button>}
</InlineConfirm>

Examples

Bubble

Floats above the control and never moves the layout. A polite live region announces the word. The control calls confirm() when the action succeeded.

Inline

Sits beside the control in a reserved slot, for a row where a bubble would be clipped.

Different announcement

`announce` is what screen readers hear when it differs from the visible word.

Props

InlineConfirmProps
PropTypeDescription
messagerequiredstringThe word shown and announced: "Copied", "Saved".
announcestringScreen-reader text when it differs from the visible word, e.g. "Copied to clipboard".
childrenrequired(api: { confirm: () => void; active: boolean; }) => ReactNodeThe control. It receives `confirm`; call it when the action succeeded.
appearance"inline" | "bubble"`bubble` floats above the control and never moves the layout; `inline` sits beside it in a reserved slot. Default `bubble`.
durationnumberMilliseconds the confirmation stays. Default 1600.

Also takes every prop of Omit<ComponentProps<"span">, "children">.

Source: src/components/inline-confirm.tsx