The marketing CMS where agents draft and people publish
Menu

Carousel, Accordion and Tabs

Status: approved 2026-11-20 (Kevin) as the first batch of general gaps found by comparing Spillway with large university sites, where a carousel and an accordion holding rich content sit on nearly every landing page. Built in core, in the Layout group of the blocks panel.

The three blocks hold other blocks: a slide, an item and a tab are each a slot, so a slide can be a Hero, an item can hold text, images and buttons, and a tab can hold Columns. All three render complete HTML on the server, are readable with no script at all, and are enhanced by one small script that a page carries only when it has one of them.

What each block does

Carousel

  • Slides: an array; each slide has a Name (used by the slide picker and the page builder), an optional Thumbnail (the testimonial variant's switcher) and a slot for any blocks.
  • Variant: Hero (full width, one slide at a time, controls over the slide; Height: as tall as the content or the full screen), Cards (several slides visible, the next one peeking in; Slides visible 2, 3 or 4 on wide screens, one and a peek on phones), Testimonial (one slide at a time, narrow and centered, with a thumbnail switcher under it) and Stats (several slides visible, centered, the first heading in each slide set large in the primary color).
  • Controls: Previous and Next; dots (Hero, Stats) or thumbnails (Testimonial) to pick a slide; Cards has Previous and Next only, since several slides show at once. Loop: Next on the last slide goes back to the first.
  • Autoplay is off by default. Turned on, slides advance every 5, 7 or 10 seconds, with a visible Pause slides button. It never runs when the brand's motion level is off, when the visitor's device asks for reduced motion, or when the visitor pressed the site's Reduce motion switch; it also stops while the pointer is over the carousel, while the carousel is off screen or the tab is hidden, and for good once keyboard focus enters it, until the visitor presses Play slides. A carousel with autoplay counts as motion: the page carries the motion script and the Reduce motion switch.
  • Title: a name for the carousel, shown above the slides as an h2 or used only as its accessible name.

Accordion

  • Items: an array; each item has a Title, an optional Link name (its id for deep links; empty uses the title, Visiting campus becomes #visiting-campus) and a slot for any blocks.
  • Heading level of the item titles: h2, h3 (default) or h4, so the accordion fits the page's outline.
  • Open: one item at a time or several; First item: closed or open.
  • Mark as FAQ: the item titles and the text of their content join the page's one FAQPage structured data, with the FAQ blocks' questions. Off by default.

Tabs

  • Tabs: an array; each tab has a Label, an optional Link name (as for Accordion) and a slot for any blocks.
  • Orientation: horizontal (tabs above the panel) or vertical (tabs beside the panel from 760 px).
  • Heading level of the panel headings that people without the script see.

Decisions

  1. Core blocks, not modules. They are general, every kit can use them, and the importer can land into them.
  2. Slots everywhere. Slides, items and tabs are array items with a content slot, the shape Columns already uses, so the page builder edits them inline (add, remove and reorder in the fields panel, drop blocks in the canvas), and the AI layout tools, search indexing, checks and the importer's walkers handle them with no special case.
  3. One script per page, not per block. WIDGETS_SCRIPT in @spillway-cms/blocks enhances all three. The page renderer adds it once, inline with the page's nonce, only when the layout (regions and shared blocks included) has one of them, and lists it in the headless render's scripts. It runs once per document, picks up blocks that arrive later (a Personalize island) and needs nothing from the CSP beyond the nonce.
  4. Without script every slide, item and tab is reachable. The Carousel is a row that scrolls sideways with scroll snapping, so touch, trackpads, the scroll bar and the keyboard (the row is focusable) reach every slide. The Accordion shows every item open under its heading. Tabs shows a list of links to the panels and every panel under its heading. The script then shows the controls, collapses the items, selects the first tab and wires up ARIA.
  5. Accessibility follows the WAI-ARIA Authoring Practices.
    • Carousel: a section with aria-roledescription="carousel" and a name; the controls come first in the tab order; each slide is a group with aria-roledescription="slide" and the label "n of m"; the slides' container is aria-live="polite" and off while autoplay runs; slides out of view are inert; arrow keys, Home and End move between slides when the row or the picker has focus; the picker uses a roving tab index; when the slide holding focus leaves the view, focus moves to the row. Swiping is the browser's own scrolling, so it works the same with and without the script.
    • Accordion: each title is a heading at the chosen level wrapping a button with aria-expanded and aria-controls; Up and Down, Home and End move between the buttons; closed panels are hidden="until-found" where the browser supports it, so finding text on the page opens its item.
    • Tabs: tablist (with aria-orientation), tab and tabpanel, a roving tab index, automatic activation with the arrow keys (Left and Right; Up and Down too when vertical), Home and End; the selected tab's link name goes in the address with history.replaceState.
  6. Narrow screens: horizontal tabs scroll. The tab list scrolls sideways (no wrap, no accordion), keeping one interaction model and the tab semantics; the selected tab is scrolled into the list's view. Vertical tabs sit above the panel below 760 px and scroll the same way.
  7. Deep links by hash. #<link name> opens the Accordion item or selects the Tab, on load and on hashchange, and scrolls it into view. Link names must be unique on the page; the default comes from the title.
  8. Reduced motion. Slide changes scroll smoothly unless reduced motion is asked for (device or switch), when they jump. Autoplay follows the rules above. Accordion and Tabs have no animation.
  9. The page builder shows the no-script layout: slides one under the other with "Slide 1 of 3" and their name, every item and tab open with its heading, so every slot can take blocks.
  10. Block styles. All three are styled core blocks (Brand → Styles): Accordion Lines (default) and Boxed, Tabs Underline (default) and Pills, Carousel Solid controls (default) and Outline controls. Every color comes from the brand's tokens.
  11. FAQ structured data reuses the FAQ block's path. takeFaqItems gathers Accordion items marked as FAQ beside FAQ blocks into the page's one FAQPage; the answer is the plain text of the item's blocks. A block rendered on its own (a headless front end that renders blocks itself) carries none; the headless HTML render has it in seo.jsonLd. The FAQ block stays as it is.
  12. The importer lands them. In the migration's mapping table, "Sliders and carousels" and "Accordions and tabs" are core blocks now. The converter turns a run of two or more details elements into an Accordion and an image slider (carousel, slider, swiper and the like, two or more images) into a Cards carousel of Image slides; other tab and slider markup still lands as headed sections, ready to move into the blocks.

Left for later

  • Converting an existing FAQ block into an Accordion in the page builder.
  • Dots for the Cards variant (one per scroll position rather than per slide).
  • A carousel driven by a collection (slides from entries), like the Collection block's cards.

Spillway 0.1.24

Was this page helpful?