A product information tabs section for Shopify. It puts the product description, details, shipping and returns, and care instructions under one row of tabs below the product, and turns into an accordion on phones. Use it to keep long product pages short and easy to scan. Copy section.liquid into your theme's sections folder and add it from the theme editor as "WDS Product tabs".
How it works
Each tab is a block. The Product description block shows the product's own description and is skipped for products that have none. A Text or page block shows rich text, or the content of a page you pick, so one shipping and returns page can serve every product and stays up to date in one place.
On screens 750 px and wider, the tabs sit in a row with a thin divider, and an accent underline marks the active tab. On smaller screens the same content becomes an accordion: each item has its own heading button, and the first one can start open. When the screen size changes, the shopper stays on the same content.
In the theme editor, selecting a block opens its tab, so you see the content you are editing.
Customization
All of these are in the theme editor:
- Heading: optional heading above the tabs.
- Tabs name (screen readers): names the tab list.
- Tab alignment: left or center.
- Content width and Open the first item on mobile.
- Tab title on each block, plus Text and Page on Text or page blocks.
- Background, Text and Accent colors: the accent colors the active underline, the accordion icons, links and focus outlines.
- Side padding, Top padding and Bottom padding.
Accessibility
The tabs follow the ARIA tabs pattern: role="tablist", tab and tabpanel, with aria-selected and aria-controls. Arrow Left and Arrow Right move between tabs and show them, and Home and End jump to the first and last tab. Only the active tab is in the Tab order, and the panel itself can be focused. On mobile each accordion button sits in a heading and uses aria-expanded, and panels become labelled regions. Focus outlines are visible, and animations are turned off for people who prefer reduced motion.
Usage notes
This section requires an Online Store 2.0 theme. Fonts come from your theme. Add it to your product template below the product information. If your theme already shows the description in the product column, leave out the Product description block to avoid showing it twice.
The preview uses sample text for an invented product and no photos. Outside a product page, for example on the home page, the Description tab shows sample text. Tab content is plain HTML from Shopify, so very wide tables inside a description may need their own styling.