|
| 1 | +# CMS Slider |
| 2 | + |
| 3 | +This code component example is a carousel slider that integrates seamlessly with Webflow CMS collections, allowing you to display dynamic CMS content in an interactive slider format. [See a live example here.](https://cms-slider-4d63c4.webflow.io/) |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- **CMS Collection Integration** - Automatically extracts and displays items from Webflow CMS Collection lists via slot-based architecture |
| 10 | +- **React Slick Carousel** - Powered by React Slick with full carousel functionality |
| 11 | +- **Configurable Behavior** - Control slides to show, scroll speed, infinite looping, autoplay, navigation arrows, and dots |
| 12 | +- **Slot-Based Content** - Accepts any Webflow CMS collection list as a component slot for maximum flexibility |
| 13 | +- **Vite Project Setup** - Fast development experience with Hot Module Replacement (HMR) |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +- Install dependencies: `npm i` |
| 18 | +- Run `npx webflow library share` to create a code library for this example in your designated Webflow workspace |
| 19 | + |
| 20 | +## Component Properties |
| 21 | + |
| 22 | +| Prop Name | Type | Default | Description | |
| 23 | +| ---------------------------- | --------- | ------- | ------------------------------------------------------------ | |
| 24 | +| `cmsCollectionComponentSlot` | `Slot` | - | The slot where you place your Webflow CMS Collection List | |
| 25 | +| `showCMSCollectionComponent` | `Boolean` | `false` | Toggle visibility of the CMS collection for editing purposes | |
| 26 | +| `infinite` | `Boolean` | `true` | Enable infinite looping of slides | |
| 27 | +| `slidesToShow` | `Number` | `1` | Number of slides visible at once | |
| 28 | +| `slidesToScroll` | `Number` | `1` | Number of slides to scroll on navigation | |
| 29 | +| `dots` | `Boolean` | `true` | Show navigation dots below the slider | |
| 30 | +| `arrows` | `Boolean` | `true` | Show previous/next navigation arrows | |
| 31 | +| `autoplay` | `Boolean` | `true` | Enable automatic slide transitions | |
| 32 | +| `autoplaySpeed` | `Number` | `3000` | Delay between auto transitions (in milliseconds) | |
| 33 | + |
| 34 | +## Technical Implementation |
| 35 | + |
| 36 | +This component showcases several advanced patterns for Webflow Code Components: |
| 37 | + |
| 38 | +- **Custom Hook (`useCMSCollectionItems`)** - Extracts CMS list items from Webflow slots using Shadow DOM slot APIs |
| 39 | +- **Shadow DOM Style Injection** - Uses `useShadowGlobalStyles` hook to inject Webflow styles into the shadow root |
| 40 | +- **Element Cloning** - Clones CMS elements to render them within the slider while preserving their Webflow styling |
| 41 | +- **React Slick Integration** - Demonstrates how to integrate third-party React libraries with Webflow Code Components |
0 commit comments