Gestures
Layout
SwipeToReveal
A row you swipe to reveal actions underneath it, like a native mobile list row. Use it for actions such as archive or delete on touch screens.
Install
import { SwipeToReveal } from 'vael-ui'Playground
SwipeToReveal
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { SwipeToReveal } from 'vael-ui'
const open = ref(false)
</script>
<template>
<SwipeToReveal v-model:open="open">SwipeToReveal</SwipeToReveal>
</template>Motion New
SwipeToReveal: its appearance and states.
<SwipeToReveal
:motion="{ states: { open: { root: { scale: 1.04 } } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | rootcontentactions | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
states | opendragging | Sets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
| Key | Action |
|---|---|
| TabShiftTab | Reveals an actions panel when focus moves into it, and closes it when focus leaves the row. |
| Escape | Closes an open row without closing a dialog around it. |
- Both actions panels stay mounted and in the tab order while closed, so every action is reachable without swiping.
- In the DOM, the leading actions come before the row content and the trailing actions after it, so Tab follows the screen.
- Swiping is pointer only. Use
v-model:open,reveal()orclose()to open the actions another way. - With
disabled, the root getsaria-disabled="true", and only swiping is blocked.