Skip to content

New Block: Slider Container (CSS based) #43369

Open

Description

@mtias

Exploration. Related #25501 #25502.

These types of blocks are a very common request that we have stayed out of tackling in core for multiple reasons — primarily the reliance on JavaScript on the front-end for most implementations. The reality now, however, is that the CSS spec has added great new native tools with good browser support to try to accomplish some of these displays without relying on JS, employing properties like scroll-snap-type and scroll-snap-align.

Combined with inner blocks and layout container, including viewport units, it could easily accommodate full screen display options:

It might be a good time to explore how we might build a container or add these container behaviours to flex groups. Would be good to work as a generic container that could be leveraged for galleries, custom inner blocks, post lists templates, etc.

Activity

  1. added
    New Block
    Needs Design
    on Aug 18, 2022
  2. costdev commented on Oct 21, 2022

    @costdev
    Contributor

    For browser support, see below. TL;DR - Supported by all major browsers.
    scroll-snap-type
    scroll-snap-align
    scroll-behavior

    CSS-only sliders are mostly fine. Selectors are typically links with href="#slide-$", and scroll-behavior: smooth on the slide container. There can be some jankiness with selectors when slides aren't full width in the slider, like in this issue's first example image. This could be improved with Javascript, and degradation is somewhat reasonable when Javascript is disabled.

    For the most part, we'd likely need:

    • .slide-container An outer container to hold everything.
      • .slide-selectors A container for slide selectors.
      • .slides A container for slides, which may be various blocks (or posts in a Query Loop block).
        • .slide A container for slide content.

    Here's a basic example of the above structure: https://codepen.io/costdev/pen/abGeLNp?editors=1100
    Note the comments in the HTML and CSS editors.
    (P.S. I suggest changing the view so the editors are on the left or right, rather than the default top-bottom layout)

  3. strarsis commented on Nov 14, 2022

    @strarsis
    Contributor

    Warming this discussion up again:
    #6608

  4. masteradhoc commented on Feb 5, 2023

    @masteradhoc
    Contributor

    @mtias / @costdev any update on this block? Are there any plans to work on this soon?

  5. altivero commented on Feb 23, 2023

    @altivero

    Looking at the example from @costdev
    I found another example that also includes previous and next navigation:
    https://codepen.io/alvarotrigo/pen/bGqgqeK

    With all the advancement in the block editor I would love to see a structure with innerblocks that the can be completely customized through the editor:

    • .slide-container An outer container to hold everything.
      • .slide-controls A container for slide controls which could be inner blocks like a variation of buttons that can be customized with styles.
      • .slide-foreground A container for a fixed foreground, which may be various blocks, text, nav etc.
      • .slides A container for slides, which may be various blocks (or posts in a Query Loop block).
        • .slide A container for slide content which may be various blocks.
      • .slide-background A container for a fixed background, which may be various blocks.

    The background and foreground containers could be added optionally but would create a way to add fixed elements to the foreground or background (if the slides have transparency or are just text). Things like a logo, text, header, footer, navigation, anything really.

  6. added
    [Type] Enhancement
    on Sep 1, 2023
  7. TheRamSan commented on Jan 30, 2024

    @TheRamSan

    Hi
    I hope this message finds you well. Any news regarding this issue?

    I frequently encounter the need for an automatic carousel functionality that seamlessly transitions between text or image items without requiring user input. While I appreciate the availability of plugins that offer such features, I believe integrating this functionality directly into the WordPress core would significantly enhance the user experience for several reasons:

    Compatibility Concerns: External plugins, while useful, often introduce compatibility issues with future WordPress updates. As the WordPress ecosystem evolves, maintaining compatibility with numerous plugins becomes increasingly challenging. By incorporating a native Slider Container block, users can rest assured that their carousel functionality will remain intact across WordPress updates.

    Reliability and Support: Third-party plugins may lack adequate support or become obsolete over time. When a plugin developer ceases updates or support, users are left vulnerable to security risks and functionality gaps. With a native Slider Container block, WordPress users can rely on the platform's robust support and maintenance infrastructure for long-term viability.

    Performance Optimization: External plugins can contribute to bloated codebases and slow website performance. By integrating essential features directly into the WordPress core, users benefit from optimized performance and streamlined code execution, resulting in faster load times and improved overall website responsiveness.

    User Accessibility: Simplifying the website development process by providing essential features within the WordPress editor promotes accessibility for users of all skill levels. A native Slider Container block empowers users to create dynamic, engaging content without the need for extensive technical knowledge or reliance on external resources.

    In light of these considerations, I believe the addition of a Slider Container block aligns with WordPress's commitment to user-centric design and continuous improvement. By empowering users to create visually stunning carousels without the need for external plugins, WordPress reinforces its position as a leading platform for website development and content management.

    Thank you for your dedication to advancing the WordPress platform.

    Warm regards,
    Ram

  8. solaceten commented on May 10, 2024

    @solaceten

    I would like to jump in and add my twopenneth worth. As a WordPress user for almost 20 years, I have always scatched my head about why the native [gallery] does not have a) a decent options page to be able to get better config and b) a carousel or slider feature and c) simple lightbox support with nav options. Until now, I have used Slick Slider, Orbit Slider, Flex Slider, NextGen etc... and today, we have things like in-built theme sliders etc - but still occasionally I come back to the need to use the native [gallery] shortcode - and it's sad to see that it has languished for decades with little improvement. Many of the aforementioned sliders / carousels and lightbox plugins are defunct and never updated. Please consider giving us an upgraded native [gallery] experience.

  9. Bovelett commented on Nov 9, 2024

    @Bovelett

    Hey @mtias, I'm not a developer, but an accessibility mentor, and from reading this entry, I was wondering if you're implying to build a CSS only slider container?

  10. Bovelett commented on Dec 12, 2024

    @Bovelett

    I'm probably about to get myself designated as "Captain Unpopular" but as far as my knowledge goes, creating an accessible slider without JavaScript swapping out attributes for screen readers, is not possible. If I'm wrong about that, I'm more than happy if someone corrects me on this with a solid technical explanation.

    Aside from the fact that inclusion should never be optional, offering unsuspecting users of the Block editor functionality that generates inaccessible output is to be avoided at all costs. Besides the painful exclusion of a large group of site visitors, inevitably also leading to high bounce rates and lower engagement / conversion rates, it can have serious legal repercussions for site owners.

    The laws on digital accessibility are getting stricter and stricter. For example, based on the European Accessibility Act (EAA), on June 28, 2025, heavy laws regarding digital accessibility kick in all over the EU. From fines to jail time (I kid you not!) especially in the private sector.

    CC @afercia @amberhinds

  11. amberhinds commented on Dec 12, 2024

    @amberhinds

    I also don't think it's possible to build an accessible slider without JavaScript. You need to be able to shift focus when the next/previous buttons are clicked.

    Here's a checklist for slider accessibility you can reference.

  12. added
    Needs Accessibility Feedback
    on Dec 13, 2024
  13. afercia commented on Dec 13, 2024

    @afercia
    Contributor

    Thanks @Bovelett @amberhinds for the ping and your thoughts.

    There's lot of resources around about accessible sliders. Before proposing a CSS-only based one, some research would have been appreciated. Seeing such a proposal without any consideration about keyboard support and accessibility and omitting labeling this GitHub issue with any accessibility related label is, honestly, disappointing.

    The most obvious need for JavaScript for a slider is managing focus. There's more. I would recommend going through this excellent analysis (with working Codepens) by Heydon Pickering @Heydon (November, 2017) to get a sense of what's needed to make a slider usable for everyone.

  14. westonruter commented on Mar 27, 2025

    @westonruter
    Member

    Accessible CSS sliders are now available in Chrome 135: https://developer.chrome.com/blog/carousels-with-css

    This is not yet implemented in other browsers yet, however.

  15. 12 remaining items

  16. altivero commented on Jul 10, 2026

    @altivero

    For what it's worth, I think the slider is a major design element and people will want to customize the design as much as possible. So being able to modify the type, position and styles of controls etc. should be an end goal.

    Should we start simple with some fixed designs? Absolutely, but I think it is something we should think about now. And as I mentioned before the same thing is happening with the mobile overlay menu. So we do already have the concept of overlay controls there that can be modified as a template in the future.

    In fact we could think of the slider as a gallery of cover blocks with a permanent overlay menu of various control buttons. That may not be helpful to you at all, but I am just pointing out that all of the concepts do already exist.

  17. carolinan commented on Jul 10, 2026

    @carolinan
    Contributor

    I don't think we should use a template part like the navigation overlay uses, I think these are two very different concepts.

  18. carolinan commented on Jul 10, 2026

    @carolinan
    Contributor

    above, as overlay, or below.

    That may sound like a limitation at first, but if they should include alignment and justification options, they are still complex settings.

  19. added
    [Status] In Progress
    on Jul 22, 2026
  20. tyxla commented on Jul 23, 2026

    @tyxla
    Member

    Noting there are multiple PRs that are aiming to tackle this one:

    Would love to see all the effort in that area combined for WordPress 7.2 and beyond.

    cc @WordPress/gutenberg-design for thoughts and suggestions on what to pick from each approach.

  21. altivero commented on Jul 23, 2026

    @altivero

    Wow it's really nice to see all of these POCs! This is the one big sticking point where another plugin is always needed because of customer demand.

    I do worry if we try to flatten the structure too much it may make future updates in difficult. I think the slides container may still be helpful for certian styling and or future functionality:

    • slider
      • navigation
      • slides

    I don't mind the idea of each slide being a cover block though.

    I think the Navigation can be overlay by default, however having the ability to place / style your own buttons would be key for designers. It would be great to even have a seperate template to edit the layout. With margining it would then be possible to put navigation elements above, below or even beside the slides.

    For example even though I may use the same small angle brackets on the sides I prefer to have my button (or hit area) be at least a quarter of the slider on the left and right (overlaying the image). This makes navigating easier and more discoverable.

    Either way it would be great to release something as at least experimental to get more feedback as I am sure this will be a popular (and possibly contentious) new block.

  22. kmanijak commented on Jul 24, 2026

    @kmanijak
    Contributor

    I left a comment in my POC but let me also write it here for better visibility:

    I don't think I'll be able to focus on Slider properly in upcoming weeks/months and so don't mind if we base the block or alternative PR or if someone takes over mine. 🙌

    I also shared some feedback on @carolinan's PR and I'm happy to do more testing/reviews for next iterations!

  23. removed
    Needs Design
    on Sep 1, 2026
  24. bacoords commented on Sep 2, 2026

    @bacoords
    Contributor

    There's some existing blocks shipped in WooCommerce worth reviewing here, if you're interested:

    1. Woo adds a carousel mode to the "product collection" block, which is essentially Woo's variation on a query loop. This would be useful for post and custom post type carousels.
    2. Woo also has a product image carousel which is basically Woo's version of an image gallery block.

    So while a distinct slider/carousel block would be useful (using inner blocks or template parts) it could (maybe) be a lower lift to add slider options directly to the query loop and image gallery as new, common design options on top of existing blocks.

  25. jasmussen commented on Sep 2, 2026

    @jasmussen
    Contributor

    There's an interesting idea there, converging on slider as a property/style more than a bespoke block. Similar instincts have been shared around unifying all the group blocks into a single one, with properties (which is largely done since Stack and Row are variations), but even making Cover part of the same, since groups can have background images. The usual counter-argument is that bespoke blocks can be more discoverable.

    It doesn't have to be one or the other, and I'm not sharing an opinion either way, but it seems like weighing the technical feasibility might be a starting point. Because it's an interesting idea: add a "Slide contents" toggle to the Layout panel for any container block and have its children be slides. What are the shortcomings of this idea?

  26. bacoords commented on Sep 2, 2026

    @bacoords
    Contributor

    Thanks - my thought was just starting with existing blocks that could use a carousel display option (query loop and gallery), but I agree that carousel of custom content is a different beast. One the one hand, enabling the group to have a carousel (in the same way it has a "Grid") is nice, but it might be harder from a UX perspective?

    What are the shortcomings of this idea?
    One thing about carousels is they require additional blocks - the forward/back arrows for sure, but potentially pagination, like dots or thumbnails under/next to the carousel. So you do have to inject those blocks in that variation or when transforming (plus some extra settings in the inspector controls).

    The usual counter-argument is that bespoke blocks can be more discoverable.
    Variations are pretty solid here, in the same way that "Grid" is exposed as a block. But yes there's a balance between loading additional variations in the block inserter and losing discoverability.

  27. jasmussen commented on Sep 3, 2026

    @jasmussen
    Contributor

    One thing about carousels is they require additional blocks - the forward/back arrows for sure, but potentially pagination, like dots or thumbnails under/next to the carousel.

    This has been one of my recurring bits of feedback in the otherwise pretty good proofs of concept that have been shared so far, that I'm not personally convinced these controls need to be blocks. They could simply appear as UI: no additional complexity in having to pick the right block in order to style it, and simple positioning controls—top, bottom, outside—in the inspector of the slider block itself. It may in fact be the best user experience.

    There are benefits to bespoke blocks too, to be clear: suddenly they become available to style in theme.json and individually in global styles. But this can still be the case even if the block is not surfaced as a block of its own. Compound blocks where a particular child block is present but isn't surfaced in the canvas or the inspector. Like #81593.

  28. carolinan commented on Sep 16, 2026

    @carolinan
    Contributor

    How does the Jetpack team feel about copying / moving their slideshow block to core?
    I did not know there was one. I saw it used on .org just now.

  29. DevinWalker commented on Sep 17, 2026

    @DevinWalker
    Contributor

    @carolinan 👋 Hey, I'm managing Jetpack from the Automattic side and just wanted to pop in and say that I'm fine with it moving to core. It needs some dev work to bring it up to the latest APIs and components, but that shouldn't be too hard.

  30. cbirdsong commented on Sep 18, 2026

    @cbirdsong

    The Jetpack slideshow I'm familiar with only supports images. I'm not sure there's one that works with inner blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Needs Accessibility FeedbackNew Block[Status] In Progress[Type] Enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions