---
title: "Smart Stack"
description: "A compact widget stack whose slides shrink and grow as you swipe, inspired by the iOS Smart Stack."
canonical_url: "https://www.blossom-carousel.com/docs/examples/advanced/smart-stack"
---

> Index of every page on this site: [llms.txt](https://www.blossom-carousel.com/llms.txt)

<supports-view-timeline-support>
<caution>

View-timeline is not yet supported in this browser. Check browser compatibility at [caniuse.com](https://caniuse.com/?search=scroll-snap-change)

</caution>
</supports-view-timeline-support>

<example-smart-stack>



</example-smart-stack>

<tabs sync="example-code-style">
<tabs-item label="CSS">
<code-group>

```css [.css]
.widget {
  width: 160px;
  height: 160px;
  overflow: clip;
  background: red;
  border-radius: 2rem;
}

.smart-stack {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  height: 100%;
  scroll-snap-type: x mandatory;

  & .slide {
    view-timeline: --slide inline 30%;

    & .slide-content {
      animation: slide cubic-bezier(0, 0.5, 1, 0.5) both;
      animation-timeline: --slide;
      animation-range: cover;
    }
  }
}

.slide {
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.slide-content {
  width: 100%;
  height: 100%;
  background: blue;
  border-radius: 2rem;
}

@keyframes slide {
  0% {
    scale: 0.8;
  }
  50% {
    scale: 1;
  }
  100% {
    scale: 0.8;
  }
}
```

```html [.html]
<div class="widget">
  <BlossomCarousel class="smart-stack">
    <div class="slide">
      <div class="slide-content"></div>
    </div>
    <div class="slide">
      <div class="slide-content"></div>
    </div>
    <div class="slide">
      <div class="slide-content"></div>
    </div>
    ...
  </BlossomCarousel>
</div>
```

</code-group>
</tabs-item>

<tabs-item label="Tailwind">
<code-group>

```css [.css]
.smart-stack {
  & .slide {
    view-timeline: --slide inline 30%;

    & .slide-content {
      animation: slide cubic-bezier(0, 0.5, 1, 0.5) both;
      animation-timeline: --slide;
      animation-range: cover;
    }
  }
}

@keyframes slide {
  0% {
    scale: 0.8;
  }
  50% {
    scale: 1;
  }
  100% {
    scale: 0.8;
  }
}
```

```html [.html]
<div class="size-40 aspect-square overflow-clip bg-primary/30 rounded-xl">
  <BlossomCarousel
    class="smart-stack snap-x snap-mandatory grid! grid-flow-col auto-cols-[100%] h-full"
  >
    <div class="size-full snap-center snap-always">
      <div class="size-full rounded-lg bg-primary rounded-xl"></div>
    </div>
    <div class="size-full snap-center snap-always">
      <div class="size-full rounded-lg bg-primary rounded-xl"></div>
    </div>
    <div class="size-full snap-center snap-always">
      <div class="size-full rounded-lg bg-primary rounded-xl"></div>
    </div>
    ...
  </BlossomCarousel>
</div>
```

</code-group>
</tabs-item>
</tabs>

## Sitemap

See the full [sitemap](https://www.blossom-carousel.com/sitemap.md) for all pages.
