Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I customize Carousel-indicators in react-bootstrap

I'm using http://react-bootstrap.github.io/ Carousel component. I am trying to customize the carousel-indicators including some texts, and make it look like a button with text, but react render 'ol' tag into a new CarouseItem and no redirect function

    return (
       <Carousel id="sampleSlide" indicators={false}>
          <ol className="carousel-indicators">
            <li data-target='#sampleSlide' data-slide-to="0" className="active"></li>
            <li data-target= '#sampleSlide' data-slide-to="1"></li>
          </ol>
          <CarouselItem>
            <div className="itemContent">
               Hello World
            </div>
          </CarouselItem>
          <CarouselItem>
            <div className="itemContent">
               Hello World
            </div>
          </CarouselItem>
      </Carousel>
    );

Is there any way to customize it or any other method to do so?

like image 927
maxluk12 Avatar asked Jan 15 '16 09:01

maxluk12


2 Answers

You can change your Bootstrap carousel Indicator with customized CSS/SCSS

Reactjs code:

<div className={classes.my__carousel_main}>
          <Carousel>
              <Carousel.Item>
                <img
                  className="d-block w-100"
                  src={require("../../assets/utf_banner.png")}
                  alt="First slide"
                />
                <Carousel.Caption>
                  <h3>First slide label</h3>
                  <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
                </Carousel.Caption>
              </Carousel.Item>
        </Carousel>
</div>

CSS/SCSS code:

    .my__carousel_main {
            div{
                ol{
                    li{
                        background-color: red;
                        border-radius: 50%;
                        height: 10px;
                        width: 10px;
                    }
                }
            }
        }

Thank You ;)

like image 133
Arshad Avatar answered Sep 24 '22 19:09

Arshad


This is how I customized it:

.carousel-indicators li {
border-top: unset;
width: 10px;
border-bottom: unset;
border: 1px solid transparent;
border-left-width: 0;
border-right-width: 0;
border-radius: 10px;
background-color: rgba(169, 29, 42, 0.4);
height: 10px;
width: 20px;}                                                  
                                                               
.carousel-indicators .active {
border-top: unset;
border-bottom: unset;
border: 1px solid transparent;
border-left-width: 0;
border-right-width: 0;
border-radius: 10px;
background-color: #A91D2A;
height: 10px;
width: 50px}
like image 42
Siddharth Sogani Avatar answered Sep 25 '22 19:09

Siddharth Sogani