Skip to main content

<primer-main>

Optional container that provides structured slots for payment methods and checkout completion. Handles state transitions (loading, success, error) automatically.

Quick reference


Examples

Default (all methods)

Renders all available payment methods automatically.

Custom payment methods

Custom success screen

Both slots


Slots


Events

<primer-main> does not emit its own events. It subscribes to parent events internally to manage slot visibility. When bypassing <primer-main>, you handle these events yourself.

Relevant parent events

When you bypass <primer-main>

If you use a custom <div slot="main"> instead of <primer-main>, you must handle these events directly:

CSS properties


States

This component automatically manages visibility based on checkout state:

Usage guidelines

Do

  • Use for structured customization with automatic state handling
  • Include <primer-error-message-container> when customizing payments slot
  • Provide custom success screen via checkout-complete slot

Don’t

  • Don’t use if you need full control over state — use custom main slot on <primer-checkout> instead
  • Don’t handle error states here — managed by <primer-checkout>

Alternative: full customization

For complete control, bypass <primer-main>:

Content guidelines

Success screen text

Section headings


See also

primer-checkout

Parent component

Layout customization

Slot usage guide

Error handling

Error display patterns