npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@squiz/xaccel-slider

v1.15.1

Published

A slider component.

Downloads

502

Readme

Slider

Description

The most basic usage is just calling the slider component with an array of images (that have the correct format)

Checkout the https://gitlab.squiz.net/plug-and-play/component-library/ storybook and view the Slider component to see the props that can be passed to it.

Components properties

type Image = {
    name: string;
    alt: string;
    caption: string;
    imageVariations: {
        original: {
            url: string;
            width: number;
            height: number;
            byteSize: number;
            mimeType: string;
            aspectRatio: string;
            sha1Hash: string;
        };
    };
};

type Item = {
    image: Image;
};

type ClassNameOverride = {
    className: string;
    cssModule: {
        [key: string]: string;
    };
    retainMissingModuleClasses: boolean;
};

export type SliderProps = {
    activeItem?: number;
    accessibilityTitle?: string;
    sliderHeight?: number;
    images: Array<Item>;
    infinite?: boolean;
    slideHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'none';
    className?: string | ClassNameOverride;
    theme?: 'light' | 'dark';
};

Props Example:

exampleImages: [
    {
        image: {
            name: 'Image 1',
            alt: 'Image alt 1',
            caption: 'Image 1 caption text. At vero eos et accusamus et iusto odio dignissimos ducimus.',
            imageVariations: {
                original: {
                    url: 'https://images.unsplash.com/photo-1690818083154-e4eaa4e8b8ac?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1587&q=80',
                    width: 1298,
                    height: 865,
                    byteSize: 1,
                    mimeType: '',
                    aspectRatio: '',
                    sha1Hash: '',
                },
            },
        },
    },
    {
        image: {
            name: 'Image 2',
            alt: 'Image alt 2',
            caption: 'Image 2 caption text',
            imageVariations: {
                original: {
                    url: 'https://images.unsplash.com/photo-1690695585525-8610507695de?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3270&q=80',
                    width: 1947,
                    height: 1298,
                    byteSize: 1,
                    mimeType: '',
                    aspectRatio: '',
                    sha1Hash: '',
                },
            },
        },
    }
];

Usage

First install the package by running: npm i @squiz/xaccel-slider

Basic minimum config example

import Slider from '@squiz/xaccel-slider';

<Slider images={exampleImages} />

Additional props that can be specified

import Slider from '@squiz/xaccel-slider';

<Slider
    accessibilityTitle='Gallery of pictures from artist'
    sliderHeight={500}
    slideHeadingLevel='h3'
    images={exampleImages}
    infinite=true
    activeItem={0}
    className="custom-class"
    theme="light"
/>