# Carousel Carousel is a horizontally scrollable layout that displays a series of items. It shows a collection of carousel items that can be scrolled on and off the screen. It may come with controls (e.g. arrows or buttons) allowing the user to manually scroll through. Carousel UI elements are commonly seen in the following design patterns: Image gallery, Onboarding screens, Product catalogs. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-carousel--introduction ## Variants documented in Storybook - Default Carousel: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-carousel--default-carousel - Carousel With Images: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-carousel--carousel-with-images ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Carousel. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Carousel With Images — Image Example HTML: ```html
Experience the serenity of nature at dusk.
The vibrant pulse of the city after dark.
Breathe in the freshness of the ancient woods.
Modern geometric shapes and soft colors.
(Replace with desired banner content)
(Replace with desired banner content)
(Replace with desired banner content)
(Replace with desired banner content)
Carousel is a horizontally scrollable layout that displays a series of items. It shows a collection of carousel items that can be scrolled on and off the screen. It may come with controls (e.g. arrows or buttons) allowing the user to manually scroll through. Carousel UI elements are commonly seen in the following design patterns: Image gallery, Onboarding screens, Product catalogs.
Two common carousel layouts are included here: a text-first promotional banner and an image-led storytelling surface.
Quickly copy the base classes used to build the carousel structure and controls.
|
Base Carousel
ux4g-carousel
|
|
Viewport Mask
ux4g-carousel-viewport
|
|
Sliding Track
ux4g-carousel-slides
|
|
Single Slide
ux4g-carousel-slide
|
|
Controls Wrapper
ux4g-carousel-controls
|
|
Arrow Button
ux4g-carousel-arrow
|
|
Pagination Wrapper
ux4g-carousel-pagination
|
|
Pagination Dot
ux4g-carousel-dot
|
|
Filled Mobile Controls
ux4g-carousel-filled
|
Carousel is a horizontally scrollable layout that displays a series of items. It shows a collection of carousel items that can be scrolled on and off the screen. It may come with controls (e.g. arrows or buttons) allowing the user to manually scroll through. Carousel UI elements are commonly seen in the following design patterns: Image gallery, Onboarding screens, Product catalogs.
Two common carousel layouts are included here: a text-first promotional banner and an image-led storytelling surface.
(Replace with desired banner content)
(Replace with desired banner content)
(Replace with desired banner content)
(Replace with desired banner content)
Experience the serenity of nature at dusk.
The vibrant pulse of the city after dark.
Breathe in the freshness of the ancient woods.
Modern geometric shapes and soft colors.
Quickly copy the base classes used to build the carousel structure and controls.
|
Base Carousel
ux4g-carousel
|
|
Viewport Mask
ux4g-carousel-viewport
|
|
Sliding Track
ux4g-carousel-slides
|
|
Single Slide
ux4g-carousel-slide
|
|
Controls Wrapper
ux4g-carousel-controls
|
|
Arrow Button
ux4g-carousel-arrow
|
|
Pagination Wrapper
ux4g-carousel-pagination
|
|
Pagination Dot
ux4g-carousel-dot
|
|
Filled Mobile Controls
ux4g-carousel-filled
|
Carousel is a horizontally scrollable layout that displays a series of items. It shows a collection of carousel items that can be scrolled on and off the screen. It may come with controls (e.g. arrows or buttons) allowing the user to manually scroll through. Carousel UI elements are commonly seen in the following design patterns: Image gallery, Onboarding screens, Product catalogs.
Two common carousel layouts are included here: a text-first promotional banner and an image-led storytelling surface.
Quickly copy the base classes used to build the carousel structure and controls.
|
Base Carousel
ux4g-carousel
|
|
Viewport Mask
ux4g-carousel-viewport
|
|
Sliding Track
ux4g-carousel-slides
|
|
Single Slide
ux4g-carousel-slide
|
|
Controls Wrapper
ux4g-carousel-controls
|
|
Arrow Button
ux4g-carousel-arrow
|
|
Pagination Wrapper
ux4g-carousel-pagination
|
|
Pagination Dot
ux4g-carousel-dot
|
|
Filled Mobile Controls
ux4g-carousel-filled
|