Slick Carousel
Overview
Slick Carousel (v1.8.1) is the primary slider library for the Cynosure Design System. It is initialized via the shared js/components/default-slider.js utility for standard sliders, and via dedicated files for specialized variants.
Standard sliders
The default-slider.js utility handles three common slider variants. To use one in a template, add the appropriate class to the slider container:
| Class | Dots | Arrows | Notes |
|---|---|---|---|
.js-default-slider | Yes | Yes (hidden on mobile) | Adaptive height below 768px and 992px |
.js-default-slider-alt | No | No | Minimal; no controls |
.js-default-slider-alt-adaptive | No | No (hidden on mobile) | Adaptive height on smaller breakpoints |
Importing the utility
In your block's script.js:
1/**
2 * Banner Block
3 *
4 * Rotating image/text carousel for the page banner area.
5 *
6 * @shared default-slider
7 * Trigger: .js-default-slider
8 * Config: dots=true, responsive adaptive height below 992px
9 *
10 * @see /guidelines/javascript/slick
11 * @see /guidelines/javascript/shared-utilities
12 */
13import '../../js/components/default-slider.js';Specialized slider utilities
For sliders that need a custom configuration beyond the standard presets, dedicated utility files exist:
| File | Trigger | Used by |
|---|---|---|
article-card-slider.js | .js-article-card-slider | posts-featured |
carousel-content.js | .js-carousel-content | before-after |
cta-columns-slider.js | .js-cta-columns-slider | cta-columns blocks |
showcase-slider.js | .eb-js-showcase-slider | product-showcase |
ticker-slider.js | .js-ticker-slider | ticker/marquee blocks |
video-carousel.js | .js-video-carousel | video carousel blocks |
RTL support
All Slick instances check $("html").attr("dir") and set rtl: true automatically when the page direction is right-to-left. This is built into all Cynosure slider utilities.
Adding a new slider
If you need a slider configuration that does not match any existing variant:
- Add the appropriate class to your Handlebars template:
1<div class="js-my-slider">
2
3 <div class="my-slider__slide">
4 <img src="" alt="">
5 </div>
6
7</div>- Write a dedicated utility or add to your block's
script.js:
1import $ from 'jquery';
2import 'slick-carousel';
3
4$(function () {
5 if ($('.js-my-slider').length) {
6 $('.js-my-slider').slick({
7 dots: true,
8 slidesToShow: 3,
9 responsive: [
10 {
11 breakpoint: 992,
12 settings: { slidesToShow: 2 },
13 },
14 {
15 breakpoint: 576,
16 settings: { slidesToShow: 1, arrows: false },
17 },
18 ],
19 });
20 }
21});Accessibility notes
- Slick generates
aria-labelattributes for navigation buttons but these may need custom labels in your template using theprevArrow/nextArrowconfig options. - Ensure the slider container has an appropriate
aria-labeloraria-roledescriptionif the default is not descriptive enough. - Add
prefers-reduced-motionhandling viaautoplay: falseby default; only enableautoplaywhen the content requires it.
On This Page