I'm trying to create a simple carousel using react-bootstrap. This is the simple uncontrolled carousel I'm trying to create. https://react-bootstrap.github.io/components/carousel/
This is my code,
import React from 'react';
import Carousel1 from '../../../assets/FootTheBall_SignUpScreen_CarouselImage-01.png';
import Carousel2 from '../../../assets/FootTheBall_SignUpScreen_CarouselImage-02.png';
import Carousel3 from '../../../assets/FootTheBall_SignUpScreen_CarouselImage-03.png';
import Carousel4 from
import Carousel from 'react-bootstrap/lib/Carousel';
const Core = () => (
<main className="core">
<article className="left">
<Carousel>
<Carousel.Item>
<img src={Carousel1} alt=""/>
</Carousel.Item>
<Carousel.Item>
<img src={Carousel2} alt=""/>
</Carousel.Item>
<Carousel.Item>
<img src={Carousel3} alt=""/>
</Carousel.Item>
</Carousel>
</article>
<article className="right"></article>
</main>
);
export default Core
The images get vertically stacked and no transition happens. What am I doing wrong here.
Because React-Bootstrap doesn't depend on a very precise version of Bootstrap, we don't ship with any included css. However, some stylesheet is required to use these components. How and which bootstrap styles you include is up to you, but the simplest way is to include the latest styles from the CDN. <!--
'carousel-caption' Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatchfor working with heavily customized bootstrap css.
I handled it controlling the sliding using the activeIndex and onSelect properties for the Carousel component. You might also be able to control it using the onSlid or onSlide callback properties, but not sure.
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.
Did you linked the style files?
According to docs:
Because React-Bootstrap doesn't depend on a very precise version of Bootstrap, we don't ship with any included css. However, some stylesheet is required to use these components. How and which bootstrap styles you include is up to you, but the simplest way is to include the latest styles from the CDN.
For linking add following to index.html
:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With