ValyroUI English version

Carousel

Карусель: scroll-snap, свайп, автопрокрутка, миниатюры. Бесплатно, MIT · Данные и показатели › Карточки

Установка

npx valyro-cli@latest add carousel
npx shadcn@latest add https://valyro.xyz/r/carousel.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { Carousel } from 'valyro-ui';

Пропсы

PropTypeDefault
children *ReactNodeOne child per slide: any element, or Carousel.Slide for a slide with its own thumbnail or name.
slidesPerViewSlidesPerView1Slides visible at once: a number (fractions peek at the next slide) or { minWidth: count } by carousel width.
gapnumber16Space between slides in px (default 16).
indexnumberIndex of the first visible slide (controlled).
defaultIndexnumber0Initial index when uncontrolled.
onIndexChange(index: number) => voidCalled with the new index when it changes.
loopbooleanfalsePrevious/next wrap around at the ends.
autoplayboolean | numberfalseAdvance automatically: true (every 5 s) or an interval in ms. Pauses on hover and focus, and stays off when the user prefers reduced motion until they press play.
showArrowsboolean | 'always'truePrevious / next buttons over the slides (default true). With a mouse they appear on hover or keyboard focus (touch screens always show them); 'always' keeps them visible at rest too.
align'start' | 'center''start'Where the current slide rests: start (default) or center, with the neighbours peeking on both sides and fading out at the edges. With center every slide is a snap position.
indicators'dots' | 'thumbnails' | 'none''dots'Dots, a thumbnail strip (with renderThumbnail or each Carousel.Slide's thumbnail), or nothing (default dots).
renderThumbnail(index: number) => ReactNodeContent of the thumbnail button for the slide at index; required for indicators="thumbnails" without Carousel.Slide thumbnails.
animation'default' | 'spring''default'spring: the current slide stands out — the others shrink, dim and stay inert on a spring — and the active dot stretches into a pill with a bounce. Pairs well with a fractional slidesPerView (1.3) that shows the neighbours. default: plain slides.
labelsPartial<CarouselLabels>Overrides for the built-in English text; keys left out keep their defaults.

Составные части

Carousel.Slide (CarouselSlide)

Похожие компоненты

  • Card — Универсальные карточки
  • Item Card — Карточка-строка: иконка, заголовок, описание и элемент управления справа
  • Record Card — Карточка записи: статус, контекст, ключевые поля и действия
  • Empty State — Экран отсутствия данных
  • Data Table — Таблицы с поиском и сортировкой
  • Data Grid — Таблица на 100 000 строк: группировка, фильтры, редактирование
  • Virtual List — Виртуальный список на 100 000 строк
  • Bulk Action Bar — Панель действий над выбранными строками с горячими клавишами
  • List Block — Блок списка с картинками или иконками, описанием и значением
  • Description List — Список «ключ — значение»: столбиком, строками или сеткой с иконками
  • Tree View — Древовидные структуры
  • Accordion — Раскрывающиеся секции

Назад: Record Card · Далее: Empty State · Весь раздел «Данные и показатели»