BigBlocks

Mnemonic Flow

Multi-mode seed phrase display and input block with create, display, import, and verify modes

Installation

bunx shadcn@latest add https://registry.bigblocks.dev/r/mnemonic-flow.json

Usage

import { MnemonicFlow } from "@/components/blocks/mnemonic-flow"
 
export function OnboardingPage() {
  return (
    <MnemonicFlow
      mode="create"
      words={generatedWords}
      onComplete={(words) => createWallet(words.join(" "))}
      onCancel={() => router.back()}
    />
  )
}

Modes

Create

Displays generated words in a numbered grid with a confirmation checkbox. The user must acknowledge they have written them down before proceeding.

<MnemonicFlow mode="create" words={words} onComplete={handleComplete} />

Display

Read-only numbered grid with a copy-all button. Useful for showing an existing mnemonic.

<MnemonicFlow mode="display" words={words} onComplete={handleComplete} />

Import

Editable input grid where the user enters each word manually. Validates word count on submit.

<MnemonicFlow mode="import" wordCount={12} onComplete={handleComplete} />

Verify

Shows 2 random blank positions from the provided words. The user must type the correct words to continue.

<MnemonicFlow mode="verify" words={words} onComplete={handleComplete} />

Props

MnemonicFlow

PropTypeDefaultDescription
mode"display" | "create" | "import" | "verify"requiredOperating mode
wordsstring[]--Pre-populated words for display/create/verify modes
wordCount12 | 2412Number of mnemonic words
onComplete(words: string[]) => void--Called with the final word list
onCancel() => void--Called when the user cancels
isLoadingbooleanfalseExternal loading state
errorstring | null--External error message
classNamestring--Additional CSS classes

Hook

useMnemonicFlow manages all mode logic, validation, and verification state.

import { useMnemonicFlow } from "@/components/blocks/mnemonic-flow"
 
function CustomMnemonic() {
  const flow = useMnemonicFlow({
    mode: "import",
    wordCount: 12,
    onComplete: (words) => console.log(words),
  })
 
  return (
    <div>
      {flow.words.map((word, i) => (
        <input
          key={i}
          value={word}
          onChange={(e) => flow.setWord(i, e.target.value)}
        />
      ))}
      <button onClick={flow.submit} disabled={!flow.canSubmit}>
        Submit
      </button>
    </div>
  )
}