Currency Converter Card
tripled/currency-converter-card-shadcnuiFreeComponent
Finance conversion widget with animated inputs, simulated exchange updates, and contextual feedback
Live preview
live · rendered by the registry
Rendered by tripled on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.tripled.work/r/currency-converter-card-shadcnui.jsonSource
1"use client";23import { motion } from "framer-motion";4import { ArrowLeftRight, TrendingUp } from "lucide-react";5import { useEffect, useMemo, useState } from "react";67type Currency = {8 code: string;9 name: string;10 symbol: string;11};1213type CurrencyCode = (typeof CURRENCIES)[number]["code"];1415const CURRENCIES: Currency[] = [16 { code: "USD", name: "US Dollar", symbol: "$" },17 { code: "EUR", name: "Euro", symbol: "€" },18 { code: "GBP", name: "British Pound", symbol: "£" },19 { code: "JPY", name: "Japanese Yen", symbol: "¥" },20 { code: "AUD", name: "Australian Dollar", symbol: "A$" },21 { code: "CAD", name: "Canadian Dollar", symbol: "C$" },22 { code: "CHF", name: "Swiss Franc", symbol: "CHF" },23 { code: "CNY", name: "Chinese Yuan", symbol: "¥" },24 { code: "INR", name: "Indian Rupee", symbol: "₹" },25 { code: "MXN", name: "Mexican Peso", symbol: "$" },26];2728const BASE_INDEX: Record<CurrencyCode, number> = {29 USD: 1,30 EUR: 0.92,31 GBP: 0.78,32 JPY: 147.42,33 AUD: 1.5,34 CAD: 1.36,35 CHF: 0.88,36 CNY: 7.11,37 INR: 83.24,38 MXN: 17.12,39};4041export function CurrencyConverterCard() {42 const [amount, setAmount] = useState<string>("100");43 const [fromCurrency, setFromCurrency] = useState<CurrencyCode>("USD");44 const [toCurrency, setToCurrency] = useState<CurrencyCode>("EUR");45 const [result, setResult] = useState<number | null>(null);46 const [rate, setRate] = useState<number | null>(null);47 const [loading, setLoading] = useState(false);48 const [isFlipped, setIsFlipped] = useState(false);49 const [error, setError] = useState<string>("");5051 useEffect(() => {52 const trimmed = amount.trim();5354 if (!trimmed) {55 setLoading(false);56 setError("");57 setRate(null);58 setResult(null);59 return;60 }6162 const numericAmount = Number(trimmed);6364 if (Number.isNaN(numericAmount)) {65 setLoading(false);66 setError("Enter a valid amount");67 setRate(null);68 setResult(null);69 return;70 }7172 let cancelled = false;7374 setLoading(true);75 setError("");7677 const timeout = window.setTimeout(() => {78 if (cancelled) return;7980 const fromIndex = BASE_INDEX[fromCurrency];81 const toIndex = BASE_INDEX[toCurrency];8283 if (!fromIndex || !toIndex) {84 setError("Unsupported currency selection");85 setLoading(false);86 return;87 }8889 const nextRate = toIndex / fromIndex;9091 setRate(nextRate);92 setResult(numericAmount * nextRate);93// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from tripled
All 282 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Chat Interfaceai-chat-interface-shadcnui | tripled | Components | Free | 2 deps | |
| AI Glow Inputai-glow-input-shadcnui | tripled | Components | Free | 2 deps | |
| AI Loading Skeletonai-loading-skeleton-shadcnui | tripled | Components | Free | 2 deps | |
| AI Response Typing Streamai-response-typing-shadcnui | tripled | Components | Free | 2 deps | |
| AI Unlock Animationai-unlock-animation-shadcnui | tripled | Components | Free | 2 deps | |
| Animated Accordionanimated-accordion-shadcnui | tripled | Components | Free | 2 deps | |
| Animated Card Stackanimated-card-stack-baseui | tripled | Components | Free | 2 deps | |
| Animated Card Stackanimated-card-stack-shadcnui | tripled | Components | Free | 2 deps |
