āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/preetecool/roi-ui/ui/carousel ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
npx shadcn@latest add @roiui/carousel
npx shadcn@latest add @roiui/carousel-tailwind
</CodeBlockTab>
<CodeBlockTab value="pnpm">
pnpm dlx shadcn@latest add @roiui/carousel
pnpm dlx shadcn@latest add @roiui/carousel-tailwind
</CodeBlockTab>
</CodeBlockTabs>
</InstallationTabsContent>
<InstallationTabsContent value="manual" data-manual="true">
Copy and paste the following files:
<ComponentSource name="carousel" />
</InstallationTabsContent> </InstallationTabs><CodeBlock filename="anatomy" language="tsx" code={`import { Carousel } from "@/components/ui/carousel";
<Carousel.Bleed> <Carousel.Root totalItems={3} gap={16} variant="inset" align="center"> <Carousel.Viewport> <Carousel.Content> <Carousel.Item index={0}> <div>Item 1</div> </Carousel.Item> <Carousel.Item index={1}> <div>Item 2</div> </Carousel.Item> <Carousel.Item index={2}> <div>Item 3</div> </Carousel.Item> </Carousel.Content> </Carousel.Viewport> <Carousel.Navigation /> </Carousel.Root> </Carousel.Bleed> `} />
The main carousel component that manages state and provides context.
<PropTable data={[ { prop: "totalItems", type: "number", required: true, description: "Total number of items in the carousel", }, { prop: "gap", type: "number", default: "16", description: "Gap between carousel items in pixels", }, { prop: "variant", type: '"default" | "inset"', default: '"default"', description: "Carousel variant. Use 'inset' to align with parent container bounds", }, { prop: "align", type: '"start" | "center"', default: '"start"', description: "Alignment of carousel content", }, { prop: "index", type: "number", description: "Controlled index value", }, { prop: "defaultIndex", type: "number", default: "0", description: "Default index for uncontrolled mode", }, { prop: "onIndexChange", type: "function", description: "Callback when index changes", }, { prop: "className", type: "string", description: "Additional CSS classes to apply to the carousel container", }, ]} />
Wrapper that extends carousel to full viewport width.
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the bleed container", }, ]} />
Scrollable viewport container with hidden scrollbars.
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the viewport", }, ]} />
Flex container for horizontal layout with pseudo elements for spacing.
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the content container", }, ]} />
<PropTable data={[ { prop: "index", type: "number", required: true, description: "The index of the item in the carousel", }, { prop: "className", type: "string", description: "Additional CSS classes to apply to the item", }, ]} />
Container for navigation buttons with default Previous/Next rendering.
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the navigation container", }, { prop: "children", type: "ReactNode", description: "Custom navigation buttons (defaults to Previous and Next)", }, ]} />
Previous button that auto-disables at start.
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the previous button", }, { prop: "children", type: "ReactNode", description: "Custom content for the previous button (defaults to left arrow icon)", }, ]} />
Next button that auto-disables at end.
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the next button", }, { prop: "children", type: "ReactNode", description: "Custom content for the next button (defaults to right arrow icon)", }, ]} />
Dot indicators for each item (hidden when only one item).
<PropTable data={[ { prop: "className", type: "string", description: "Additional CSS classes to apply to the indicators container", }, ]} />
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā