Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move react-material-ui-carousel indicators

I have a carousel and dots indicators. I would like to move the indicators from the bottom to the circle shown below in the picture. I tried to set negative margin-top, but then the indicators get hidden. How can I achieve this? enter image description here

import Carousel from "react-material-ui-carousel";
import Item from "./CarouselItems/Item";
import FirstImage from "../../assets/images/first.jpg";
import LastImage from "../../assets/images/lastslide.jpg";

const CarouselComponent: React.FC = (): JSX.Element => {
  return (
    <MyCarousel
      autoPlay={false}
      swipe={true}
      indicators={true}
      indicatorContainerProps={{
        style: {
          marginTop: "-50px"
        },
      }}
    >
      <Item />
      <Item />
    </Carousel>
  );
};

export default MyCarousel;
like image 785
Sani Avatar asked Nov 28 '25 18:11

Sani


1 Answers

You can add following styles to indicatorContainerProps:

  indicatorContainerProps={{
    style: {
      zIndex: 1,
      marginTop: "-10px",
      position: "relative"
    }
  }}

Edit cranky-zhukovsky-gur8mc

like image 129
Majid M. Avatar answered Nov 30 '25 12:11

Majid M.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!