- No data uploaded
- Instant results
Bootstrap 5 Currency Pricing Table for React
A production-ready minimal currency pricing table: a dynamic pricing section that detects the visitor’s currency, shows purchasing-power-adjusted regional prices and lets users switch between USD, EUR, GBP, INR and JPY. Pick your brand color, toggle dark mode and corner radius — the live preview and the React code update instantly in your browser.
Live component editor
import 'bootstrap/dist/css/bootstrap.min.css';
import './theme.css';
import { useState } from 'react';
// Region → currency (extend as needed). Prices below are regional, not FX conversions.
const EUROZONE = ['AT', 'BE', 'CY', 'DE', 'EE', 'ES', 'FI', 'FR', 'GR', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PT', 'SI', 'SK'];
const REGION_CURRENCY = { US: 'USD', GB: 'GBP', IN: 'INR', JP: 'JPY' };
function detectCurrency() {
try {
// Prefer a country injected by your edge (e.g. Cloudflare CF-IPCountry) if present.
const region = document.documentElement.dataset.country || new Intl.Locale(navigator.language).maximize().region;
if (REGION_CURRENCY[region]) return REGION_CURRENCY[region];
if (EUROZONE.includes(region)) return 'EUR';
} catch {
// SSR / very old browsers → fall through to the default
}
return 'USD';
}
export default function CurrencyPricing() {
const [currency, setCurrency] = useState(() => detectCurrency());
return (
<section className="px-4 py-5">
<div className="mw-4xl mx-auto">
<div className="text-center">
<span className="badge rounded-pill bg-brand-subtle text-brand">Fair regional pricing</span>
<h2 className="mt-2 fs-3 fw-bold text-body-emphasis">Pricing in your currency</h2>
<p className="mt-2 text-body-secondary">We detected your currency automatically — switch any time.</p>
<div className="mt-4 d-flex flex-wrap justify-content-center gap-2" role="group" aria-label="Currency">
<button type="button" className="btn btn-outline-secondary choice fw-semibold rounded-2" onClick={() => setCurrency('USD')} aria-pressed={currency === 'USD'}>USD</button>
<button type="button" className="btn btn-outline-secondary choice fw-semibold rounded-2" onClick={() => setCurrency('EUR')} aria-pressed={currency === 'EUR'}>EUR</button>
<button type="button" className="btn btn-outline-secondary choice fw-semibold rounded-2" onClick={() => setCurrency('GBP')} aria-pressed={currency === 'GBP'}>GBP</button>
<button type="button" className="btn btn-outline-secondary choice fw-semibold rounded-2" onClick={() => setCurrency('INR')} aria-pressed={currency === 'INR'}>INR</button>
<button type="button" className="btn btn-outline-secondary choice fw-semibold rounded-2" onClick={() => setCurrency('JPY')} aria-pressed={currency === 'JPY'}>JPY</button>
</div>
</div>
<div className="mt-5 row row-cols-1 row-cols-md-2 g-4">
<div className="col">
<div className="h-100 p-5 d-flex flex-column bg-body border shadow-sm rounded-3">
<h3 className="fs-5 fw-semibold text-body-emphasis">Pro</h3>
<p className="mt-1 small text-body-secondary">For individuals and small teams.</p>
<p className="mt-4">
<span hidden={currency !== 'USD'}><span className="fs-2 fw-bold text-body-emphasis">$29</span></span>
<span hidden={currency !== 'EUR'}><span className="fs-2 fw-bold text-body-emphasis">€27</span></span>
<span hidden={currency !== 'GBP'}><span className="fs-2 fw-bold text-body-emphasis">£23</span></span>
<span hidden={currency !== 'INR'}><span className="fs-2 fw-bold text-body-emphasis">₹999</span></span>
<span hidden={currency !== 'JPY'}><span className="fs-2 fw-bold text-body-emphasis">¥3,900</span></span>
<span className="small text-body-secondary">/month</span>
</p>
<ul className="list-unstyled mt-4 mb-5 d-flex flex-column gap-2 flex-fill">
<li className="small text-body">✓ Unlimited projects</li>
<li className="small text-body">✓ Priority email support</li>
<li className="small text-body">✓ Custom domain</li>
</ul>
<a href="#" className="btn btn-outline-secondary fw-semibold rounded-2 w-100">Choose Pro</a>
</div>
</div>
<div className="col">
<div className="h-100 p-5 d-flex flex-column bg-body border shadow-sm rounded-3 border-brand">
<h3 className="fs-5 fw-semibold text-body-emphasis">Team</h3>
<p className="mt-1 small text-body-secondary">For growing companies.</p>
<p className="mt-4">
<span hidden={currency !== 'USD'}><span className="fs-2 fw-bold text-body-emphasis">$79</span></span>
<span hidden={currency !== 'EUR'}><span className="fs-2 fw-bold text-body-emphasis">€73</span></span>
<span hidden={currency !== 'GBP'}><span className="fs-2 fw-bold text-body-emphasis">£62</span></span>
<span hidden={currency !== 'INR'}><span className="fs-2 fw-bold text-body-emphasis">₹2,999</span></span>
<span hidden={currency !== 'JPY'}><span className="fs-2 fw-bold text-body-emphasis">¥11,000</span></span>
<span className="small text-body-secondary">/month</span>
</p>
<ul className="list-unstyled mt-4 mb-5 d-flex flex-column gap-2 flex-fill">
<li className="small text-body">✓ Everything in Pro</li>
<li className="small text-body">✓ 10 seats included</li>
<li className="small text-body">✓ SSO & audit log</li>
</ul>
<a href="#" className="btn btn-brand fw-semibold rounded-2 w-100">Choose Team</a>
</div>
</div>
</div>
<p className="mt-4 text-center small text-body-secondary">Prices exclude local taxes. You are charged in the currency shown.</p>
</div>
</section>
);
}
/* theme.css — brand color #4f46e5 for Bootstrap 5.3 */
:root { --brand: #4f46e5; --brand-hover: #433cc3; --brand-rgb: 79, 70, 229; --brand-contrast: #ffffff; }
.btn-brand {
--bs-btn-color: var(--brand-contrast); --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
--bs-btn-hover-color: var(--brand-contrast); --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover);
--bs-btn-active-color: var(--brand-contrast); --bs-btn-active-bg: var(--brand-hover); --bs-btn-active-border-color: var(--brand-hover);
--bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.text-brand { color: var(--brand) !important; }
.border-brand { border: 2px solid var(--brand) !important; }
.bg-brand-subtle { background-color: rgba(var(--brand-rgb), .12) !important; }
.form-control:focus, .form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .25); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.overlay { background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); z-index: 1050; }
.choice[aria-pressed="true"] { border-color: var(--brand) !important; color: var(--brand) !important; box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .2); }
.mw-sm { max-width: 24rem; } .mw-md { max-width: 28rem; } .mw-lg { max-width: 32rem; } .mw-xl { max-width: 36rem; }
.mw-2xl { max-width: 42rem; } .mw-4xl { max-width: 56rem; } .mw-6xl { max-width: 72rem; }
More Bootstrap components for React
All components →- Pricing Table A three-tier pricing section with a monthly/yearly billing toggle, a highlighted “most popular” plan and feature checklists
- Razorpay Checkout Form A two-column checkout with an order summary (subtotal, GST, total in INR), contact fields, a UPI / card / netbanking selector and a pay button that opens Razorpay Checkout
- FAQ Accordion A frequently-asked-questions section with four expandable items, each toggled by a button that exposes its state via aria-expanded
- Feature Grid A marketing section with a centered heading and a responsive grid of six feature cards, each with an icon badge, title and description
- Testimonial Slider A customer testimonial carousel that shows one quote at a time with labelled slide buttons — no autoplay, so users stay in control
- Login Modal A centered sign-in dialog with email and password fields, “remember me”, a forgot-password link and a social sign-in button
- Signup Form A registration card with name, email and password fields, a password hint, a terms-of-service checkbox and a primary call to action
- Navbar A responsive top navigation bar with a logo, primary links, a sign-in/CTA pair on desktop and a collapsible hamburger menu on mobile
Install Bootstrap 5 for React
Create a React project with Vite and install Bootstrap:
npm create vite@latest my-app -- --template react
cd my-app
npm install
npm install bootstrapSave the generated theme.css next to the component; the component file already imports bootstrap/dist/css/bootstrap.min.css and ./theme.css. No Bootstrap JavaScript is required — interactivity uses useState.
Use the currency pricing table in React
// App.jsx
import CurrencyPricing from './CurrencyPricing';
export default function App() {
return <CurrencyPricing />;
}How currency detection works
The generated detectCurrency() reads the browser locale (navigator.language → Intl.Locale(...).maximize().region) and maps the region to a currency — no network request, no third-party geo-IP service, nothing to slow down rendering.
For IP-based detection, pass the country from your CDN: Cloudflare exposes it as the CF-IPCountry request header (and request.cf.country in Workers). Inject it into the page (for example as <html data-country="IN">) and read it first in detectCurrency(). Always let users override the guess, and charge in the currency you display.
Accessibility & customization
The currency switcher is a labelled group of toggle buttons using aria-pressed; prices are rendered as text for every currency so screen readers and search engines always see a price.
Every color, radius and dark-mode choice is baked into plain Bootstrap classes plus a tiny CSS-variable theme file, so the copied code has no runtime dependency on this site.
Compatibility
| Item | Details |
|---|---|
| CSS framework | Bootstrap 5.3+ (CSS only) |
| Library | React 18+ (function component) |
| Interactive state | currency |
| Dark mode | Yes — toggle in the editor |
| Style | Minimal |