A Nuxt module to plug and play Splide.js
npm install @sr3pp/nuxt-splide> šø A zero-config Splide integration for Nuxt 3 ā with built-in themes, custom theme support, and runtime switching.


---
- ā
Auto-installs and registers @splidejs/vue-splide
- ā
Auto-imports and globally
- ā
Built-in support for official Splide themes (default, skyblue, sea-green)
- ā
Custom theme support via your own CSS
- ā
Runtime variant switching using the variant prop
- ā
Zero-config install via nuxi module add
---
``bash`
npx nuxi module add @nuxt/splide
Then use it immediately:
`vue`
Slide {{ n }}
ā No manual imports required.
---
Add your configuration to nuxt.config.ts under the splide key. You can define multiple themes and a default one:
`ts`
export default defineNuxtConfig({
modules: ['@nuxt/splide'],
splide: {
themes: ['default', 'skyblue', 'sea-green', 'sr3pp'], // multiple available themes
defaultTheme: 'skyblue', // sets the default one
customTheme: '~/assets/css/my-splide-theme.css' // optional
}
})
| Option | Type | Description |
|----------------|----------|-----------------------------------------------------------------------------|
| defaultTheme | string | Sets the default splide style |customTheme
| | string | Path to a custom theme CSS file in your project |themes
| | string[] | List of available themes to register |
---
- defaultskyblue
- sea-green
-
- sr3pp (example)nuxt
- (example)
These load the official Splide themes and apply them globally.
---
You can define your own themes using scoped CSS like this:
`css`
/ assets/css/my-splide-theme.css /
.splide--mytheme .splide__arrow {
background: linear-gradient(135deg, #8e44ad, #c0392b);
color: white;
}
Then in nuxt.config.ts:
`ts`
splide: {
customTheme: '~/assets/css/my-splide-theme.css'
}
---
- All your custom themes will extend official styles.
- Style .splide--[variant] instead of .splide to isolate themes cleanly.src/css/
- You can dynamically create your own themes inside a module like this one by compiling SCSS to and exporting them.
---
``
nuxt-splide/
āāā src/
ā āāā module.ts # Nuxt module setup
ā āāā runtime/
ā ā āāā components/
ā ā āāā Splide.vue
ā ā āāā SplideSlide.vue
ā āāā css/
ā āāā sr3pp.css # Compiled custom theme
āāā themes/
ā āāā utils/_tools.scss # SCSS variables/mixins
ā āāā sr3pp.scss # SCSS theme source
---
This module uses exports for Nuxt-style theme loading:
`json`
"exports": {
"./css/sr3pp.css": "./src/css/sr3pp.css"
}
Users can reference themes as:
`ts``
nuxt.options.css.push('nuxt-splide/css/sr3pp.css')
---
MIT
---
Created with ā¤ļø by @sr3pp
Feel free to contribute, fork, or use in your own Nuxt modules!