How to update the Subscription Widget using CSS

You can apply custom CSS to the Subscription Widget using the widget editor to customize its appearance fully. Recharge injects these styles directly into the widget’s root element, allowing you to see your changes reflected immediately.

This guide explains how to use CSS to update styling for the Subscription Widget.


How it works

The Subscription Widget uses a Shadow DOM to isolate its internal styles from the rest of the page. This means you cannot style internal widget elements directly using normal CSS selectors.

Recharge exposes specific components using the part attribute, which enables styling on widget elements. These are part values, and you can target them using custom CSS in the widget editor. See Available CSS classes for a full list of part values you can use.

You can use the ::part() syntax to apply styles to these elements from the widget editor.

Example

To change the color of the Learn More link:

::part(rc-learn-more\_\_trigger) {  
  color: red;  
}

Styling elements outside the Shadow DOM

Some widget elements, like the outer container or shared DOM elements, are not inside the Shadow DOM. You can style these elements using regular CSS selectors without ::part().

Example

.rc-content-wrap {  
  padding: 16px;  
}

Edit the widget with custom CSS

You can add custom CSS directly within the widget editor:

  1. Click Cross-Sell & Upsell from the merchant portal and select Subscription widget.
  2. Click Create widget from template.
    1. Starter plan merchants can choose the Standard widget
    2. Pro and Custom plan merchants can choose the Standard widget or they can A/B test multiple widgets
  3. Click the Subscription widget node and select Customize subscription widget.
  4. Select Edit styles.
  5. Paste your CSS into the Advanced: enter custom CSS textbox.
  6. Press Done to save your changes.

👍

Tip:

Recharge hosts Custom CSS in the widget editor, ensuring you can A/B test different widget customizations for each of your A/B test paths.


Available CSS classes

Use the CSS classes below to customize the subscription widget:

Element DescriptionCSS Class (Part Value)
Benefits Listrc-benefits__list
Benefits Imagerc-benefits__image
Design Mode Bannerrc-design-mode-banner
Design Mode Banner Contentrc-design-mode-banner__content
Design Mode Banner Closerc-design-mode-banner__close
Design Mode Banner Iconrc-design-mode-banner__icon
Learn More Sectionrc-learn-more
Learn More Triggerrc-learn-more__trigger
Learn More Trigger (Compact)rc-learn-more__trigger-compact
Learn More Modalrc-learn-more-modal
Learn More Modal Contentrc-learn-more-modal__content
Learn More Modal Close Buttonrc-learn-more-modal__close-button
Learn More Modal Content Bodyrc-learn-more-modal__content-body
Learn More Modal Containerrc-learn-more-modal__container
Loading Wrapperrc-loading
Loading Iconrc-loading__icon
Drawbacks Sectionrc-drawbacks
Plans Buttonrc-plans-button
Selected Plan Buttonrc-plans-button__selected
Plan Button Grouprc-plans-button-group
Plan Button Listrc-plans-button-list
Plans Labelrc-plans__label
Plans Radio Buttonrc-plans-radio-button
Plans Discount Labelrc-plans-button__discount
Plans Interval Labelrc-plans-button__interval
Plans Dropdownrc-plans-dropdown
Plans Selectrc-plans-select
One-time Sectionrc-purchase-option__onetime
Subscription Sectionrc-purchase-option__subscription
Currently Selected Sectionrc-purchase-option__selected
One-time Purchase Optionrc-purchase-option
One-time Option Labelrc-purchase-option__label
One-time Option Selectorrc-purchase-option__selector
One-time Option Inputrc-purchase-option__input
One-time Checked Indicatorrc-purchase-option__checked-indicator
One-time Pricerc-purchase-option__price
One-time Prices Wrapperrc-purchase-option__prices
One-time Sub-containerrc-purchase-option__sub-container
Subscription Purchase Optionrc-purchase-option
Subscription Option Labelrc-purchase-option__label
Subscription Option Selectorrc-purchase-option__selector
Subscription Option Inputrc-purchase-option__input
Subscription Checked Indicatorrc-purchase-option__checked-indicator
Subscription Sub-containerrc-purchase-option__sub-container
Subscription Original Pricerc-purchase-option__original-price
Subscription Unit Pricerc-purchase-option__unit-price
Subscription Prices Wrapperrc-purchase-option__prices
Subscription Discounted Pricerc-purchase-option__discounted-price
Subscription Badgerc-purchase-option__badge
Prepaid Plan Titlerc-prepaid-plan__title
Content Wrapperrc-content-wrap
Widget Rootrc-widget__root

CSS examples

Review the examples below for ideas on how you can customize the appearance of your subscription widget using CSS:

ActionCSS
Puts a border around the benefitscss<br>::part(rc-benefits__list) {<br> border: 1px solid black;<br> padding: 10px;<br>}
Makes price and selector text redcss<br>::part(rc-purchase-option__label) {<br> color: red;<br>}
Adds a border to the entire widgetcss<br>::part(rc-content-wrap) {<br> border: solid 1px blue;<br>}
Makes benefits to frequency green and borderedcss<br>::part(rc-purchase-option__sub-container) {<br> border: solid 5px green;<br>}
Makes discounted price largercss<br>::part(rc-purchase-option__discounted-price) {<br> font-size: 20px;<br>}
Re-orders strikethrough and subscription price locationcss<br>::part(rc-purchase-option__prices) {<br> display: flex;<br> flex-direction: row-reverse;<br> gap: 20px;<br>}
Change color of checkmarks in benefitscss<br>::part(rc-benefits__list) {<br> --rc-widget-bullet-icon-image-color: blue;<br>}
Reversed order of objects in Subscription boxcss<br>::part(rc-purchase-option__sub-container) {<br> display: flex;<br> flex-direction: column-reverse;<br>}
Put Subscription and Onetime side-by-sidecss<br>::part(rc-content-wrap) {<br> display: flex;<br> gap: 10px;<br>}

Need Help? Contact Us