Dynamic Action
FFG-native allocation carousel — step through annual-giving amounts or type a custom value, with a confirm action that fires a toast.
Annual giving
$250,000
Custom amount
$
Confirmed annual giving: $250,000
Installation
pnpm dlx shadcn@latest add @ffg/dynamic-actionUsage
import { DynamicAction } from "@/components/ui/dynamic-action";
<DynamicAction
enabled
confirmedAmount={250000}
onAmountConfirm={(amount) => save(amount)}
/>The annual-giving card from the dashboard hero. The amount steps through fixed
stops via the carousel (◂ / ▸), or a custom value can be typed and applied
with Update. Each confirmed amount is reported up through onAmountConfirm.
- carousel — steps between fixed giving stops; at the min/max boundary the matching nav reads as disabled and toasts a hint to use the custom field
- decrease guard — the first decrease click arms the control and toasts a nudge; a second click within 3s actually steps down
- custom amount — typed value applied with Update or the Enter key
Props:
- enabled — when
false, renders nothing (defaults totrue) - onAmountConfirm — called with the confirmed amount on every commit
- confirmedAmount — the externally tracked confirmed amount
Dark mode: the card and inputs use transparent fills over
border-border; the value and labels map to the foreground / muted-foreground pair and the Update button maps to--primary, so the whole card inverts correctly in dark mode.