Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Carousel

    Row of slides built on CSS scroll snap, with previous and next buttons, optional dots, and arrow key navigation. No autoplay.

    Plan your week

    Drag tasks onto the calendar to block focus time.

    Share with your team

    Invite teammates and assign tasks in one click.

    Track progress

    See what shipped this week on a single dashboard.

    Plan your week

    Drag tasks onto the calendar to block focus time.

    Share with your team

    Invite teammates and assign tasks in one click.

    Track progress

    See what shipped this week on a single dashboard.

    Plan your week

    Drag tasks onto the calendar to block focus time.

    Share with your team

    Invite teammates and assign tasks in one click.

    Track progress

    See what shipped this week on a single dashboard.

    @php
        $card = 'flex h-40 flex-col justify-end rounded-xl bg-subtle p-5';
        $title = 'text-sm font-medium text-ink';
        $text = 'mt-1 text-sm text-muted';
    @endphp
    
    <x-markas.carousel label="Product tour" show-dots>
        <x-slot:plan>
            <div class="{{ $card }}">
                <p class="{{ $title }}">Plan your week</p>
                <p class="{{ $text }}">Drag tasks onto the calendar to block focus time.</p>
            </div>
        </x-slot:plan>
        <x-slot:share>
            <div class="{{ $card }}">
                <p class="{{ $title }}">Share with your team</p>
                <p class="{{ $text }}">Invite teammates and assign tasks in one click.</p>
            </div>
        </x-slot:share>
        <x-slot:track>
            <div class="{{ $card }}">
                <p class="{{ $title }}">Track progress</p>
                <p class="{{ $text }}">See what shipped this week on a single dashboard.</p>
            </div>
        </x-slot:track>
    </x-markas.carousel>
    import { Carousel } from "@/components/markas/Carousel";
    
    const card = "flex h-40 flex-col justify-end rounded-xl bg-subtle p-5";
    const title = "text-sm font-medium text-ink";
    const text = "mt-1 text-sm text-muted";
    
    export default function CarouselExample() {
      return (
        <Carousel label="Product tour" showDots>
          <div className={card}>
            <p className={title}>Plan your week</p>
            <p className={text}>
              Drag tasks onto the calendar to block focus time.
            </p>
          </div>
          <div className={card}>
            <p className={title}>Share with your team</p>
            <p className={text}>Invite teammates and assign tasks in one click.</p>
          </div>
          <div className={card}>
            <p className={title}>Track progress</p>
            <p className={text}>
              See what shipped this week on a single dashboard.
            </p>
          </div>
        </Carousel>
      );
    }
    <script setup lang="ts">
    import Carousel from "@/components/markas/Carousel.vue";
    
    const card = "flex h-40 flex-col justify-end rounded-xl bg-subtle p-5";
    const title = "text-sm font-medium text-ink";
    const text = "mt-1 text-sm text-muted";
    </script>
    
    <template>
      <Carousel label="Product tour" show-dots>
        <div :class="card">
          <p :class="title">Plan your week</p>
          <p :class="text">Drag tasks onto the calendar to block focus time.</p>
        </div>
        <div :class="card">
          <p :class="title">Share with your team</p>
          <p :class="text">Invite teammates and assign tasks in one click.</p>
        </div>
        <div :class="card">
          <p :class="title">Track progress</p>
          <p :class="text">See what shipped this week on a single dashboard.</p>
        </div>
      </Carousel>
    </template>
    <script lang="ts">
      import Carousel from "$lib/components/markas/Carousel.svelte";
    
      const card = "flex h-40 flex-col justify-end rounded-xl bg-subtle p-5";
      const title = "text-sm font-medium text-ink";
      const text = "mt-1 text-sm text-muted";
    
      const slides = [
        {
          title: "Plan your week",
          text: "Drag tasks onto the calendar to block focus time.",
        },
        {
          title: "Share with your team",
          text: "Invite teammates and assign tasks in one click.",
        },
        {
          title: "Track progress",
          text: "See what shipped this week on a single dashboard.",
        },
      ];
    </script>
    
    <Carousel label="Product tour" showDots items={slides}>
      {#snippet slide(item)}
        <div class={card}>
          <p class={title}>{item.title}</p>
          <p class={text}>{item.text}</p>
        </div>
      {/snippet}
    </Carousel>
    ---
    import Carousel from "@/components/markas/Carousel.astro";
    
    const card = "flex h-40 flex-col justify-end rounded-xl bg-subtle p-5";
    const title = "text-sm font-medium text-ink";
    const text = "mt-1 text-sm text-muted";
    
    const slides = [
      {
        title: "Plan your week",
        text: "Drag tasks onto the calendar to block focus time.",
      },
      {
        title: "Share with your team",
        text: "Invite teammates and assign tasks in one click.",
      },
      {
        title: "Track progress",
        text: "See what shipped this week on a single dashboard.",
      },
    ];
    ---
    
    <Carousel label="Product tour" showDots items={slides}>
      {
        (item: (typeof slides)[number]) => (
          <div class={card}>
            <p class={title}>{item.title}</p>
            <p class={text}>{item.text}</p>
          </div>
        )
      }
    </Carousel>
    import { Component } from "@angular/core";
    import { Carousel } from "./markas/carousel.component";
    
    @Component({
      selector: "markas-example",
      imports: [Carousel],
      template: `
        <markas-carousel label="Product tour" showDots [items]="slides">
          <ng-template let-item>
            <div [class]="card">
              <p [class]="title">{{ item.title }}</p>
              <p [class]="text">{{ item.text }}</p>
            </div>
          </ng-template>
        </markas-carousel>
      `,
    })
    export default class CarouselExample {
      protected readonly card =
        "flex h-40 flex-col justify-end rounded-xl bg-subtle p-5";
      protected readonly title = "text-sm font-medium text-ink";
      protected readonly text = "mt-1 text-sm text-muted";
      protected readonly slides = [
        {
          title: "Plan your week",
          text: "Drag tasks onto the calendar to block focus time.",
        },
        {
          title: "Share with your team",
          text: "Invite teammates and assign tasks in one click.",
        },
        {
          title: "Track progress",
          text: "See what shipped this week on a single dashboard.",
        },
      ];
    }

    Examples

    Several per view

    Desk lamp

    $48

    Notebook set

    $18

    Wool throw

    $64

    Ceramic mug

    $14

    Desk lamp

    $48

    Notebook set

    $18

    Wool throw

    $64

    Ceramic mug

    $14

    Desk lamp

    $48

    Notebook set

    $18

    Wool throw

    $64

    Ceramic mug

    $14

    Testimonials

    We moved our admin panel to MarkasUI in a weekend. Design reviews are half as long now.
    Dewi LestariHead of Product, Jakarta
    One set of tokens for Blade and Vue replaced three style guides and a lot of pixel nudging.
    Budi SantosoEngineering Manager, Bandung
    Simple enough for client handoffs, flexible enough for every brand I work with.
    Siti AminahFreelance developer, Yogyakarta
    We moved our admin panel to MarkasUI in a weekend. Design reviews are half as long now.
    Dewi LestariHead of Product, Jakarta
    One set of tokens for Blade and Vue replaced three style guides and a lot of pixel nudging.
    Budi SantosoEngineering Manager, Bandung
    Simple enough for client handoffs, flexible enough for every brand I work with.
    Siti AminahFreelance developer, Yogyakarta
    We moved our admin panel to MarkasUI in a weekend. Design reviews are half as long now.
    Dewi Lestari Head of Product, Jakarta
    One set of tokens for Blade and Vue replaced three style guides and a lot of pixel nudging.
    Budi Santoso Engineering Manager, Bandung
    Simple enough for client handoffs, flexible enough for every brand I work with.
    Siti Aminah Freelance developer, Yogyakarta

    Photo gallery

    Living room, photo 1 of 4

    Kitchen, photo 2 of 4

    Bedroom, photo 3 of 4

    Garden, photo 4 of 4

    Living room, photo 1 of 4

    Kitchen, photo 2 of 4

    Bedroom, photo 3 of 4

    Garden, photo 4 of 4

    Living room, photo 1 of 4

    Kitchen, photo 2 of 4

    Bedroom, photo 3 of 4

    Garden, photo 4 of 4

    Installation

    npx markasui@latest add carousel

    Usage

    <x-markas.carousel label="Product tour" show-dots>
        <x-slot:plan>
            <div class="h-40 rounded-xl bg-subtle p-5">Plan your week</div>
        </x-slot:plan>
        <x-slot:share>
            <div class="h-40 rounded-xl bg-subtle p-5">Share with your team</div>
        </x-slot:share>
        <x-slot:track>
            <div class="h-40 rounded-xl bg-subtle p-5">Track progress</div>
        </x-slot:track>
    </x-markas.carousel>

    Needs Alpine.js. Every named slot becomes a slide, in the order you write them. For a list, use <x-slot :name="'slide-'.$index"> inside @foreach.

    import { Carousel } from "@/components/markas/Carousel";
    
    <Carousel label="Product tour" showDots>
      <div className="h-40 rounded-xl bg-subtle p-5">Plan your week</div>
      <div className="h-40 rounded-xl bg-subtle p-5">Share with your team</div>
      <div className="h-40 rounded-xl bg-subtle p-5">Track progress</div>
    </Carousel>;
    <template>
      <Carousel label="Product tour" show-dots>
        <div class="h-40 rounded-xl bg-subtle p-5">Plan your week</div>
        <div class="h-40 rounded-xl bg-subtle p-5">Share with your team</div>
        <div class="h-40 rounded-xl bg-subtle p-5">Track progress</div>
      </Carousel>
    </template>
    <script lang="ts">
      import Carousel from "$lib/components/markas/Carousel.svelte";
    
      const slides = ["Plan your week", "Share with your team", "Track progress"];
    </script>
    
    <Carousel label="Product tour" showDots items={slides}>
      {#snippet slide(title, index)}
        <div class="h-40 rounded-xl bg-subtle p-5">{index + 1}. {title}</div>
      {/snippet}
    </Carousel>

    Svelte, Astro, and Angular take the slides as items and render each one with a snippet, a function child, or an ng-template. Svelte reads {index} in a plain attribute as an expression, so pass label templates in braces: slideLabel={"Slide {index} of {total}"}.

    ---
    import Carousel from "@/components/markas/Carousel.astro";
    
    const slides = ["Plan your week", "Share with your team", "Track progress"];
    ---
    
    <Carousel label="Product tour" showDots items={slides}>
      {
        (title: string, index: number) => (
          <div class="h-40 rounded-xl bg-subtle p-5">{index + 1}. {title}</div>
        )
      }
    </Carousel>

    Each carousel is a small custom element, so it keeps working after view transitions.

    import { Component } from "@angular/core";
    import { Carousel } from "./markas/carousel.component";
    
    @Component({
      selector: "app-example",
      imports: [Carousel],
      template: `
        <markas-carousel label="Product tour" showDots [items]="slides">
          <ng-template let-title let-index="index">
            <div class="h-40 rounded-xl bg-subtle p-5">
              {{ index + 1 }}. {{ title }}
            </div>
          </ng-template>
        </markas-carousel>
      `,
    })
    export class Example {
      slides = ["Plan your week", "Share with your team", "Track progress"];
    }
    • Slides scroll with CSS scroll snap, so touch swipe and trackpad scrolling work without extra code.
    • Use perView 2 or 3 to show several cards at once. The buttons still move one slide per press.
    • slideLabel and dotLabel accept {index} and {total} placeholders.
    • There is no autoplay on purpose.

    Props

    NameTypeDefaultDescription
    slidesBlade: named slots · React: children · Vue: default slot · Svelte, Astro, Angular: items-Each named slot (Blade) or each child element (React and Vue) becomes one slide, in order. Svelte, Astro, and Angular render one slide per entry of items instead.
    itemsT[]-Svelte, Astro, and Angular only. Data for the slides, rendered by a slide snippet (Svelte), a function child (Astro), or an ng-template with let-item and let-index (Angular).
    labelstringCarouselAccessible name of the carousel region. Describe the content, for example Product tour.
    perView1 | 2 | 31Number of slides visible at once. Buttons still move one slide at a time.
    showDotsbooleanfalseShow one dot per slide that jumps to that slide. Best with perView 1.
    previousLabelstringPrevious slideAccessible label of the previous button.
    nextLabelstringNext slideAccessible label of the next button.
    slideLabelstring{index} of {total}Accessible label of each slide. {index} and {total} are replaced with numbers.
    dotLabelstringGo to slide {index}Accessible label of each dot. {index} and {total} are replaced with numbers.

    Accessibility

    • The root is a region with aria-roledescription=carousel and the label prop as its name.
    • Each slide is a group with aria-roledescription=slide and a label such as 2 of 4.
    • Left and right arrow keys move one slide while focus is anywhere inside the carousel, and the scroll viewport itself is focusable.
    • Previous and next are native buttons that become disabled at the ends, and the active dot has aria-current=true.
    • Nothing moves on its own, so there is no pause control to manage. Scrolling is instant when reduced motion is on.

    Related components

    More data components with the same classes in every framework.