slaydover
A lightweight, swipeable slide-over component for Vue and Nuxt, perfect for modals, drawers, and overlays with responsive positioning and smooth gestures.
Install the package via npm:
npm install @crossatko/slaydover
In your main entry file (e.g., main.js
or main.ts
):
import { createApp } from 'vue'
import App from './App.vue'
import Slaydover from '@crossatko/slaydover'
import '@crossatko/slaydover/style.css'
const app = createApp(App)
app.component('Slaydover', Slaydover)
app.mount('#app')
Import the Slaydover and styles in your Vue component:
<script setup lang="ts">
import Slaydover from '@crossatko/slaydover'
import '@crossatko/slaydover/style.css'
</script>
You can also use provided Nuxt module for automatic registration:
export default defineNuxtConfig({
modules: ['@crossatko/slaydover/nuxt']
})
Prop | Type | Default | Description |
---|---|---|---|
v-model | boolean | false | Toggles the slide-over open/closed state. |
position | string | bottom md:right | Sets slide-over side (e.g., top , right , bottom md:right , left ). |
breakpoints | Record<string,number> | {xs: 360, sm: 480, md: 768, lg: 1024, xl: 1280, '2xl': 1536} | Custom breakpoints in pixels. |
speed | number | 300 | Animation speed in ms |
titleId | string | unefined | Optional ID for the title element for accessibility (ARIA) |
bottom
→ Always slides from bottom.top md:right
→ Top on small screens, right on medium and larger.left md:bottom xl:right
→ Left on mobile, bottom on tablets, right on large screens.default
: Main content inside the slide-over.overlay
: Custom overlay background (defaults to semi-transparent dark backdrop).<script setup lang="ts">
import { ref } from 'vue'
import Slaydover from '@crossatko/slaydover'
import '@crossatko/slaydover/style.css'
const open = ref(false)
</script>
<template>
<button @click="open = true">Open slaydover</button>
<Slaydover v-model="open" position="bottom sm:top lg:right">
<div class="content">Your awesome content 👌</div>
</Slaydover>
</template>
<style>
.content {
padding: 1rem;
background: white;
}
</style>