# Swipe Horizontal swipe-to-reveal component using CSS scroll-snap. Reveal action buttons by swiping left or right. ## Basic Example ```html
Swipeable content
``` ## Stop Variant Stays in "open" position after swiping: ```html
Swipe to reveal, stays open
``` ## Multiple Action Buttons ```html
Content with multiple left actions
``` ## Structure ``` [Left actions] [Main content] [Right actions] ``` - First child(ren) before the main content = left actions - Last child(ren) after the main content = right actions - Middle child = main visible content ## Styling Details - CSS scroll-snap for smooth snapping - Three-column layout - Hidden scrollbar - Container query for center content width ## JavaScript for Events (Optional) ```javascript const swipe = document.querySelector('.swipe'); // Detect when actions are revealed swipe.addEventListener('scroll', () => { const scrollLeft = swipe.scrollLeft; const maxScroll = swipe.scrollWidth - swipe.clientWidth; if (scrollLeft === 0) { // Left actions visible } else if (scrollLeft === maxScroll) { // Right actions visible } else { // Centered (default) } }); ``` ## See Also - [Carousel](https://graffiti-ui.com/llms/carousel.txt) - Horizontal scroll