# mount: Show the banner

> STEP 3-1

```ts
mount(target: HTMLElement): { unmount(): void }
```

Shows the banner in the given element. When the SDK fetches the cart and the benefit set (the commitment charge and benefits for each range), and when it removes a leftover Checkout+ product, follow [What the SDK does for each trigger](./shopify-headless-behavior.html#what-the-sdk-does-for-each-trigger).

- When to call: When the element for the banner is ready ([Step 4: Show the banner](./shopify-headless-banner.html)). You can show the banner on both the cart page and the cart drawer, and both show the same content.
- Arguments: `target` is the HTML element to show the banner in. Pass an empty element.
  - If the element already has content, the SDK keeps the content and adds the banner after it.
  - An element shows one banner. If you call `mount()` twice on the same element, the SDK removes the previous banner and shows a new banner. Calling the `unmount()` returned by the first `mount()` after that does nothing, and the new banner stays.
- Return value: Returns `{ unmount() }`. Use it to remove only this banner ([`unmount()`: Remove a banner](./shopify-headless-reference-unmount.html)).
- Checkout+ product lines: Like `refresh()`, it changes lines only on the first fetch after `init()`, when it removes a Checkout+ product left over from the previous screen. If it is called while `prepareCheckout()` is running, or after `prepareCheckout()` has added the Checkout+ product, the added line is not removed ([`refresh`: Call it any time, any number of times](./shopify-headless-reference-refresh.html#call-it-any-time-any-number-of-times)).

The SDK renders the banner and the details dialog. You can change the text and images with `displaySettings` in `init` ([`displaySettings`: Text and details dialog](./shopify-headless-reference-init.html#displaysettings-text-and-details-dialog)), and the look with your CSS (["Change the look with CSS" below](#change-the-look-with-css)). The price, and whether each badge appears, are determined by the benefit set, so your code cannot change them.

## Exceptions and failures

- Exceptions: None.
- When the cart or the benefit set cannot be fetched: It does not show the banner and reports the reason through `onError`. What happens on that page follows [What the SDK does for each trigger](./shopify-headless-behavior.html#what-the-sdk-does-for-each-trigger).
- After `destroy()`: It shows nothing and returns an `unmount()` that does nothing.

## Parts of the banner

![Diagram of the banner with each part numbered](images/checkout-plus-sdk_display-1.png)

Parts of the banner.

| No. | Part | What determines it | If omitted | CSS part name (::part) |
| --- | --- | --- | --- | --- |
| 1 | Whole banner | — | — | `banner` |
| 2 | Checkbox | The shopper's actions and [`initialSelection` in `init`](./shopify-headless-reference-init.html#initialselection-initial-state-of-the-checkbox) | Unchecked | `checkbox` |
| 3 | Title | [`displaySettings.title`](./shopify-headless-reference-init.html#displaysettings-text-and-details-dialog) | 「あんしんプラス」 (Anshin Plus) | `title` |
| 4 | by Recustomer | Fixed | — | — |
| 5 | Price | The benefit set | — | `price`, `commitment-charge` |
| 6 | Description | `displaySettings.description` | Not shown | `description` |
| 7 | 「詳しく見る」 (See details) | `displaySettings.detailsButtonLabel` | 「詳しく見る」 (See details) | `details-button` |
| 8 | Badges | Text: `displaySettings.shippingBadgeLabel` and `displaySettings.cashbackBadgeLabel`. Whether each appears depends on the range's benefits | 「返品送料無料」 (Free return shipping), 「クーポンバック」 (Coupon cashback) | `badges`, `badge`, `shipping-badge`, `cashback-badge` |
| 9 | Excluded-item notice | `displaySettings.exclusionNotice` | 「※{excludedItem}は対象外商品です。」 (※{excludedItem} is not eligible.) | `exclusion-notice`, `excluded-item` |

- Pressing 「詳しく見る」 opens the details dialog.
- The 「返品送料無料」 (Free return shipping) badge appears in ranges with free return shipping. The 「クーポンバック」 (Coupon cashback) badge appears in ranges with an estimated coupon cashback amount.
- The excluded-item notice appears only when the cart contains excluded products. You can change how the product names in the notice are written with `displaySettings.excludedItemFormat` and `displaySettings.excludedItemSeparator`.
- You can insert the estimated coupon cashback amount in the description ([`displaySettings`: Text and details dialog](./shopify-headless-reference-init.html#displaysettings-text-and-details-dialog)).
- Among the CSS part names, `commitment-charge` is the commitment charge shown with a strikethrough before the price, `badges` is the row of badges, `badge` is each badge, `shipping-badge` and `cashback-badge` are the 「返品送料無料」 and 「クーポンバック」 badges, and `excluded-item` is the product name in the notice.
- The default text and the default accessible names are in Japanese regardless of `locale`. To show another language, specify them with `displaySettings`. "by Recustomer" and "Powered by Recustomer" are fixed and cannot be changed.

## Parts of the details dialog

Opens when the shopper presses 「詳しく見る」 on the banner. It is shown overlaid at the center of the screen. Even when the banner is placed inside a cart drawer, the dialog can extend beyond the drawer.

![Diagram of the details dialog with each part numbered](images/checkout-plus-sdk_display-2.png)

Parts of the details dialog.

| No. | Part | What determines it | If omitted | CSS part name (::part) |
| --- | --- | --- | --- | --- |
| 1 | Details dialog | — | — | `details-modal` |
| 2 | Close | Fixed | — | `close-button` |
| 3 | Top image | `displaySettings.detailsModal.heroImageUrl` | Not shown | `hero-image` |
| 4 | Logo | `displaySettings.detailsModal.logoImageUrl` | Not shown | `logo-image` |
| 5 | Body | `displaySettings.detailsModal.html` | Recustomer's default text | `details-modal-html` |
| 6 | Powered by Recustomer | Fixed | — | — |

Accessible names and the alternative text of the logo.

| Target | Field to change | Default |
| --- | --- | --- |
| Accessible name of the details dialog | `displaySettings.detailsModal.ariaLabel` | `{title}の詳細` ({title} details) |
| Accessible name of the close button | `displaySettings.detailsModal.closeButtonAriaLabel` | `閉じる` (Close) |
| Alternative text of the logo | `displaySettings.detailsModal.logoImageAlt` | `ストアロゴ` (Store logo) |
| Accessible name of the "Powered by Recustomer" link | `displaySettings.detailsModal.poweredByLinkAriaLabel` | `Recustomer（別タブで開く）` (Recustomer, opens in a new tab) |

## Display in each situation

![A banner with an empty checkbox. The price is ¥550, with the badges for free return shipping and coupon cashback](images/checkout-plus-sdk_display-3.png)

**① The box is not checked**
The state when the cart is opened. For stores that set `initialSelection` to `true`, it looks like ②

![A banner with a checked checkbox. The price is ¥550, and the border is darker](images/checkout-plus-sdk_display-4.png)

**② The box is checked**
The shopper has checked the box. The Checkout+ product is added to the cart inside `prepareCheckout()`, which you call from the checkout button

![A banner showing the commitment charge ¥600 with a strikethrough before the price of ¥550](images/checkout-plus-sdk_display-5.png)

**③ A range where the merchant covers part of the commitment charge**
For ranges where the merchant-borne amount is set in the benefit set, the commitment charge is shown with a strikethrough before the price. In ranges where the merchant covers all of it, the price is shown as ¥0. In these ranges too, the initial state of the checkbox follows `initialSelection`

## Change the look with CSS

The banner is rendered inside a Shadow DOM, so regular CSS rules that use class names and the like do not apply. Use the following two methods.

### CSS variables

| CSS variable | Default | What it changes |
| --- | --- | --- |
| `--checkout-plus-text` | `#222` | Text color |
| `--checkout-plus-muted-text` | `#555` | Color of lighter text, such as the description |
| `--checkout-plus-notice-color` | `#b42318` | Color of the excluded-item notice |
| `--checkout-plus-accent` | `#111` | Color of the checkbox and of the border when the box is checked |
| `--checkout-plus-background` | `#fff` | Banner background |
| `--checkout-plus-selected-background` | `#fafafa` | Banner background when the box is checked |
| `--checkout-plus-border` | `#e5e5e5` | Border color |
| `--checkout-plus-radius` | `14px` | Banner corner radius |
| `--checkout-plus-details-modal-radius` | `20px` | Details dialog corner radius |
| `--checkout-plus-font-family` | `-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif` | Font |

### Styling individual parts (::part)

Use the CSS part names from the "Parts of the banner" and "Parts of the details dialog" tables above, in the form `rcmr-checkout-plus::part(name)`.

```css
/* Change colors, corners, and font with CSS variables */
rcmr-checkout-plus {
  --checkout-plus-accent: #0b6e4f;
  --checkout-plus-border: #b7e4c7;
  --checkout-plus-selected-background: #f0faf4;
  --checkout-plus-radius: 4px;
  --checkout-plus-text: #1b4332;
}
/* Change individual parts with ::part() */
rcmr-checkout-plus::part(title) { font-weight: 700; letter-spacing: 0.04em; }
rcmr-checkout-plus::part(details-button) { text-decoration: underline; }
rcmr-checkout-plus::part(badge) { border-radius: 2px; }
```

![Example of the banner with its look changed by CSS](images/checkout-plus-sdk_display-6.png)

The result of applying the CSS above.
