Reveal Example
Reveal child elements with your own CSS transition as they scroll into view. class-to-add names the class that the component adds to each child.
Reduced Motion
Your system is set to reduce motion, so the animations shown on this page will not play for you.
Code
The following example assumes that you have imported the component and set up the theme.
<div class="cards-container">5 collapsed lines
<sv-reveal class-to-add="fade-in"> <div class="card"></div> <div class="card"></div> <div class="card"></div> </sv-reveal></div>
<style>26 collapsed lines
.cards-container { display: flex; gap: 1em; justify-content: center;
.card { inline-size: 100px; block-size: 100px; background-color: var(--sv-accent); border-radius: 4px; opacity: 0; translate: 0 20px; transition: opacity 1s linear, translate 1s ease;
@media (prefers-reduced-motion: reduce) { transition: none; } }
.card.fade-in { opacity: 1; translate: 0 0; } }</style>