Last Updated: 2026-06-23
This document defines the approved frontend UX patterns for vault-specific interactions in YieldVault-RWA. It is the source of truth for deposit, withdrawal, allowance approval, transaction confirmation, loading, and recovery states.
Use this guide when changing existing vault flows or building new vault-facing components.
- Keep deposit and withdrawal flows predictable across surfaces.
- Prevent unsafe signing by requiring explicit review of sensitive actions.
- Make asynchronous vault state understandable while optimistic updates and refetches are in flight.
- Preserve accessibility, keyboard flow, and recoverability during multi-step interactions.
This library applies to:
frontend/src/components/VaultDashboard.tsxfrontend/src/components/TransactionConfirmationModal.tsxfrontend/src/hooks/useVaultMutations.ts- Any future component that starts, reviews, confirms, or reports vault transactions
This library does not replace:
docs/FRONTEND_STATE_MANAGEMENT.mdfor ownership of statedocs/focus-management-pattern.mdfor focus and dialog rulesdocs/DEPOSIT_WITHDRAWAL_LIFECYCLE.mdfor protocol sequence details
- One primary transaction surface. Deposit and withdrawal actions should live in a single vault transaction shell instead of competing modals or duplicate forms on the same page.
- Step-based progression. Vault actions must move through
amount -> review -> result. Do not skip review for production actions. - Explicit user confirmation before signing. Sensitive actions must show a confirmation surface with action, amount, fees, network, and contract details.
- Progressive disclosure. Show basic inputs first, then fees, approvals, slippage, and warnings when they become relevant.
- Recover without context loss. Validation errors return the user to the amount step with their prior input preserved.
- Optimistic but honest state. Immediate UI updates are allowed, but pending status must remain visible until server truth arrives.
All vault interactions should follow this sequence:
- User selects
DepositorWithdraw. - User enters an amount in the amount step.
- Inline validation runs before review is unlocked.
- Review step summarizes amount, protocol fee, network fee, and any action-specific controls.
- If deposit approval is required, approval happens before final action confirmation.
- User confirms through the secure confirmation modal before wallet signing proceeds.
- UI enters a pending state and applies optimistic cache updates.
- Result step shows success or failure with a clear recovery action.
Do not introduce alternate one-click flows for the same operation unless there is a separately approved security review.
Use a single card or panel that owns:
- current action tab
- current wizard step
- form state
- pending state
- success or failure result state
Approved pattern:
- Tabs switch between
depositandwithdraw - Step indicator remains visible across all steps
- Switching tabs should not create a second independent transaction flow
The amount step should contain:
- one primary numeric amount input
- available balance context
- quick actions such as
MAXwhen supported - immediate inline validation
- estimated protocol fee and net amount preview
- one primary CTA:
Review Transaction
Rules:
- Disable the primary CTA when the wallet is disconnected, input is empty, validation fails, or the vault cannot accept the action.
- Validation messages should appear inline and also be summarized via toast only when the user tries to advance with invalid input.
- If a deep link pre-fills the amount, the value may be hydrated from the URL, but the URL should not trap the user in a stale step.
The review step is mandatory for deposit and withdrawal.
It should show:
- action type
- entered amount
- protocol fee
- network fee
- resulting net amount
- action-specific warnings
- action-specific controls such as slippage or approval
Rules:
- Keep the review content static enough for users to verify what they are about to sign.
- Warnings must appear above the final confirmation CTA.
- The user must be able to navigate back to the amount step unless a transaction is already in flight.
The result step should show:
- clear success or failure iconography
- one-sentence outcome
- one recovery action
Approved actions:
- Success:
Done - Failure:
Try Again
Rules:
- Failure copy should describe the actual problem when known.
- Returning from a failure should preserve enough context for the user to fix the issue quickly.
- Deposits must respect minimum amount validation, vault cap state, wallet balance, and network fee availability.
- If token approval is required, show it in the review step as a distinct prerequisite before final confirmation.
- Approval state should be visually separate from final deposit execution.
- When the vault is at or near capacity, surface a warning before the user reaches signing.
Approved approval sequence:
- User enters deposit amount.
- Review step indicates approval is required.
- User completes approval.
- Final deposit CTA becomes enabled.
- Secure confirmation modal appears before signing the deposit.
- Withdrawals must show the estimated net amount and any slippage settings that can materially affect proceeds.
- High slippage must be surfaced as a warning, not buried in supporting text.
- If network fee or other constraints make completion unlikely, warn before opening the signing flow.
The secure confirmation modal is required for all sensitive vault actions.
It must show:
- action name
- amount
- asset
- network
- estimated fee
- full contract address
- verified or unverified contract status
- warning callouts for unusual amount, unusual fee, or unknown contract
Rules:
- Never truncate the contract address in the confirmation view.
- Provide a copy action for the contract address.
- Backdrop click must not dismiss the modal.
- Escape may dismiss the modal only as an explicit cancel path.
- Confirmation copy must clearly state that the action cannot be reversed once signed.
This modal should be the final human-readable checkpoint before wallet signing.
Allowance approval is a prerequisite state, not a silent side effect.
Rules:
- Show approval as a numbered or clearly sequenced sub-step inside review.
- Keep approval status visible: idle, pending, confirmed, failed.
- Final deposit confirmation must remain disabled until approval succeeds.
- Approval success should be acknowledged with lightweight feedback, such as a toast.
- Approval failure should not discard the entered amount or force the user out of review.
Vault interactions are asynchronous and must distinguish between these states:
loading: the screen is fetching initial or refreshed datapending: the user has submitted an action and completion is in progressstale: the last known data is visible, but refresh freshness is degradedoptimistic: local cache reflects the expected result before server confirmation
Use contextual skeletons from frontend/src/components/Skeleton.tsx instead of blank panels:
| Surface | Skeleton |
|---|---|
| Vault dashboard cards / stats | DashboardCardSkeleton, VaultStatSkeleton, SharePriceSkeleton |
| Charts | ChartSkeleton |
| Portfolio summary | PortfolioCardSkeleton |
| Transaction rows / tables | TransactionRowSkeleton, TableSkeleton |
| Analytics widgets | AnalyticsWidgetSkeleton |
| Lazy route fallback | RouteLoadingFallback |
Rules:
- Mark loading regions with
aria-busy="true"and keeparia-hiddenon decorative skeleton chrome. - Prefer delayed loading (
useDelayedLoading) for short fetches to avoid skeleton flash. - Do not show empty-state CTAs while
isLoadingis true.
Use frontend/src/components/ui/EmptyState with an explicit kind:
no-data— wallet connected, no deposits/positions yet (offer deposit intent)no-results/search— filters returned nothing (offer reset filters)permission— wallet disconnected or access requirederror— fetch failed after retries (offer retry)
Rules:
- Pending transactions must disable duplicate submission.
- Show a spinner or processing label on the final CTA during submission.
- Optimistically updated balances, holdings, TVL, and transaction lists must mark new entries as pending until refetch completes.
- If optimistic updates fail at the network or server layer, revert cached values and show a failure result.
- Stale data indicators should appear near the affected panel, not only in a global banner.
Error handling should be layered:
- Field-level validation errors stay attached to the relevant input.
- Action-level failures appear in the result step and in toast feedback.
- Data-fetch failures for vault metrics appear in the panel through an inline status banner.
Rules:
- Map backend validation failures back to field errors whenever possible.
- Do not collapse all failures into a generic toast if the UI can point to the exact fix.
- When the failure blocks completion after review, route the user to the result step unless they need to correct a specific field immediately.
- Retry paths should be obvious and should not require re-entering unchanged values.
Vault flows may be opened from deep links or external UI triggers, but the interaction rules stay the same.
Approved patterns:
- URL state may set the initial tab, step, or prefilled amount.
- Global events may move focus into the transaction input for
depositorwithdraw.
Rules:
- URL-driven state must remain shareable and recoverable.
- External triggers may focus the amount input, but must not bypass review or confirmation.
- Cleanup URL params that would otherwise reopen one-time actions on refresh.
Vault interaction components must follow the shared focus management guidance and add these vault-specific rules:
- Keep one logical primary heading per page.
- Preserve keyboard order across tabs, amount entry, review controls, and final actions.
- All confirmation overlays must trap focus and restore focus on close.
- Warning states cannot rely on color alone; pair color with iconography or text.
- Action buttons must use explicit labels such as
Review Transaction,Approve USDC, andConfirm deposit.
- Use
depositandwithdrawas the canonical action labels. - Use
USDCfor the asset label unless a multi-asset vault is explicitly introduced. - Prefer concrete copy over generic reassurance.
- Fee copy must distinguish protocol fee from network fee.
- Success copy should state what happened.
- Failure copy should state what blocked completion and what the user can do next.
Avoid:
- ambiguous labels like
Continue - hidden prerequisites
- multiple primary CTAs in the same step
- modal stacks for the same vault action
- Keep deposit and withdrawal in one transaction shell.
- Require review before signing.
- Surface approval as an explicit prerequisite.
- Mark optimistic transaction rows as pending.
- Show stale data inline where it matters.
- Submit directly from the amount field.
- Hide fees until after signing starts.
- Auto-dismiss critical warnings before the user acts.
- Open a second confirmation modal for the same action path.
- Clear user input on recoverable errors.
- Uses the shared
amount -> review -> resultvault flow - Blocks progress on validation failures
- Shows protocol fee and network fee before signing
- Requires approval before final deposit submission when needed
- Uses the secure confirmation modal for sensitive actions
- Prevents duplicate submissions while pending
- Applies optimistic updates with visible pending status
- Reverts optimistic state on failure
- Preserves focus and keyboard flow for all overlays
- Preserves user input across recoverable failures
The current approved implementation lives in:
frontend/src/components/VaultDashboard.tsxfrontend/src/components/TransactionConfirmationModal.tsxfrontend/src/hooks/useVaultMutations.ts
If a future implementation intentionally diverges from this library, update this document in the same change set and explain the reason in the pull request.