Giter Club home page Giter Club logo

Comments (3)

fritz-c avatar fritz-c commented on June 2, 2024

You can use a few different approaches via the defaultControlsConfig prop to achieve what you want.

You can modify defaultControlsConfig.prevButtonText and defaultControlsConfig.nextButtonText like so to get a basic implementation:
https://codesandbox.io/s/admiring-lewin-zlwmj9?file=/src/App.js:376-453

If you want to use an image or change the font size, etc., the following are also available:

nextButtonClassName
nextButtonStyle
prevButtonClassName
prevButtonStyle

from nuka-carousel.

msabree avatar msabree commented on June 2, 2024

The properties you want to use for the left/right controls are: "renderCenterLeftControls" and "renderCenterRightControls". These allow you to create custom controls which could be images, svgs, or any HTML element. You can also customize the pagination controls in a similar manner using "renderBottomCenterControls".

from nuka-carousel.

satyadalei avatar satyadalei commented on June 2, 2024

@RaresTDumitrica you can do that by modifying the defaultControlsConfig as specified by @fritz-c previously. But you can also add Icon component instead of string also. Here is the litlle code

import Carousel from "nuka-carousel"
import NavigateNextIcon from '@mui/icons-material/NavigateNext'
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew'

const defaultControlsConfig = {
    nextButtonText : React.ReactNode = <NavigateNextIcon />,
    prevButtonText: React.ReactNode = <ArrowBackIosNewIcon/>
}

<Carousel autoplay wrapAround defaultControlsConfig={defaultControlsConfig}> {Your images} </Carousel>

You can review my code where I have implemented that (in my nextjs application) here it is 👉 https://github.com/satyadalei/igit-mca-frontend/blob/main/src/components/hero/Carousel.jsx

from nuka-carousel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.