The carousel component manages the slider logic internally using a custom hook, useCarousel.
npm i react-hartan
import { Carousel } from "react-hartan"
function App() {
return (
<>
<Carousel></Carousel>
</>
)
}
export default App
Customization With Props
images -> Accepts an array of string values, which may be the source links of the images, used in the slider.
id -> The id prop is similar to the id attribute in HTML. It allows to provide overall component id.
imgLoad -> The imgLoad prop is mapped to the loading attribute in HTML img tag. It allows to provide overall the value for loading attribute, "lazy" | "eager".
userCarouselStyle -> Accepts class name(s) as string, the custom style prop for the carousel container.
userImagesStyle -> Accepts class name(s) as string, the custom style prop for the images container.
Example:
import { Carousel } from "react-hartan"
const list = [
"https://dummyimage.com/601x300",
"https://dummyimage.com/602x300",
"https://dummyimage.com/603x300",
"https://dummyimage.com/604x300",
"https://dummyimage.com/605x300",
];
function App() {
return (
<>
<Carousel images={list}></Carousel>
</>
)
}
export default App