What problem does it solve?
Primer Web Components provide a framework-agnostic set of UI elements to build checkout and payment flows across frameworks. They simplify embedding a consistent checkout experience without locking to a specific frontend framework, enabling reuse of components like primer-checkout, primer-card-form, and primer-payment-method across React, Next.js, Vue, Svelte, or vanilla JavaScript projects.
Core Features & Use Cases
- Framework-agnostic web components for checkout and payment experiences using Primer's components.
- Declarative and SSR-friendly; supports slots and custom events for flexible integrations.
- Example use cases: embedding a full checkout in a React page, integrating a payment method UI in Next.js, or building a vanilla JS checkout page with accessible components.
Quick Start
Install the Primer package: npm install @primer-io/primer-js
Load Primer and initialize: import { loadPrimer } from '@primer-io/primer-js'; loadPrimer();
Embed in your app: <primer-checkout client-token="YOUR_TOKEN"></primer-checkout>
For React/Vue/Svelte, pass a stable options object to avoid re-initialization and ensure seamless user experience.