JGuang

Carousel

Carousel · Chakra UI

Preview
npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0

Carousel

Used to cycle through a series of visual content within a container.

Provide navigation and position indicators, make autoplay pausable, and honor reduced motion. Dragging must not be the only way to access slides.

Included icon notices

The source viewer includes ICON_ATTRIBUTION.md and original notices for the icon collections used by these examples. Preserve them when redistributing examples; react-icons' wrapper license does not replace individual collection terms.

  • Font Awesome 5: CC BY 4.0 License
  • Lucide: ISC

Installation and initialization

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0

Initialize ChakraProvider with defaultSystem and Emotion before rendering. Preserve the host React version and inspect peer compatibility. Official npm installation supplies components, not these example source files. Use the resource setup guide for locale, next-themes and framework-specific SSR; copy the selected example source separately from npm installation.

Complete native usage example

This is the actual pinned example, not a generic API mock. Copy its source closure and retain the named export. Additional imports are listed per example below.

import { Carousel, IconButton } from "@chakra-ui/react"
import { DecorativeBox } from "compositions/lib/decorative-box"
import { LuChevronLeft, LuChevronRight } from "react-icons/lu"

const items = Array.from({ length: 5 })

export const CarouselBasic = () => {
  return (
    <Carousel.Root slideCount={items.length} maxW="md" mx="auto">
      <Carousel.ItemGroup>
        {items.map((_, index) => (
          <Carousel.Item key={index} index={index}>
            <DecorativeBox w="100%" h="300px" rounded="lg" fontSize="2.5rem">
              {index + 1}
            </DecorativeBox>
          </Carousel.Item>
        ))}
      </Carousel.ItemGroup>

      <Carousel.Control justifyContent="center" gap="4">
        <Carousel.PrevTrigger asChild>
          <IconButton size="xs" variant="ghost">
            <LuChevronLeft />
          </IconButton>
        </Carousel.PrevTrigger>

        <Carousel.Indicators />

        <Carousel.NextTrigger asChild>
          <IconButton size="xs" variant="ghost">
            <LuChevronRight />
          </IconButton>
        </Carousel.NextTrigger>
      </Carousel.Control>
    </Carousel.Root>
  )
}

All examples and reproduction requirements

Names identify demos, not component variant props. Copy every sourceFiles entry for the selected example. The compositions alias denotes local files, not a package. Preserve relative imports or rewrite the alias to your project's actual path. React peers are inspected separately; editor examples retain the coherent pinned Tiptap extension family.

Basic

carousel-basic · Named export CarouselBasic · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-basic.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

Controlled

carousel-controlled · Named export CarouselControlled · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-controlled.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Store

carousel-with-store · Named export CarouselWithStore · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-store.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Floating Arrow

carousel-with-floating-arrow · Named export CarouselWithFloatingArrow · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-floating-arrow.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Indicators

carousel-with-indicators · Named export CarouselWithIndicators · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/carousel-with-indicators.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Thumbnails

carousel-with-thumbnails · Named export CarouselWithThumbnails · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-thumbnails.tsx

Spacing

carousel-spacing · Named export CarouselSpacing · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-spacing.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

Variable Size

carousel-variable-size · Named export CarouselVariableSize · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-variable-size.tsx

Vertical

carousel-vertical · Named export CarouselVertical · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-vertical.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Mouse Drag

carousel-with-mouse-drag · Named export CarouselWithMouseDrag · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-mouse-drag.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Autoplay

carousel-with-autoplay · Named export CarouselWithAutoplay · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-autoplay.tsx
  • vendor/apps/compositions/src/lib/decorative-box.tsx

With Dialog

carousel-with-dialog · Named export CarouselWithDialog · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-dialog.tsx

With Images

carousel-with-images · Named export CarouselWithImages · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-with-images.tsx

Composition

carousel-composition · Named export CarouselComposition · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/carousel-composition.tsx

Native API and source references

The source viewer retains original declarations, imports and inheritance. Ark UI event contracts, Chakra style props and recipe types stay in their native packages; this guide does not flatten or invent their defaults. Code comments remain original source, not translated prose.

  • npm/@chakra-ui/react@3.37.0/dist/types/components/carousel/carousel.d.ts
  • npm/@chakra-ui/react@3.37.0/dist/types/components/carousel/index.d.ts
  • npm/@chakra-ui/react@3.37.0/dist/types/components/carousel/namespace.d.ts

State and installation checks

Run strict types, the target production build and real interactions. Test labels/focus/keyboard, both themes, narrow layout, empty/loading/error states where supported and cleanup after unmount. Remote demo endpoints, uploads and downloads are constrained in the preview; configure your own services. Copying a command or reaching preview-ready does not prove installation or backend success.

Provenance and license boundaries

https://github.com/chakra-ui/chakra-ui/tree/2e7517745cff2fcde0b8012f136cf99611ff262a

These are JGuang practical bilingual notes, not a full translation of upstream MDX. Original documentation and example bytes remain in vendor. Preserve repository MIT, compositions ISC metadata and separate dependency notices. The original metadata discrepancy and any missing full notices remain explicit review items; paid Chakra Pro is excluded.