useCarousel (ui/carousel.tsx)

Shubhamsaboo/awesome-llm-apps · generative_ui_agents/ai-shadcn-component-generator/apps/ui/src/components/ui/carousel.tsx · typescript · Apache-2.0
ui

A fully featured, reusable React carousel component with navigation, keyboard support, and context-based hooks.

// Source: https://github.com/Shubhamsaboo/awesome-llm-apps | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
"use client";

import * as React from "react";
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
import { ArrowLeft, ArrowRight } from "lucide-react";

import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";

type CarouselApi = UseEmblaCarouselType[1];
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
type CarouselOptions = UseCarouselParameters[0];
type CarouselPlugin = UseCarouselParameters[1];

type CarouselProps = {
  opts?: CarouselOptions;
  plugins?: CarouselPlugin;
  orientation?: "horizonta

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key