• Getting Started
  • Components
  • Github
  • Go pro
energyGetting started
  • Introduction
dComponents
  • Button Components
  • Grid Components
  • Input Components
  • Layout Components
  • Toast Components
  • Widget Components
  • Alert
  • Badge
  • Breadcrumb
  • Callout
  • Card
  • Carousel
  • Charts
  • Collapse
  • CreateElement
  • DataTable
  • Dropdown
  • ElementCover
  • Embed
  • Fade
  • Form
  • Icon
  • Img
  • Jumbotron
  • Link
  • ListGroup
  • Media
  • Modal
  • Nav
  • Navbar
  • Pagination
  • Popover
  • Progress
  • Spinner
  • Switch
  • Tabs
  • Toggler
  • Tooltip

Carousel

React carousel is a slideshow component for cycling through elements.


Usage

Example

    slide 1

    Slide 1

    Slide 1

    slide 2

    Slide 2

    Slide 2

    slide 3

    Slide 3

    Slide 3


    Script

    
      //slides=[]...
      const [activeIndex, setActiveIndex] = useState(0)
      return (
        <div>
          <CRow>
            <CCol sm={12}>
              <CCarousel activeIndex={activeIndex}>
                <CCarouselIndicators/>
                <CCarouselInner>
                  <CCarouselItem>
                    <img className="d-block w-100" src={slides[0]} alt="slide 1"/>
                    <CCarouselCaption><h3>Slide 1</h3><p>Slide 1</p></CCarouselCaption>
                  </CCarouselItem>
                  <CCarouselItem>
                    <img className="d-block w-100" src={slides[1]} alt="slide 2"/>
                    <CCarouselCaption><h3>Slide 2</h3><p>Slide 2</p></CCarouselCaption>
                  </CCarouselItem>
                  <CCarouselItem>
                    <img className="d-block w-100" src={slides[2]} alt="slide 3"/>
                    <CCarouselCaption><h3>Slide 3</h3><p>Slide 3</p></CCarouselCaption>
                  </CCarouselItem>
                </CCarouselInner>
                <CCarouselControl direction="prev"/>
                <CCarouselControl direction="next"/>
              </CCarousel>
            </CCol>
          </CRow>
        </div>
      )
      


    # Features

    • Slides to next item in intervals
    • Item could be an image or other content
    • Controlled by arrows and indicators

    # Carousel API

    NameRequiredTypeDefault Value
    classNamestring
    user classes for the main HTML tag
    childrenany[]
    children components
    innerRef(object | Function | string)
    ref to the main tag
    activeIndexnumber0
    index of the active item
    autoSlidenumber
    slide starts on beginning
    animateboolean
    set animate variable for created context
    onSlideChangeFunction
    on state change callback

    Context

    • creates own context


    CarouselCaption


    # CarouselCaption API

    NameRequiredTypeDefault Value
    classNamestring
    user classes for the main HTML tag
    innerRef(object | Function | string)
    ref to the main tag



    CarouselControl


    # CarouselControl API

    NameRequiredTypeDefault Value
    classNamestring
    user classes for the main HTML tag
    childrenany
    children components
    innerRef(object | Function | string)
    ref to the main tag
    directiontrue(prev | next)
    moving direction



    CarouselIndicators


    # CarouselIndicators API

    NameRequiredTypeDefault Value
    classNamestring
    user classes for the main HTML tag
    innerRef(object | Function | string)
    ref to the main tag
    indicatorsClassstringcarousel-indicators
    indicators user classes



    CarouselInner


    # CarouselInner API

    NameRequiredTypeDefault Value
    classNamestring
    user classes for the main HTML tag
    innerRef(object | Function | string)
    ref to the main tag



    CarouselItem


    # CarouselItem API

    NameRequiredTypeDefault Value
    childrenany
    children components
    classNamestring
    user classes for the main HTML tag
    innerRef(object | Function | string)
    ref to the main tag

    • Components
      • Usage
        • Features
        • API
      • Related
        • CCarousel
        • CCarouselCaption
        • CCarouselControl
        • CCarouselIndicators
        • CCarouselInner
        • CCarouselItem
    CoreUI © 2020 creativeLabs.core-logo