@algolia/ui-components-horizontal-slider-js
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

@algolia/ui-components-horizontal-slider-js

Horizontal slider UI component for JavaScript.

Installation

yarn add @algolia/ui-components-horizontal-slider-js
# or
npm install @algolia/ui-components-horizontal-slider-js

Usage

To get started, you need a container for your slider to go in. If you don’t have one already, you can insert one into your markup:

<div id="horizontal-slider"></div>

Then, you can call the horizontalSlider function and provide the container. It can be a CSS selector or an Element.

Standalone

import { horizontalSlider } from '@algolia/ui-components-horizontal-slider-js';

import '@algolia/ui-components-horizontal-slider-theme';

const items = [
  { objectID: '1', name: 'Item 1' },
  { objectID: '2', name: 'Item 2' },
];

horizontalSlider({
  container: '#horizontal-slider',
  items,
  itemComponent({ item }) {
    return item.name;
  },
});

With Algolia Recommend

See usage for Recommend.

Props

container

string | HTMLElement

The container for the component. You can either pass a CSS selector or an Element. If there are several containers matching the selector, it picks up the first one.

When undefined, the function returns a JSX element for you to inject wherever you want.

items

RecordWithObjectID | required
type RecordWithObjectID<TItem> = TItem & {
  objectID: string;
};

The items to display in the component.

itemComponent

({ item }) => JSX.Element | required

The item component to display.

translations

HorizontalSliderTranslations
type HorizontalSliderTranslations = Partial<{
  sliderLabel: string;
  previousButtonLabel: string;
  previousButtonTitle: string;
  nextButtonLabel: string;
  nextButtonTitle: string;
}>;

The translations for the component.

classNames

HorizontalSliderClassnames
type HorizontalSliderClassnames = Partial<{
  item: string;
  list: string;
  navigation: string;
  navigationNext: string;
  navigationPrevious: string;
  root: string;
}>;

The class names for the component.

environment

typeof window | defaults to window

The environment in which your application is running.

This is useful if you’re using the slider in a different context than window.

Readme

Keywords

none

Package Sidebar

Install

npm i @algolia/ui-components-horizontal-slider-js

Weekly Downloads

132

Version

1.2.3

License

MIT

Unpacked Size

69.2 kB

Total Files

19

Last publish

Collaborators

  • cdhawke-algolia
  • mariaaalungu
  • vascobettencourt
  • fernando_beck_algolia
  • algthomasbritton
  • shaejaz
  • wwalser
  • jkaho
  • mprevell97
  • louishousiaux
  • antoine.gilles
  • eventexperiences_algolia
  • jsok_algolia
  • bhinchley-algolia
  • hugowit
  • alg-admin
  • aymeric.giraudet
  • gavinwade12
  • bhcastle
  • jasonberry
  • scyganek-algolia
  • drodriguln
  • abodelot
  • leviwhalen
  • sfaiqh
  • valentindotxyz
  • fluf
  • instantsearch-bot
  • taylorcjohnson_algolia
  • pjankowski5312
  • raed-algolia
  • dylantientcheu
  • catalgolia
  • morgan-algolia
  • algabet
  • andy_ds
  • bengreenbank
  • alg-bgastinne
  • daltondickalgolia
  • jcohonner-algolia
  • robertmogos
  • emmanuel.fortin
  • ejaldorau
  • dhaya.b
  • lukyvj
  • marielaure
  • haroenv
  • rayrutjes
  • jerska
  • samouss
  • therealwebby
  • francoischalifour
  • jonmontane
  • tkrugg
  • seafoox
  • sylvainh
  • lorrissaintgenez
  • broujo
  • e-krebs
  • kombucha
  • sylvain
  • crawler-team
  • amcdaid106
  • devinalgolia
  • jvenezia
  • otomatik
  • sophiem03
  • sarahdayan
  • maximehuang
  • guitek
  • matthewbond
  • cyril.descossy
  • tatsuro
  • danajeremy
  • mathougui
  • xavdh
  • agdavid
  • rasemotte
  • plnech
  • shortcuts
  • praagyajoshi
  • alphonseb
  • leodau
  • fabienmotte
  • sarahfranc
  • millotp