Use slots to insert your own content
Primer Checkout uses slots as the primary mechanism for layout customization. Slots are named placeholders in components where you can insert your own content or Primer components.Component hierarchy and available slots
The checkout layout follows a hierarchical structure with slots at each level:Cprimer-checkout
└── Mprimer-mainslot: main
├── PPayment Methodsslot: payments
│ ├── ◇primer-payment-method
│ ├── Fprimer-card-form
│ └── !primer-error-message-container
└── →Success Screenslot: checkout-complete
CRoot
MLayout
PContainer
FCard form
#Input fields
→Actions / errors
◇Payment method
<primer-checkout> Component
<primer-checkout> Component
The root component that initializes the SDK and provides the checkout context.Available Slots:
main- The main content area for the checkout experience
<primer-main> Component (Optional)
<primer-main> Component (Optional)
A pre-built component that manages checkout states and provides additional slots for customization.Available Slots:
payments- Contains payment method componentscheckout-complete- Content shown on successful payment
Error states are managed by the parent
<primer-checkout> component, not by <primer-main>. If you need custom error handling, implement it directly in the main slot of <primer-checkout> without using <primer-main>.Customization approaches
You can customize the checkout layout in two main ways:Using <primer-main> with custom slots
This approach allows you to customize specific parts of the checkout while relying on <primer-main> to handle state management:
Fully custom implementation
For complete control, you can bypass<primer-main> entirely and provide your own implementation. This requires handling state management yourself through events.
For details on implementing fully custom layouts, see Layout with Event Handling.
Why slot names matter
Slot names are crucial for several reasons:- Component targeting - Names tell the component exactly where to insert your content
- Default content - Components can provide default content for slots that aren’t filled
- Preventing accidental rendering - Content without a matching slot won’t be displayed
- Multiple insertion points - Different named slots allow multiple insertion points
Styling custom layouts
When styling custom layouts, use CSS variables for consistency:Next steps
Slot Architecture Explorer
Explore the full component hierarchy and all available slots interactively
Layout with Event Handling
Learn about events, dynamic rendering, and fully custom implementations
Error Handling
Handle payment failures and display error messages
Design Tokens Explorer
Explore CSS variables and see which components they affect