- Prop
index- Type
number | undefined- Default
- —
- Requirement
- optional
- Description
- —
Docs Components Data Display
Carousel
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** * Carousel fixture. `defaultIndex` pins the mid-track state the * five-framework render proof compares (slide 2 of 3 showing, both arrows * enabled, the middle dot current). `slides` is plain copy — each adapter * turns it into that framework's own children/snippet/template list, which * is the one place Carousel's five APIs genuinely differ. */const carouselFixture = { id: "carousel", label: "Platform metrics", defaultIndex: 1, loop: false, slides: ["−42% p95 latency", "99.98% uptime held", "5× scale absorbed"],} satisfies { id: string; label: string; defaultIndex: number; loop: boolean; slides: readonly string[];}; import { Carousel } from "@grassroot/ui-react"; export default function CarouselDemo() { return ( <div> <Carousel label={carouselFixture.label} defaultIndex={carouselFixture.defaultIndex} loop={carouselFixture.loop} > {carouselFixture.slides.map((slide) => ( <div key={slide}>{slide}</div> ))} </Carousel> </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">/** * Carousel fixture. `defaultIndex` pins the mid-track state the * five-framework render proof compares (slide 2 of 3 showing, both arrows * enabled, the middle dot current). `slides` is plain copy — each adapter * turns it into that framework's own children/snippet/template list, which * is the one place Carousel's five APIs genuinely differ. */const carouselFixture = { id: "carousel", label: "Platform metrics", defaultIndex: 1, loop: false, slides: ["−42% p95 latency", "99.98% uptime held", "5× scale absorbed"],} satisfies { id: string; label: string; defaultIndex: number; loop: boolean; slides: readonly string[];}; import { Carousel } from "@grassroot/ui-vue";</script> <template> <div> <Carousel :label="carouselFixture.label" :default-index="carouselFixture.defaultIndex" :loop="carouselFixture.loop" > <div v-for="slide in carouselFixture.slides" :key="slide">{{ slide }}</div> </Carousel> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";/** * Carousel fixture. `defaultIndex` pins the mid-track state the * five-framework render proof compares (slide 2 of 3 showing, both arrows * enabled, the middle dot current). `slides` is plain copy — each adapter * turns it into that framework's own children/snippet/template list, which * is the one place Carousel's five APIs genuinely differ. */const carouselFixture = { id: "carousel", label: "Platform metrics", defaultIndex: 1, loop: false, slides: ["−42% p95 latency", "99.98% uptime held", "5× scale absorbed"],} satisfies { id: string; label: string; defaultIndex: number; loop: boolean; slides: readonly string[];}; import { GrassrootCarousel, GrassrootCarouselSlide } from "@grassroot/ui-angular"; @Component({ selector: "app-carousel-demo", standalone: true, imports: [GrassrootCarousel, GrassrootCarouselSlide], template: ` <div> <grassroot-carousel [label]="fixture.label" [defaultIndex]="fixture.defaultIndex" [loop]="fixture.loop" > @for (slide of fixture.slides; track slide) { <ng-template grassrootCarouselSlide ><div>{{ slide }}</div></ng-template > } </grassroot-carousel> </div> `,})export class CarouselDemoComponent { protected readonly fixture = carouselFixture;} export default CarouselDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import type { Snippet } from "svelte"; import { Carousel } from "@grassroot/ui-svelte"; /** * Carousel fixture. `defaultIndex` pins the mid-track state the * five-framework render proof compares (slide 2 of 3 showing, both arrows * enabled, the middle dot current). `slides` is plain copy — each adapter * turns it into that framework's own children/snippet/template list, which * is the one place Carousel's five APIs genuinely differ. */ const carouselFixture = { id: "carousel", label: "Platform metrics", defaultIndex: 1, loop: false, slides: ["−42% p95 latency", "99.98% uptime held", "5× scale absorbed"], } satisfies { id: string; label: string; defaultIndex: number; loop: boolean; slides: readonly string[]; }; </script> {#snippet slideOne()}<div>{carouselFixture.slides[0]}</div>{/snippet}{#snippet slideTwo()}<div>{carouselFixture.slides[1]}</div>{/snippet}{#snippet slideThree()}<div>{carouselFixture.slides[2]}</div>{/snippet}<div> <Carousel label={carouselFixture.label} defaultIndex={carouselFixture.defaultIndex} loop={carouselFixture.loop} children={[slideOne, slideTwo, slideThree] as Snippet[]} /></div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { Carousel } from "@grassroot/ui-solid";/** * Carousel fixture. `defaultIndex` pins the mid-track state the * five-framework render proof compares (slide 2 of 3 showing, both arrows * enabled, the middle dot current). `slides` is plain copy — each adapter * turns it into that framework's own children/snippet/template list, which * is the one place Carousel's five APIs genuinely differ. */const carouselFixture = { id: "carousel", label: "Platform metrics", defaultIndex: 1, loop: false, slides: ["−42% p95 latency", "99.98% uptime held", "5× scale absorbed"],} satisfies { id: string; label: string; defaultIndex: number; loop: boolean; slides: readonly string[];}; export default function CarouselDemo() { return ( <div> <Carousel label={carouselFixture.label} defaultIndex={carouselFixture.defaultIndex} loop={carouselFixture.loop} > {carouselFixture.slides.map((slide) => ( <div>{slide}</div> ))} </Carousel> </div> );}Installation
API Reference
Import
import { Carousel } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
Description
indexnumber | undefined—
optional
—
defaultIndexnumber | undefined—
optional
—
onIndexChange((index: number) => void) | undefined—
optional
—
loopboolean | undefinedfalseoptional
Wrap around past the ends instead of clamping.
labelstring | undefined"Carousel"optional
Accessible label for the region.
classNamestring | undefined—
optional
—
- Prop
defaultIndex- Type
number | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
onIndexChange- Type
((index: number) => void) | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
loop- Type
boolean | undefined- Default
false- Requirement
- optional
- Description
- Wrap around past the ends instead of clamping.
- Prop
label- Type
string | undefined- Default
"Carousel"- Requirement
- optional
- Description
- Accessible label for the region.
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
Events
| Event | Payload |
|---|---|
onIndexChange | ((index: number) => void) | undefined |
Content regions
children
Import
import { Carousel } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
indexnumber | undefined—
optional
defaultIndexnumber | undefined0optional
loopboolean | undefinedfalseoptional
labelstring | undefined"Carousel"optional
- Prop
index- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
defaultIndex- Type
number | undefined- Default
0- Requirement
- optional
- Prop
loop- Type
boolean | undefined- Default
false- Requirement
- optional
- Prop
label- Type
string | undefined- Default
"Carousel"- Requirement
- optional
Events
| Event | Payload |
|---|---|
update:index | [index: number] |
Content regions
default
Import
import { Component } from "@angular/core";
import { GrassrootCarousel, GrassrootCarouselSlide } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
indexnumber—
optional
defaultIndexnumber0optional
loopbooleanfalseoptional
labelstring"Carousel"optional
- Prop
index- Type
number- Default
- —
- Requirement
- optional
- Prop
defaultIndex- Type
number- Default
0- Requirement
- optional
- Prop
loop- Type
boolean- Default
false- Requirement
- optional
- Prop
label- Type
string- Default
"Carousel"- Requirement
- optional
Events
| Event | Payload |
|---|---|
indexChange | number |
Content regions
children
Import
import type { Snippet } from "svelte";
import { Carousel } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
indexnumber—
optional
defaultIndexnumber0optional
loopbooleanfalseoptional
labelstring"Carousel"optional
classNamestring—
optional
onIndexChange(index: number) => void—
optional
- Prop
index- Type
number- Default
- —
- Requirement
- optional
- Prop
defaultIndex- Type
number- Default
0- Requirement
- optional
- Prop
loop- Type
boolean- Default
false- Requirement
- optional
- Prop
label- Type
string- Default
"Carousel"- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
- Prop
onIndexChange- Type
(index: number) => void- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onIndexChange | (index: number) => void |
Content regions
children
Import
import { Carousel } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
indexnumber—
optional
defaultIndexnumber0optional
onIndexChange(index: number) => void—
optional
loopbooleanfalseoptional
labelstring"Carousel"optional
classNamestring—
optional
- Prop
index- Type
number- Default
- —
- Requirement
- optional
- Prop
defaultIndex- Type
number- Default
0- Requirement
- optional
- Prop
onIndexChange- Type
(index: number) => void- Default
- —
- Requirement
- optional
- Prop
loop- Type
boolean- Default
false- Requirement
- optional
- Prop
label- Type
string- Default
"Carousel"- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onIndexChange | (index: number) => void |
Content regions
children