1.1.2 • Published 5 years ago

@opuscapita/react-list-items v1.1.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

react-list-items

Description

Renders a custom element or by default a string m/n with the navigation icons 'previous' and 'next' to list items from the list.

Installation

npm install @opuscapita/react-list-items

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

ListItems

Prop nameTypeDefaultDescription
idstring'oc-list-items'Unique HTML id attribute
classNamestring''Custom className
disabledboolfalseA sign of a disabled status of navigation icons
goToItemfunctionrequiredCallback that is called when navigation to another item should happen
itemElementelementnullCustom component to render between navigation icons. By default it renders a string m/n
itemIdnumber, stringrequiredInitially selected item id
itemIdslistrequiredList of item ids
typeableboolfalseIf true, current item can be changed by typing.

Code example

import React from 'react';
import { List } from 'immutable';

import ListItems from '@opuscapita/react-list-items';

export default class ListItemsView extends React.Component {
  constructor(props) {
    super(props);
    this.state = { currentItem: 3 };
  }

  componentWillMount() {
    this.itemIds = List([1, 2, 3, 4, 5]);
  }

  goToItem = (currentItem) => {
    this.setState({ currentItem });
  }

  render() {
    return (
      <ListItems
        goToItem={this.goToItem}
        id="listItemsExample"
        itemId={this.state.currentItem}
        itemIds={this.itemIds}
      />
    );
  }
}
1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago