Socket
Socket
Sign inDemoInstall

@igloo-ui/carousel

Package Overview
Dependencies
7
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @igloo-ui/carousel

A carousel allows users to see and navigate the steps within a flow.


Version published
Weekly downloads
135
decreased by-44.44%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

A carousel allows users to see and navigate the steps within a flow.

Installation

To install @igloo-ui/carousel in your project, you will need to run the following command using npm:

npm install @igloo-ui/carousel

If you prefer Yarn, use the following command instead:

yarn add @igloo-ui/carousel

Usage

Then to use the component in your code just import it!

import Button from '@igloo-ui/button';
import Carousel from '@igloo-ui/carousel';

const SLIDE_NUM = 3;
const [selected, setSelected] = React.useState(0);

const handlePageChange = (index) => {
  setSelected(index);
};

const handlePrimaryActionClick = () => {
  if (selected < SLIDE_NUM - 1) {
    handlePageChange(selected + 1);
  }
};

const handleSecondaryActionClick = () => {
  if (selected > 0) {
    handlePageChange(selected - 1);
  }
};

<Carousel
  onPageChange={handlePageChange}
  currentSlide={selected}
  primaryAction={
    <Button appearance={'primary'} onClick={handlePrimaryActionClick}>
      {selected < SLIDE_NUM - 1 ? 'Next' : 'Done'}
    </Button>
  }
  secondaryAction={
    <Button appearance={'secondary'} onClick={handleSecondaryActionClick}>
      {selected > 0 ? 'Prev' : 'Cancel'}
    </Button>
  }
>
  <div style={{ background: 'pink', padding: '4rem' }}>Slide 1</div>
  <div style={{ background: 'lightBlue', padding: '4rem' }}>Slide 2</div>
  <div style={{ background: 'lightGreen', padding: '4rem' }}>Slide 3</div>
</Carousel>;

FAQs

Last updated on 02 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc