> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Components

> The full component catalog: core, card form and utility components, their hierarchy, and how they communicate.

Primer Checkout provides a set of components that work together to create a complete payment experience. This page gives you an overview of all available components and how they relate to each other.

## Component Hierarchy

> [tab] Web
>
> The components follow a hierarchical structure where parent components provide context to their children. Each parent literally contains its children. The spatial nesting mirrors the DOM nesting.
>
> > [tab] Without vault
>
> > [tab] With vault

> [tab] Android
>
> The components follow a hierarchical structure where the checkout controller manages presentation components, which in turn contain SDK UI elements.
>
> > [tab] CheckoutSheet
>
> > [tab] CheckoutHost

> [tab] iOS
>
> The iOS SDK uses a SwiftUI slot hierarchy. The managed `PrimerCheckout` view renders the full flow on its own and exposes no slots. For a composable layout, the `.primerCheckoutSession` modifier places your `PrimerCheckoutSession` in the environment. Composable views such as `PrimerCardForm` and `PrimerPaymentMethods` resolve it from there.

> [tab] React Native
>
> The React Native SDK uses a React context hierarchy. `PrimerCheckoutProvider` owns the checkout session, and the Primer components and hooks below it read the session from there. Render `PrimerCheckoutSheet` inside the provider for the prebuilt flow, or compose your own layout from the components and hooks. Card components also need `PrimerCardFormProvider` above them.

## Core Components

> [tab] Web
>
> | Component | Purpose |
> | - | - |
> | [`<primer-checkout>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-checkout) | Root component that initializes the SDK and provides checkout context |
> | [`<primer-main>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-main) | Manages checkout states and provides layout customization |
> | [`<primer-payment-method>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-payment-method) | Renders a specific payment method (card, PayPal, Apple Pay, etc.) |
> | [`<primer-payment-method-container>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-payment-method-container) | Container for filtering and organizing multiple payment methods |

> [tab] Android
>
> ### Checkout controllers
>
> | Function | Returns | Purpose |
> | - | - | - |
> | `rememberPrimerCheckoutController()` | `PrimerCheckoutController` | Main session controller |
> | `rememberCardFormController()` | `PrimerCardFormController` | Card form state and actions |
> | `rememberPaymentMethodsController()` | `PrimerPaymentMethodsController` | Available payment methods |
> | `rememberVaultedPaymentMethodsController()` | `PrimerVaultedPaymentMethodsController` | Saved payment methods |
>
> ### Presentation components
>
> | Component | Description | API Reference |
> | - | - | - |
> | `PrimerCheckoutSheet` | Modal bottom sheet checkout | [Reference](https://primer.io/docs/sdk/android-checkout/v3.0.0-beta/api/primer-checkout-sheet.md) |
> | `PrimerCheckoutHost` | Inline checkout host | [Reference](https://primer.io/docs/sdk/android-checkout/v3.0.0-beta/api/primer-checkout-host.md) |
> | `PrimerCardForm` | Card payment form | [Reference](https://primer.io/docs/sdk/android-checkout/v3.0.0-beta/api/card-form/primer-card-form.md) |
> | `PrimerPaymentMethods` | Payment method list | [Reference](https://primer.io/docs/sdk/android-checkout/v3.0.0-beta/api/payment-methods/primer-payment-methods.md) |

> [tab] iOS
>
> ### Entry points
>
> | Component | Description | API Reference |
> | - | - | - |
> | `PrimerCheckout` | Managed SwiftUI view that renders the full default flow | [Reference](https://primer.io/docs/sdk/ios-checkout/v3.0.0-beta/api/primer-checkout.md) |
> | `PrimerCheckoutSession` + `.primerCheckoutSession` | Session owner for inline, composable SwiftUI layouts | [Reference](https://primer.io/docs/sdk/ios-checkout/v3.0.0-beta/api/primer-checkout-session.md) |
> | `PrimerCheckoutPresenter` | UIKit presenter (modal sheet) with a delegate | [Reference](https://primer.io/docs/sdk/ios-checkout/v3.0.0-beta/api/primer-checkout-presenter.md) |
>
> ### Composable views
>
> Each composable view exposes slots and resolves its session from the environment injected by `.primerCheckoutSession(_:theme:onCompletion:)`.
>
> | Component | Description | API Reference |
> | - | - | - |
> | `PrimerCardForm` | Card payment form with `cardDetails`, `billingAddress`, and `submitButton` slots | [Reference](https://primer.io/docs/sdk/ios-checkout/v3.0.0-beta/api/card-form/primer-card-form.md) |
> | `PrimerPaymentMethods` | Available payment method list with `header`, `method`, and `emptyState` slots | [Reference](https://primer.io/docs/sdk/ios-checkout/v3.0.0-beta/api/payment-methods/primer-payment-methods.md) |
> | `PrimerVaultedPaymentMethods` | Saved payment method shortcut for returning customers, with `header`, `item`, and `submitButton` slots. It pays with the selected saved method and renders nothing when none is saved. | [Reference](https://primer.io/docs/sdk/ios-checkout/v3.0.0-beta/api/payment-methods/vaulted-payment-methods.md) |

> [tab] React Native
>
> ### Entry points
>
> | Component | Description | API Reference |
> | - | - | - |
> | `PrimerCheckoutProvider` | Root component. Starts the checkout session from a client token and provides it, with your theme and callbacks, to the components and hooks below it | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-provider.md) |
> | `PrimerCheckoutSheet` | Prebuilt bottom sheet that runs the whole checkout | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-sheet.md) |
> | `usePrimerCheckout` | Hook that returns the checkout state, the payment outcome and the checkout actions | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/use-primer-checkout.md) |
>
> ### Composable components
>
> Render these components inside `PrimerCheckoutProvider` to build your own layout.
>
> | Component | Description | API Reference |
> | - | - | - |
> | `PrimerPaymentMethodList` | The session's payment methods as buttons. Calls `onSelect` with the method the shopper taps, and doesn't start a payment itself | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/primer-payment-method-list.md) |
> | `PrimerCardFormProvider` | Holds the card form state for `PrimerCardForm`, the card inputs, and `usePrimerCardForm` | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/primer-card-form.md#primercardformprovider) |
> | `PrimerCardForm` | Card number, expiry date, CVV, and cardholder name fields | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/primer-card-form.md) |
> | `PrimerCardNetworkSelector` | Network selector for co-badged cards | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-networks.md#primercardnetworkselector) |
> | `PrimerAcceptedCardNetworks` | Row of the card networks the session accepts | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-networks.md#primeracceptedcardnetworks) |
> | `PrimerKlarnaPaymentView` | Klarna's embedded payment view, for the Klarna flow of `usePrimerPaymentMethod` | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method.md#klarna) |

## Card Form Components

> [tab] Web
>
> | Component | Purpose |
> | - | - |
> | [`<primer-card-form>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-card-form) | Container that provides context for card inputs |
> | [`<primer-input-card-number>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-input-card-number) | Secure hosted input for card number |
> | [`<primer-input-card-expiry>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-input-card-expiry) | Secure hosted input for expiry date |
> | [`<primer-input-cvv>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-input-cvv) | Secure hosted input for CVV |
> | [`<primer-input-card-holder-name>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-input-card-holder-name) | Input for cardholder name |
> | [`<primer-card-form-submit>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-card-form-submit) | Submit button with built-in loading states |
> | [`<primer-input-label>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-input-label) | Label component for card inputs |
> | [`<primer-input-wrapper>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-input-wrapper) | Wrapper for styling and layout of inputs |
> | [`<primer-billing-address>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-card-form/primer-billing-address) | Billing address collection form |

> [tab] Android
>
> ### Defaults objects
>
> | Object | Parent Component | Sub-components |
> | - | - | - |
> | `PrimerCheckoutSheetDefaults` | `PrimerCheckoutSheet` | `Splash`, `Loading`, `Success`, `Error`, `PaymentMethodSelection`, `VaultedMethods`, `PaymentMethods` |
> | `CardFormDefaults` | `PrimerCardForm` | `CardNumberField`, `ExpiryField`, `CvvField`, `CardholderField`, `CardNetworkField`, `CountryCodeField`, billing fields, `SubmitButton` |
> | `PaymentMethodsDefaults` | `PrimerPaymentMethods` | `SectionHeader`, `Method`, `EmptyState` |
>
> ### State types
>
> | Type | Purpose | Values |
> | - | - | - |
> | `PrimerCheckoutState` | Checkout lifecycle and payment outcomes | `Loading`, `Ready`, `Success`, `Failure` |
> | `PrimerCardFormController.State` | Card form state | Field values, validation, loading |

> [tab] iOS
>
> ### Defaults namespaces
>
> Each composable view falls back to its `Defaults` namespace when a slot is omitted. You can also call these helpers inside your own slots to keep the SDK rendering while adding custom layout.
>
> | Namespace | Parent component | Section helpers | Per-field building blocks |
> | - | - | - | - |
> | `CardFormDefaults` | `PrimerCardForm` | `cardDetails`, `billingAddress`, `submitButton` | `cardNumber`, `expiryDate`, `cvv`, `cardholderName`, `cardNetwork`, `countryCode`, `firstName`, `lastName`, `addressLine1`, `addressLine2`, `city`, `state`, `postalCode` |
> | `PaymentMethodsDefaults` | `PrimerPaymentMethods` | `header`, `method`, `emptyState` | — |
> | `VaultedPaymentMethodsDefaults` | `PrimerVaultedPaymentMethods` | `header`, `item`, `submitButton` | — |
>
> Each `CardFormDefaults` per-field block takes the `PrimerCardFormSession` and returns a view: `CardFieldContent`, or `CardNetworkFieldContent` for `cardNetwork`. Every block except `cardNetwork` renders nothing unless its field is part of the active `CardFormConfiguration`. `cardNetwork` is a standalone co-badged card network selector. It renders only when the card has more than one available network. The `cardNumber` block and the full `cardDetails` section already show the network selector inside the card number field. Do not add `cardNetwork` next to either, or two selectors appear. Use `cardNetwork` only when you want the selector outside the card number field.
>
> ### Sessions
>
> | Session | Purpose | Key members |
> | - | - | - |
> | `PrimerCardFormSession` | Card form state and actions | `state`, `updateCardNumber(_:)`, `updateCountryCode(_:)`, `selectCardNetwork(_:)`, `submit()` |
> | `PrimerSelectionSession` | Payment method selection | `state`, `select(_:)`, `selectVaulted(_:)` (pays with a saved method), `vaultedPaymentMethods` |
>
> ### State types
>
> | Type | Purpose | Key properties |
> | - | - | - |
> | `PrimerCheckoutState` | Checkout lifecycle and outcome | `.initializing`, `.ready`, `.success`, `.failure`, `.dismissed` |
> | `PrimerCardFormState` | Card form state | `isValid`, `isLoading`, `fieldErrors`, `selectedNetwork`, `selectedCountry`, `data` |
> | `PrimerPaymentMethodSelectionState` | Payment method list | Available and selected payment methods |
>
> ### Field presence and styling
>
> There is no per-field configuration or styling struct. Which fields appear is Dashboard-driven through `CardFormConfiguration` (read from `session.state.configuration`), and visual styling is theme-driven via `PrimerCheckoutTheme` design tokens. To recompose a layout, arrange the `CardFormDefaults` per-field building blocks inside your own slot:
>
> ```swift theme={"dark"}
> PrimerCardForm(
>   cardDetails: { session in
>     VStack(spacing: 12) {
>       CardFormDefaults.cardNumber(session)
>       HStack(spacing: 12) {
>         CardFormDefaults.expiryDate(session)
>         CardFormDefaults.cvv(session)
>       }
>       CardFormDefaults.cardholderName(session)
>     }
>   }
> )
> ```

> [tab] React Native
>
> ### Card inputs
>
> Each input renders one card field that is already wired to the card form. Place the inputs inside `PrimerCardFormProvider`.
>
> | Component | Field | API Reference |
> | - | - | - |
> | `PrimerCardNumberInput` | Card number. Shows the co-badged network selector when the card has more than one accepted network | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md#primercardnumberinput) |
> | `PrimerExpiryDateInput` | Expiry date, as `MM/YY` | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md#primerexpirydateinput) |
> | `PrimerCVVInput` | Security code | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md#primercvvinput) |
> | `PrimerCardholderNameInput` | Cardholder name | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md#primercardholdernameinput) |
> | `PrimerTextInput` | Text input with the look of the card inputs, for your own fields | [Reference](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md#primertextinput) |
>
> ### Hooks
>
> | Hook | Purpose | Key members |
> | - | - | - |
> | `usePrimerCardForm` | Card form state and actions | `cardNumber`, `updateCardNumber(value)`, `isValid`, `errors`, `isSubmitting`, `submit()`, `reset()` |
> | `usePrimerCardNetwork` | Detected card network | `network`, `descriptor`, `iconSource` |
> | `usePrimerCardNetworkSelection` | Network selection on co-badged cards | `availableNetworks`, `selectedNetwork`, `isSelectorVisible`, `selectNetwork(identifier)` |
>
> ### State types
>
> | Type | Purpose | Key properties |
> | - | - | - |
> | `PrimerCheckoutContextValue` | Return value of `usePrimerCheckout()` | `isReady`, `error`, `clientSession`, `paymentOutcome` |
> | `PaymentOutcome` | Result of the latest payment attempt | `status` (`'success'`, `'pending'` or `'error'`), `data`, `error` |
> | `UsePrimerCardFormReturn` | Card form state | Field values, `isValid`, `errors`, `isSubmitting`, `isCardholderNameVisible`, `descriptor` |
>
> ### Field presence and styling
>
> `PrimerCardForm` shows the card fields in a fixed order and hides the cardholder name when the client session's `CARD_INFORMATION` checkout module turns it off. Visual styling comes from the `theme` prop of `PrimerCheckoutProvider`, and each input also takes its own `theme` of type `PrimerTextInputTheme`. To change the layout, arrange the card inputs yourself:
>
> ```tsx theme={"dark"}
> import { View } from 'react-native';
> import {
>   PrimerCardholderNameInput,
>   PrimerCardNumberInput,
>   PrimerCVVInput,
>   PrimerExpiryDateInput,
>   usePrimerCardForm,
> } from '@primer-io/react-native';
>
> function CardFields() {
>   const cardForm = usePrimerCardForm();
>
>   return (
>     <View style={{ gap: 12 }}>
>       <PrimerCardNumberInput />
>       <View style={{ flexDirection: 'row', gap: 12 }}>
>         <PrimerExpiryDateInput style={{ flex: 1 }} />
>         <PrimerCVVInput label={cardForm.descriptor.cvvLabel} style={{ flex: 1 }} />
>       </View>
>       {cardForm.isCardholderNameVisible && <PrimerCardholderNameInput />}
>     </View>
>   );
> }
> ```
>
> `PrimerCardNumberInput` already shows the co-badged network selector. Don't add `PrimerCardNetworkSelector` next to it, or two selectors appear. Render `PrimerCardholderNameInput` when `isCardholderNameVisible` is `true`, as above. Render `CardFields` inside `PrimerCardFormProvider`, and start the card payment method with `start()` from [`usePrimerPaymentMethod('PAYMENT_CARD')`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method).

## Utility Components

> [tab] Web
>
> | Component | Purpose |
> | - | - |
> | [`<primer-error-message-container>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-error-message-container) | Displays payment error messages |
> | [`<primer-vault-manager>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-vault-manager) | Manages saved payment methods |
> | [`<primer-show-other-payments>`](https://primer.io/docs/sdk/primer-checkout-web/components/primer-show-other-payments) | Toggle button to show additional payment methods |

> [tab] Android
>
> ### Theming
>
> | Class | Purpose |
> | - | - |
> | `PrimerTheme` | Root theme container |
> | `LightColorTokens` | Light mode colors |
> | `DarkColorTokens` | Dark mode colors |
> | `SpacingTokens` | Spacing values |
> | `TypographyTokens` | Font styles |
> | `RadiusTokens` | Corner radius |
> | `WidthTokens` | Border widths |
> | `SizeTokens` | Component sizes |

> [tab] iOS
>
> ### Theming
>
> | Struct | Purpose |
> | - | - |
> | `PrimerCheckoutTheme` | Root theme container |
> | `ColorOverrides` | Brand, background, text, border, icon, focus, and loader colors. Set light mode with `colors` and dark mode with `darkColors`. A color left nil in `darkColors` uses Primer's dark default, even when `colors` sets it. |
> | `RadiusOverrides` | Corner radius values |
> | `SpacingOverrides` | Spacing values |
> | `SizeOverrides` | Component sizes |
> | `TypographyOverrides` | Font styles and sizes |
> | `WidthOverrides` | Border widths for the default, focus, error, and selected states |
>
> ### Slot closures
>
> Customization points are the slots on the composable views. Each slot receives the relevant session (or model) and returns your view. `PrimerCardForm` and `PrimerPaymentMethods` slots are `@ViewBuilder` closures. `PrimerVaultedPaymentMethods` slots return `AnyView`, so wrap your content in `AnyView(...)`.
>
> | Slot | Receives | On |
> | - | - | - |
> | `cardDetails`, `billingAddress`, `submitButton` | `PrimerCardFormSession` | `PrimerCardForm` |
> | `header`, `emptyState` | `PrimerSelectionSession` | `PrimerPaymentMethods` |
> | `method` | `CheckoutPaymentMethod`, `() -> Void` | `PrimerPaymentMethods` |
> | `header` | `PrimerSelectionSession` | `PrimerVaultedPaymentMethods` |
> | `item` | `VaultedMethod`, `Bool` (is selected), `() -> Void` (on select) | `PrimerVaultedPaymentMethods` |
> | `submitButton` | `Bool` (is loading), `Bool` (is enabled), `() -> Void` (on submit) | `PrimerVaultedPaymentMethods` |

> [tab] React Native
>
> ### Theming
>
> | Type | Purpose |
> | - | - |
> | `PrimerThemeOverride` | Type of the provider's `theme` prop. Holds `light` and `dark` overrides, and every token group is set per mode |
> | `PrimerColorTokens` | Brand, background, text, border, icon, focus, loader, and overlay colors |
> | `PrimerSpacingTokens` | Spacing values |
> | `PrimerTypographyTokens` | Font family and text styles |
> | `PrimerRadiusTokens` | Corner radius values |
> | `PrimerSizeTokens` | Component sizes |
> | `PrimerWidthTokens` | Border widths for the default, focus, selected, and error states |
> | `PrimerTextInputTheme` | Style overrides for a single input, through its `theme` prop |
>
> `usePrimerTheme()` returns the tokens in effect, so you can style your own components to match. See [`PrimerThemeOverride`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/primer-theme-override).
>
> ### Status screens and hooks
>
> Customization points are the components you render and the hooks you build your own UI on.
>
> | API | Purpose |
> | - | - |
> | [Status screens](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/status-screens.md) | `PrimerLoadingScreen`, `PrimerSuccessScreen`, `PrimerErrorScreen`, and `PrimerStatusScreenLayout`: the loading and result screens of the prebuilt sheet, for your own layout |
> | [`usePrimerPaymentMethods`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/primer-payment-method-list#useprimerpaymentmethods) | The session's payment methods as data, for your own list |
> | [`usePrimerPaymentMethod`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method) | One hook for any payment method: check its `kind`, then start it |
> | [`usePrimerVaultManager`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-vault-manager) | The customer's saved payment methods: list, select, pay, and delete |
> | [`usePrimerLocalization`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/use-primer-localization) | Translated strings, and currency and date formatting in the device language |

## Basic Usage

> [tab] Web
>
> ```html theme={"dark"}
> <primer-checkout client-token="your-client-token">
>   <primer-main slot="main">
>     <div slot="payments">
>       <!-- Payment methods appear here -->
>       <primer-payment-method type="PAYMENT_CARD"></primer-payment-method>
>       <primer-payment-method type="PAYPAL"></primer-payment-method>
>
>       <!-- Error display -->
>       <primer-error-message-container></primer-error-message-container>
>     </div>
>
>     <div slot="checkout-complete">
>       <h2>Payment successful!</h2>
>     </div>
>   </primer-main>
> </primer-checkout>
> ```

> [tab] Android
>
> ```kotlin theme={"dark"}
> @Composable
> fun CheckoutScreen(clientToken: String) {
>     val checkout = rememberPrimerCheckoutController(clientToken)
>     val state by checkout.state.collectAsStateWithLifecycle()
>
>     LaunchedEffect(state) {
>         when (val s = state) {
>             is PrimerCheckoutState.Success -> navigateToConfirmation(s.checkoutData)
>             is PrimerCheckoutState.Failure -> {
>                 Log.e("Checkout", "Failed: ${s.primerError.description}")
>             }
>             else -> Unit
>         }
>     }
>
>     PrimerCheckoutSheet(
>         checkout = checkout,
>         onDismiss = { navigateBack() },
>     )
> }
> ```

> [tab] iOS
>
> ```swift theme={"dark"}
> struct CheckoutView: View {
>   let clientToken: String
>
>   var body: some View {
>     PrimerCheckout(
>       clientToken: clientToken,
>       primerSettings: PrimerSettings(paymentHandling: .auto),
>       primerTheme: PrimerCheckoutTheme(
>         colors: ColorOverrides(primerColorBrand: .blue)
>       ),
>       onCompletion: { state in
>         switch state {
>         case .success(let result):
>           print("Payment: \(result.paymentId)")
>         case let .failure(error, _):
>           print("Failed: \(error.errorId)")
>         case .dismissed:
>           print("Dismissed")
>         default:
>           break
>         }
>       }
>     )
>   }
> }
> ```

> [tab] React Native
>
> ```tsx theme={"dark"}
> import { useEffect, useState } from 'react';
> import { Button } from 'react-native';
> import {
>   PrimerCheckoutProvider,
>   PrimerCheckoutSheet,
>   usePrimerCheckout,
> } from '@primer-io/react-native';
> import type { PrimerSettings, PrimerThemeOverride } from '@primer-io/react-native';
>
> const settings: PrimerSettings = {
>   uiOptions: { appearanceMode: 'SYSTEM' },
> };
>
> const theme: PrimerThemeOverride = {
>   light: { colors: { brand: '#2F6FED' } },
>   dark: { colors: { brand: '#6B9BFF' } },
> };
>
> function PaymentResult() {
>   const { paymentOutcome } = usePrimerCheckout();
>
>   useEffect(() => {
>     if (paymentOutcome?.status === 'success') {
>       console.log('Payment:', paymentOutcome.data.payment?.id);
>     } else if (paymentOutcome?.status === 'error') {
>       console.log('Failed:', paymentOutcome.error.errorId);
>     }
>   }, [paymentOutcome]);
>
>   return null;
> }
>
> export function CheckoutScreen({ fetchClientToken }: { fetchClientToken: () => Promise<string> }) {
>   const [clientToken, setClientToken] = useState<string | null>(null);
>   const [visible, setVisible] = useState(false);
>
>   const openCheckout = async () => {
>     setClientToken(await fetchClientToken());
>     setVisible(true);
>   };
>
>   return (
>     <>
>       <Button title="Checkout" onPress={openCheckout} />
>       {clientToken !== null && (
>         <PrimerCheckoutProvider clientToken={clientToken} settings={settings} theme={theme}>
>           <PaymentResult />
>           <PrimerCheckoutSheet
>             visible={visible}
>             onRequestDismiss={() => setVisible(false)}
>             onDismiss={() => setClientToken(null)}
>           />
>         </PrimerCheckoutProvider>
>       )}
>     </>
>   );
> }
> ```

## How Components Communicate

Components communicate through:

1. **Context inheritance** - Child components receive context from their parents (e.g., card inputs receive form context from their parent card form)
2. **Events** - Components emit events that you can listen to for state changes
3. **Customization points** (Slots on Web, Composable lambdas on Android, slot closures on iOS, composition with components and hooks on React Native) - Allow you to inject custom content at specific points

> [!NOTE]
>
> For details on events, see the [Events guide](https://primer.io/docs/checkout/primer-checkout/configuration/events.md).

## Customization at Each Level

> [tab] Web
>
> * **`<primer-checkout>`** - SDK options, theming, global configuration
> * **`<primer-main>`** - Layout structure through customization points
> * **`<primer-payment-method>`** - Payment method-specific options
> * **`<primer-card-form>`** - Complete control over card form layout and styling

> [tab] Android
>
> * **`PrimerCheckoutSheet` / `PrimerCheckoutHost`** - Presentation mode and event handling
> * **`PrimerCheckoutSheetDefaults`** - Override default screens (splash, loading, success, error)
> * **`CardFormDefaults`** - Customize individual card form fields
> * **`PrimerTheme`** - Colors, typography, spacing, and border radius

> [tab] iOS
>
> * **`PrimerCheckout`** - Client token, settings, theme, and completion handling for the managed flow
> * **`PrimerCheckoutSession` + `.primerCheckoutSession`** - Inline, composable layouts and completion handling through `onCompletion`
> * **`PrimerPaymentMethods`** - `header`, `method`, and `emptyState` slots for the payment method list
> * **`PrimerCardForm`** - `cardDetails`, `billingAddress`, and `submitButton` slots, recomposed from `CardFormDefaults`
> * **`PrimerCheckoutTheme`** - Light and dark colors, typography, spacing, sizes, radius, and border widths

> [tab] React Native
>
> * **`PrimerCheckoutProvider`** - Client token, settings, theme, and the `onCheckoutComplete`, `onError`, and `onBeforePaymentCreate` callbacks
> * **`PrimerCheckoutSheet`** - The prebuilt flow, opened and closed through `visible` and `onRequestDismiss`
> * **`PrimerPaymentMethodList`** - Which payment methods to show, with `include` and `exclude`, and what happens on `onSelect`
> * **`PrimerCardForm`** and the card inputs - The card form, or the inputs in your own layout with their own `label`, `placeholder`, and `theme`
> * **`PrimerThemeOverride`** - Colors, typography, spacing, sizes, radii, and border widths, each set separately for light and dark mode

## See also

> [card] [Using Slots](https://primer.io/docs/checkout/primer-checkout/build-your-ui/layout-customization.md)
>
> Learn how to customize layout with slots

> [card] [Build a custom card form](https://primer.io/docs/checkout/primer-checkout/guides-and-recipes/build-custom-card-form.md)
>
> Step-by-step tutorial for card form customization

> [card] [Styles](https://primer.io/docs/checkout/primer-checkout/build-your-ui/styling-customization.md)
>
> Customize appearance with CSS variables

> [card] [SDK Reference](https://primer.io/docs/sdk/primer-checkout-web/components/primer-checkout.md)
>
> Detailed API documentation for all components


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.