Carousels
A slideshow component for cycling through elements—images or slides of text—like a carousel.
Example
Carousels don’t automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they’re not explicitly required. Add and customize as you see fit.
Controlled
You can also control the Carousel state, via the
activeIndex
prop and onSelect
handler.
API
Carouselview source file
import Carousel from 'react-bootstrap/Carousel'
Copy import code for the Carousel componentName | Type | Default | Description |
---|---|---|---|
activeIndex | number | 0 | controlled by: onSelect , initial prop: defaultActiveindex Controls the current visible slide |
as | elementType | You can use a custom element type for this component. | |
controls | boolean | true | Show the Carousel previous and next arrows for changing the current slide |
fade | boolean | false | Cross fade slides instead of the default slide animation |
indicators | boolean | true | Show a set of slide position indicators |
interval | number | 5000 | The amount of time to delay between automatically cycling an item.
If |
keyboard | boolean | true | Enable keyboard navigation via the Arrow keys for changing slides |
nextIcon | node | <span aria-hidden="true" className="carousel-control-next-icon" /> | Override the default button icon for the "next" control |
nextLabel | string | 'Next' | Label shown to screen readers only, can be used to show the next element in the carousel. Set to null to deactivate. |
onSelect | function | controls activeIndex Callback fired when the active item changes.
| |
onSlideEnd | function | A callback fired after a slide transitions in | |
pauseOnHover | boolean | true | Temporarily pause the slide interval when the mouse hovers over a slide. |
prevIcon | node | <span aria-hidden="true" className="carousel-control-prev-icon" /> | Override the default button icon for the "previous" control |
prevLabel | string | 'Previous' | Label shown to screen readers only, can be used to show the previous element in the carousel. Set to null to deactivate. |
slide | boolean | true | Enables animation on the Carousel as it transitions between slides. |
touch | boolean | true | Whether the carousel should support left/right swipe interactions on touchscreen devices. |
wrap | boolean | true | Slides will loop to the start when the last one transitions |
bsPrefix | string | 'carousel' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
Carousel.Itemview source file
import Carousel from 'react-bootstrap/Carousel'
Copy import code for the Carousel componentName | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bsPrefix required | string | 'carousel-item' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
Carousel.Captionview source file
import Carousel from 'react-bootstrap/Carousel'
Copy import code for the Carousel componentName | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bsPrefix required | string | 'carousel-caption' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |