Primitives

ContentCarouselItem

A slide wrapper used as default-slot content inside the ContentCarousel block.

ContentCarouselItem wraps arbitrary slide content (images, text, buttons, or other blocks) in a Container and tags it with the carousel-item class the ContentCarousel block relies on to detect slides passed via its default slot. It’s only needed when slotting custom content — carousels built from the items array prop render their own slides automatically.

Slotted slides inside ContentCarousel

basic
---
import ContentCarousel from '@alfadormx/blocks/composite/ContentCarousel.astro';
import ContentCarouselItem from '@alfadormx/blocks/primitives/ContentCarouselItem.astro';
import Button from '@alfadormx/blocks/primitives/Button.astro';
import ImageBlock from '@alfadormx/blocks/primitives/Image.astro';
---

<ContentCarousel>
  <ContentCarouselItem basis="basis-full" background={{ class: 'bg-surface' }}>
    <ImageBlock
      src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&h=600&fit=crop"
      alt="Mountain"
      width={400}
      height={300}
      class="rounded-lg"
    />
    <h3 class="text-xl font-bold">Slide with Image Block</h3>
    <Button
      href="https://unsplash.com"
      target="_blank"
      label="View on Unsplash"
      icon={{ name: 'heroicons:arrow-top-right-on-square' }}
      intent="primary"
    />
  </ContentCarouselItem>
  <ContentCarouselItem basis="basis-full" background={{ class: 'bg-surface' }}>
    <h3 class="text-xl font-bold">Interactive Content</h3>
    <p class="text-center max-w-md">
      Each <code>ContentCarouselItem</code> can hold any content — text, buttons, or nested blocks —
      while the carousel handles drag, autoplay, and indicator behavior.
    </p>
    <div class="flex gap-3">
      <Button label="Action 1" icon={{ name: 'heroicons:star' }} intent="primary" />
      <Button label="Action 2" icon={{ name: 'heroicons:heart' }} intent="secondary" />
    </div>
  </ContentCarouselItem>
</ContentCarousel>

API Reference

PropTypeDefaultDescription
basisstring—Tailwind basis class controlling slide width (default: 'basis-full')