React-responsive-carousel: How to remove black background and add text/button to each slide?

Created on 16 Feb 2019  路  6Comments  路  Source: leandrowd/react-responsive-carousel

I want to add text and buttons into the slide instead of images. But the background remains black. How can I update the existing code to achieve my goal.

The existing code is at: https://codesandbox.io/s/k0vo7z1ypv

Any help is appreciated.
Thanks!

Most helpful comment

Hi is very easy, only add in you css file where is the Carousel.

.carousel .slide{ background-color: none; }

and is all 馃槃

All 6 comments

Hello!

Fellow react-responsive-carousel user here. I might have a little insight on how to achieve what you're asking for. As far as adding text and buttons, you should be able to just place the html into each child component like you have shown for the text in your codesandbox (you might have to change the text color to something other than black to see it since the background is black). I've some minimal changes to your sandbox here to demonstrate: showing text and buttons. As far as changing the black background... the style of each <li> that is a slide has a background-color: #000 which is black. I'm not sure if this is the best route to take but if you go into the provided 'carousel.css', and 'carousel.min.css' files and search for '.carousel .slide' and append the background color it should be reflected once you compile. I realize this is changing the native code of the module but it works at a minimum. Hopefully this helps until @leandrowd responds.
=)

Hi is very easy, only add in you css file where is the Carousel.

.carousel .slide{ background-color: none; }

and is all 馃槃

I would suggest this issue is not closed as it'd be better to allow the component to by styled via something like emotion

Hi is very easy, only add in you css file where is the Carousel.

.carousel .slide{ background-color: none; }

and is all 馃槃

For me it was actually background not background-color :)
.carousel .slide{ background: none; }

Hope that helps.

Hi is very easy, only add in you css file where is the Carousel.

.carousel .slide{ background-color: none; }

and is all 馃槃

Just doing this would probably not work all the time.

Using the Carousel's parent class will help.
HTML:
<div className='carousel-container'> <Carousel /> </div>
CSS
.carousel-container .carousel .slide{ background-color: none; }

I created a css file, like this:

.carousel .slide {
  background-color: none;
}

and imported in React component to cover Carousel's original css:

import "./index.css";

<Carousel >
...something you want show slide
</Carousel>

It works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anoush-soghomonyan picture anoush-soghomonyan  路  6Comments

paulgasbarra picture paulgasbarra  路  5Comments

PatrikKozak picture PatrikKozak  路  3Comments

ShineOfFire picture ShineOfFire  路  6Comments

LeopoldLerch picture LeopoldLerch  路  5Comments