Skip to main content

How to Customize the Tabbed Recommendations Widget with CSS

Style the Tabbed Recommendations Widget with CSS: where to add it, its class names and variables, and recipes for tabs, badges, and images.

Written by Tom

Use this guide to style the Tabbed Recommendations Widget, also called the Tabbed Widget, with custom CSS (Cascading Style Sheets). It covers where to add CSS for the Tabbed Recommendations Widget, the class names and CSS variables the widget renders, and copy-paste recipes for the tab row, the active tab, pill tabs, the savings badge, product images, and styling a single tab. Every recipe is scoped to one widget with its widget ID, so your CSS changes only the Tabbed Recommendations Widget you add it to.

Settings to check before writing Tabbed Recommendations Widget CSS

Many Tabbed Recommendations Widget style changes are available as settings in the widget editor, and a setting is easier to maintain than custom CSS. The table below lists common changes, the setting that makes each one, and where that setting sits.

Change you want

Setting that makes it

Where the setting is

Widget background and border colors

Theme set to Custom, then Background Color and Border Color in the Styles group

Display in the Tabbed Recommendations Widget editor

Button colors, border width, and corner radius

Theme set to Custom, then Button Background, Button Border Color, Button Text, Button Border Width, and Button Radius in the Styles group

Display in the Tabbed Recommendations Widget editor

Title, price, and product text colors

Theme set to Custom, then color settings in the Styles group such as Supertitle, Title, Description, Product Title, Price, Sale Price, and Compare Price

Display in the Tabbed Recommendations Widget editor

Carousel arrow and paging dot colors

Theme set to Custom, then Carousel Control Background, Carousel Control Text, and Carousel Paging Dots in the Styles group

Display in the Tabbed Recommendations Widget editor

Basic tabs or pill-shaped tabs

Tab Display Style

Tabs panel in the Tabbed Recommendations Widget editor

Tab row on the left, center, or right

Alignment

Tabs panel in the Tabbed Recommendations Widget editor

Products per row, carousel or static grid

Product Display Settings

Each tab's own settings

Image shape, rounded image corners, second image on hover

Image Ratio, Image Border Radius, Show Second Image on Hover

Product Images section of Product Settings

Turning the percent-off badge on or off

Show Savings Badge

Product Options section of Product Settings

The Theme menu in the Tabbed Recommendations Widget's Display settings lists your store's Rebuy Theme by name, along with Custom. With your Rebuy Theme selected, the widget uses the styling set in Settings > Themes in your Rebuy admin, which the widgets on that theme share. Selecting Custom shows the Styles group beneath the CSS box, and its color and button settings apply to this Tabbed Recommendations Widget only.

Tabbed Recommendations Widget settings to check before CSS, the Display settings with Theme set to Custom and the Styles group showing Background Color, Button Background, Button Radius, Carousel Control Background, Sale Price, and Title

Reach for CSS when the change you want is not covered by a setting, such as spacing, font size, the active tab's underline color, letting tabs wrap on mobile, or styling one tab differently from the others.


Where to add CSS for the Tabbed Recommendations Widget

You add CSS for a Tabbed Recommendations Widget in the CSS box in the widget editor's Display settings. Follow these steps:

  1. In your Rebuy admin, go to Cart & Merchandising > Widgets and click your Tabbed Recommendations Widget.

  2. In the widget editor's Configuration list, click Display.

  3. Paste your CSS into the CSS box.

  4. Click Save, then refresh your storefront page to see the change.

How to Customize the Tabbed Recommendations Widget with CSS, the Display settings in the widget editor with CSS scoped to rebuy-widget-311934 in the CSS box

CSS in the Tabbed Recommendations Widget's CSS box loads on every page where the widget renders and applies to that whole page, not only to the widget. Start every selector with #rebuy-widget- followed by your widget ID, such as #rebuy-widget-12345, so your styling reaches only this Tabbed Recommendations Widget. Replace 12345 with your own widget ID in every recipe in this guide, or the CSS will not apply to anything.

Find your Tabbed Recommendations Widget's ID

Your Tabbed Recommendations Widget's ID appears in the top bar of the widget editor after WIDGET ID:, with a copy icon beside it. The ID also appears in the ID column of the Widgets list in your Rebuy admin.

Once you have the ID, it goes straight into the selector after #rebuy-widget-. For example, a Tabbed Recommendations Widget with the ID 311934 scopes its CSS like this:

/* Tabbed Widget title size for widget 311934 only */
#rebuy-widget-311934 .primary-title {
font-size: 24px;
}


Preview Tabbed Recommendations Widget CSS before shoppers see it

Check Tabbed Recommendations Widget CSS on your storefront rather than in the widget editor's preview. The editor preview does not load your Shopify theme's CSS, and on the real page your theme's styling can override yours. Widget CSS has no draft state, so CSS saved to a live widget appears to shoppers as soon as you click Save. To test without shoppers seeing your changes, use one of these methods:

  • For a Tabbed Recommendations Widget you have not launched yet, toggle Live Mode off in the widget editor, then click PREVIEW in the top bar to view the widget in Rebuy preview mode. The widget must already be installed in your theme to appear.

  • For a Tabbed Recommendations Widget that is already live, test on a duplicate of your Shopify theme with the widget installed, since turning Live Mode off removes the widget from your storefront for shoppers.

For the full steps, see Using Rebuy preview mode.


Tabbed Recommendations Widget class names

The Tabbed Recommendations Widget's standard template renders the class names in the tables below, grouped by area of the widget. The tables list the classes you are most likely to target, not every class in the widget, so use your browser's Inspect tool to find any element that is not listed. Scope every class to #rebuy-widget-12345 when you use it.

Widget and heading classes

The following table lists the Tabbed Recommendations Widget's root and heading classes and the element each one targets.

Element

Class

Every Tabbed Recommendations Widget

.rebuy-tabbed-widget (the same element also carries .rebuy-widget and .widget-type-tabbed-widget)

One specific Tabbed Recommendations Widget

#rebuy-widget-12345

Super title (small heading above the title)

.super-title

Title

.primary-title

Description

.description

The Tabbed Recommendations Widget's super title renders as an h3 element and its title as an h4 element, so heading styles from your Shopify theme can reach them. Scoping your CSS to the widget ID makes it specific enough to win against those theme styles.

This example uses the Tabbed Recommendations Widget's heading classes to restyle the super title, title, and description in one widget:

/* Tabbed Widget super title */
#rebuy-widget-12345 .super-title {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.1em;
}

/* Tabbed Widget title */
#rebuy-widget-12345 .primary-title {
font-size: 24px;
font-weight: 700;
margin-bottom: 8px;
}

/* Tabbed Widget description */
#rebuy-widget-12345 .description {
font-size: 14px;
margin-bottom: 16px;
}

Tab row classes

The following table lists the classes on the Tabbed Recommendations Widget's tab row and on each tab.

Element

Class

Tab row

.rebuy-tabbed-widget__tabs

Each tab

.rebuy-tabbed-widget__tab

The active tab

.rebuy-tabbed-widget__tab[aria-selected="true"] (the active tab also carries .active)

One tab by its position

#rebuy-tabbed-widget-12345-tab-0, #rebuy-tabbed-widget-12345-tab-1, and so on

Tab name

.rebuy-tabbed-widget__tab-title

Tab description

.rebuy-tabbed-widget__tab-description

Panel holding the active tab's products

.rebuy-tabbed-widget__panel

The number at the end of a Tabbed Recommendations Widget tab's ID is that tab's position in the Tabs panel, counting from 0 for the first tab. The number follows the position rather than the tab, so reordering tabs moves any position-based CSS to whichever tab now holds that position. A tab that is hidden because its data source returned no products keeps its number, so the tabs after it are not renumbered.

This example uses the Tabbed Recommendations Widget's tab row classes to draw a divider line under the tab row, give the active tab a colored underline, and lighten the tab descriptions in one widget:

/* Tabbed Widget divider line under the tab row */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs {
border-bottom: 1px solid #e3e3e3;
}

/* Tabbed Widget active tab underline */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab[aria-selected="true"] {
border-bottom-color: #e4572e;
}

/* Tabbed Widget tab descriptions */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab-description {
color: #888888;
}

Product card classes

The following table lists the classes on the product cards inside each Tabbed Recommendations Widget tab.

Element

Class

One tab's product grid

.rebuy-product-grid plus .rebuy-product-grid__tab-0, .rebuy-product-grid__tab-1, and so on

Product card

.rebuy-product-block

Image area

.rebuy-product-media

Product image link

.rebuy-product-image

Savings badge

.rebuy-tabbed-widget__badge (the badge also carries .rebuy-money and .sale)

Second image shown on hover

.rebuy-tabbed-widget__hover-image

Product title and its link

.rebuy-product-title, .rebuy-product-title-link

Regular price

.rebuy-money

Sale price

.rebuy-money.sale

Compare-at (crossed-out) price

.rebuy-money.compare-at

Vendor

.rebuy-product-vendor

Variant selector

.rebuy-product-options (dropdown .rebuy-select)

Button area

.rebuy-product-actions

Add to Cart button

.rebuy-button

Quick View button

.product-quick-view-button

Carousel arrows

.splide__arrow (.splide__arrow--prev, .splide__arrow--next)

Loading placeholder card

.rebuy-tabbed-widget__product-skeleton

The Tabbed Recommendations Widget's savings badge carries the .rebuy-money and .sale classes as well as .rebuy-tabbed-widget__badge, so CSS you write for .rebuy-money.sale sale prices also reaches the badge. To keep the badge out of a sale price selector, add :not(.rebuy-tabbed-widget__badge), as in #rebuy-widget-12345 .rebuy-money.sale:not(.rebuy-tabbed-widget__badge).

This example uses the Tabbed Recommendations Widget's product card classes to outline each product card, bold the product titles, and bold the sale price while leaving the savings badge unchanged:

/* Tabbed Widget product cards */
#rebuy-widget-12345 .rebuy-product-block {
border: 1px solid #eeeeee;
border-radius: 8px;
padding: 12px;
}

/* Tabbed Widget product titles */
#rebuy-widget-12345 .rebuy-product-title-link {
font-weight: 600;
text-decoration: none;
}

/* Tabbed Widget sale price, without the savings badge */
#rebuy-widget-12345 .rebuy-money.sale:not(.rebuy-tabbed-widget__badge) {
font-weight: 700;
}

Classes that match your Tabbed Recommendations Widget settings

Some Tabbed Recommendations Widget settings add a modifier class to the widget, which lets you write CSS for one style only. The admin label and the class name do not always match, so the following table lists each setting choice, the class it adds, and the element that carries the class.

Setting

Choice

Class it adds

Element that carries it

Tab Display Style

Basic Tabs

No .rebuy-tabbed-widget__tabs--pills class. Basic Tabs styling is the tab row's default look.

Tab row

Tab Display Style

Pills

.rebuy-tabbed-widget__tabs--pills

Tab row

Alignment

Left

.rebuy-tabbed-widget__tabs--align-left

Tab row

Alignment

Center

.rebuy-tabbed-widget__tabs--align-center

Tab row

Alignment

Right

.rebuy-tabbed-widget__tabs--align-right

Tab row

Image Ratio

1:1

.rebuy-tabbed-widget--ratio-1-1

Widget root

Image Ratio

3:4

.rebuy-tabbed-widget--ratio-3-4

Widget root

Image Ratio

9:16

.rebuy-tabbed-widget--ratio-9-16

Widget root

This example uses the Tabbed Recommendations Widget's setting classes so that each block of CSS applies only while that setting is chosen. The image ratio class sits on the widget root itself, so it attaches to the widget ID with no space between them.

/* Tabbed Widget applies only when Tab Display Style is Pills */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs--pills .rebuy-tabbed-widget__tab {
background: #f5f5f5;
}

/* Tabbed Widget applies only when Alignment is Center */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs--align-center {
margin-bottom: 24px;
}

/* Tabbed Widget applies only when Image Ratio is 9:16 */
#rebuy-widget-12345.rebuy-tabbed-widget--ratio-9-16 .rebuy-product-title {
font-size: 13px;
}


Tabbed Recommendations Widget CSS variables

The Tabbed Recommendations Widget uses CSS variables (custom properties) for the product image ratio and the savings badge colors. Setting a variable on #rebuy-widget-12345 changes every element in that widget that uses it, which takes less CSS than targeting each element. The following table lists each variable, what it controls, and its default value.

CSS variable

What it controls

Default value

--rebuy-tabbed-widget-image-ratio

Shape of product images and loading placeholders

1 / 1, changed by the Image Ratio setting

--rebuy-tabbed-widget-badge-background

Savings badge background

currentcolor, which is the sale price color

--rebuy-tabbed-widget-badge-color

Savings badge text

#fff (white)

The Tabbed Recommendations Widget's savings badge background defaults to currentcolor, meaning the badge's own text color. The badge carries the .rebuy-money.sale classes, so its background matches the widget's sale price color. That color is the Sale Price setting in the Styles group when Theme is set to Custom, and the sale price color of your Rebuy Theme otherwise. Changing the sale price color, with that setting or with CSS, changes the badge background too, unless you set --rebuy-tabbed-widget-badge-background.


Common Tabbed Recommendations Widget CSS customizations

Each recipe below is scoped to one Tabbed Recommendations Widget. Paste the CSS into the CSS box in the widget's Display settings, replace 12345 with your widget ID, and adjust the values to match your brand.

Change the active tab's color and underline

The Basic Tabs style of the Tabbed Recommendations Widget marks the active tab with bold text and a 2px underline drawn in the tab's text color. Tabs take their text color from the text around the widget, so setting color on the active tab changes its text and underline together, and border-bottom-color sets the underline on its own.

/* Tabbed Widget active tab text and underline color */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab[aria-selected="true"] {
color: #1a1a1a;
border-bottom-color: #e4572e;
}

/* Tabbed Widget inactive tab text color */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab[aria-selected="false"] {
color: #777777;
}

/* Tabbed Widget tab hover color */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab:hover {
color: #1a1a1a;
}

This recipe is for the Basic Tabs style. When Tab Display Style is set to Pills, use the recipe under Style pill-shaped tabs instead.

Style pill-shaped tabs

The Pills style of the Tabbed Recommendations Widget draws each tab as a rounded pill with a 1px light gray border (#eee), and the active pill's border takes the tab's text color. The recipe below sets the border on inactive pills, fills the active pill with a solid color, and softens the fully rounded corners.

/* Tabbed Widget inactive pill tabs */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs--pills .rebuy-tabbed-widget__tab {
border-color: #dddddd;
border-radius: 6px;
background: #ffffff;
}

/* Tabbed Widget active pill tab */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs--pills .rebuy-tabbed-widget__tab[aria-selected="true"] {
border-color: #1a1a1a;
background: #1a1a1a;
color: #ffffff;
}

This recipe applies only while the Tabbed Recommendations Widget's Tab Display Style is set to Pills, because every selector in it starts from the .rebuy-tabbed-widget__tabs--pills class.

Change the tab name and description text

Tab names in a Tabbed Recommendations Widget display at 14px on a 20px line height, and tab descriptions display at 12px and 75% opacity beneath the name. The active tab's name is bold (font weight 600). The recipe below changes the size, case, and color of each.

/* Tabbed Widget tab name text */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab-title {
font-size: 16px;
line-height: 22px;
text-transform: uppercase;
letter-spacing: 0.05em;
}

/* Tabbed Widget active tab name weight */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab[aria-selected="true"] {
font-weight: 700;
}

/* Tabbed Widget tab description text */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab-description {
font-size: 13px;
opacity: 1;
color: #666666;
}

Let tabs wrap instead of scrolling sideways

The Tabbed Recommendations Widget keeps every tab on a single row. When the tabs are wider than the screen, the row scrolls sideways with its scrollbar hidden, which shoppers on mobile can miss. The recipe below lets the tabs wrap onto additional lines instead, while each tab's own name stays on one line.

/* Tabbed Widget wrap tabs onto additional lines */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs {
flex-wrap: wrap;
overflow-x: visible;
}

Change the spacing around the tabs

The Tabbed Recommendations Widget places 8px between tabs, 15px between the tab row and the products, and 8px of top and bottom padding with 12px of side padding inside each tab. The widget itself has 30px of padding above and below it. The recipe below adjusts each of these.

/* Tabbed Widget gap between tabs and space below the tab row */
#rebuy-widget-12345 .rebuy-tabbed-widget__tabs {
gap: 16px;
margin-bottom: 24px;
}

/* Tabbed Widget padding inside each tab */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab {
padding: 10px 18px;
}

/* Tabbed Widget space above and below the whole widget */
#rebuy-widget-12345 {
padding: 10px 0;
}

Center the widget title and description

The Alignment setting in the Tabbed Recommendations Widget's Tabs panel moves only the tab row, and Rebuy's built-in styling keeps this widget's super title, title, and description left-aligned. To center the Tabbed Recommendations Widget's heading text as well, add this CSS:

/* Tabbed Widget center the super title, title, and description */
#rebuy-widget-12345 .super-title,
#rebuy-widget-12345 .primary-title,
#rebuy-widget-12345 .description {
text-align: center;
}

Change the savings badge colors and position

The savings badge on a Tabbed Recommendations Widget product card sits 8px from the top left corner of the product image, as a rounded label with white text on your sale price color. The recipe below sets the badge colors with its CSS variables, moves the badge to the top right corner, and gives it square corners.

/* Tabbed Widget savings badge colors */
#rebuy-widget-12345 {
--rebuy-tabbed-widget-badge-background: #1a1a1a;
--rebuy-tabbed-widget-badge-color: #ffffff;
}

/* Tabbed Widget savings badge position and shape */
#rebuy-widget-12345 .rebuy-tabbed-widget__badge {
left: auto;
right: 8px;
border-radius: 4px;
}

To remove the savings badge from a Tabbed Recommendations Widget entirely, turn off Show Savings Badge in the Product Options section of Product Settings rather than hiding the badge with CSS.

Use a custom image ratio or stop images from cropping

The Image Ratio setting in a Tabbed Recommendations Widget offers 1:1, 3:4, and 9:16, and product images fill that shape by cropping to fit. To use a ratio the setting does not offer, set the --rebuy-tabbed-widget-image-ratio variable, which overrides the Image Ratio setting for that widget.

/* Tabbed Widget custom product image ratio */
#rebuy-widget-12345 {
--rebuy-tabbed-widget-image-ratio: 4 / 5;
}

To show each whole product image in a Tabbed Recommendations Widget without cropping, change object-fit to contain. Images that do not match the ratio then show empty space around them, filled with the background color you set.

/* Tabbed Widget show whole product images without cropping */
#rebuy-widget-12345 .rebuy-product-media img {
object-fit: contain;
background: #ffffff;
}

Style one tab differently from the others

Every tab in a Tabbed Recommendations Widget shares the widget's styling, but CSS can target a single tab by its position. Use #rebuy-tabbed-widget-12345-tab-1 for the tab button and .rebuy-product-grid__tab-1 for that tab's products, where 1 is the tab's position counting from 0 for the first tab. The tab button's ID contains your widget ID, so replace 12345 there as well. The recipe below colors the second tab's name red and gives that tab's product cards a tinted background.

/* Tabbed Widget second tab name color */
#rebuy-tabbed-widget-12345-tab-1 {
color: #c0392b;
}

/* Tabbed Widget second tab product cards */
#rebuy-widget-12345 .rebuy-product-grid__tab-1 .rebuy-product-block {
background: #fdf3e7;
border-radius: 8px;
padding: 10px;
}

Reordering tabs in the Tabbed Recommendations Widget's Tabs panel changes their positions, so update the number in this CSS whenever you move a tab.

Style the Add to Cart and Quick View buttons

Add to Cart and Quick View buttons on Tabbed Recommendations Widget product cards stretch to the full width of the card. Button colors, border width, and corner radius come from your Rebuy Theme, or from the Styles group of the widget's Display settings when Theme is set to Custom, under Button Background, Button Border Color, Button Text, Button Border Width, and Button Radius. Use CSS for what those settings do not cover, such as spacing and text style. The recipe below adds space between the Quick View and Add to Cart buttons and changes the button text style.

/* Tabbed Widget space below the Quick View button */
#rebuy-widget-12345 .product-quick-view-button {
margin-bottom: 8px;
}

/* Tabbed Widget button text style */
#rebuy-widget-12345 .rebuy-product-actions .rebuy-button {
text-transform: uppercase;
letter-spacing: 0.05em;
}

Change the keyboard focus outline on tabs

Rebuy draws a 2px blue outline (#2491c4) around a Tabbed Recommendations Widget tab when a shopper reaches it with the keyboard. The recipe below changes that outline's color. Keep a visible outline when you restyle it, so shoppers who navigate by keyboard can still see which tab is focused.

/* Tabbed Widget keyboard focus outline on tabs */
#rebuy-widget-12345 .rebuy-tabbed-widget__tab:focus-visible {
outline-color: #1a1a1a;
}

Make a mobile-only adjustment

To change a Tabbed Recommendations Widget on small screens only, wrap your CSS in a media query. The recipe below shrinks the tab names and the padding inside each tab at screen widths of 767px and below.

/* Tabbed Widget smaller tabs on mobile */
@media (max-width: 767px) {
#rebuy-widget-12345 .rebuy-tabbed-widget__tab-title {
font-size: 13px;
}

#rebuy-widget-12345 .rebuy-tabbed-widget__tab {
padding: 6px 10px;
}
}


Troubleshooting Tabbed Recommendations Widget CSS

When CSS in a Tabbed Recommendations Widget's CSS box does not apply on your storefront, work through these checks in order:

  1. Confirm you replaced 12345 with your widget ID in every selector, including inside #rebuy-tabbed-widget-12345-tab-1.

  2. Confirm you are checking your storefront rather than the widget editor's preview.

  3. Right-click the element, choose Inspect, and confirm its class matches your selector. A style shown with a line through it in the Styles panel is being overridden by a more specific selector.

  4. Add !important before the semicolon if your Shopify theme's styling is winning over yours.

  5. Clear your browser cache and refresh, or open the page in a private browsing window.

The class names in this guide come from Rebuy's standard Tabbed Recommendations Widget template. If your store uses a custom template for the Tabbed Recommendations Widget, that template's own markup decides the class names, so confirm each one with Inspect before relying on it.

Custom styling beyond this guide

Rebuy support does not write, debug, or troubleshoot custom CSS for the Tabbed Recommendations Widget, because custom code falls outside the standard Rebuy package. For changes that go past the recipes in this guide, share Rebuy's AI Integration Guide and the Tabbed Widget custom template reference with your developer or AI coding tool.

For hands-on custom work, the Rebuy Partner Directory lists agencies that build Rebuy customizations. See Rebuy's support policy for what support covers.


Related articles

Did this answer your question?