1.0.3 • Published 5 years ago

semantic-ui-react-button-pagination v1.0.3

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

semantic-ui-react-button-pagination

Build Status Coverage Status npm version

A pagination component for Semantic UI React using Button.

Installation

npm install semantic-ui-react-button-pagination

Demo

Demo

Demo

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example of semantic-ui-react-button-pagination</title>
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.css">
</head>
<body>
  <div id="app"></div>
  <script src="bundle.js"></script>
</body>
</html>
import React from 'react';
import ReactDOM from 'react-dom';
import Pagination from 'semantic-ui-react-button-pagination';

class Example extends React.Component {
  constructor() {
    super();
    this.state = {offset: 0};
  }

  handleClick(offset) {
    this.setState({offset});
  }

  render() {
    return (
      <Pagination
        offset={this.state.offset}
        limit={10}
        total={100}
        onClick={(e, props, offset) => this.handleClick(offset)}
      />
    );
  }
}

ReactDOM.render(
  <Example/>,
  document.getElementById('app')
);

Props

NameDefaultTypeDescription
limit (required)customThe number of rows per page. Allow a number greater than or equal to 1.
offset (required)customThe number of rows to skip. Allow a number greater than or equal to 0.
total (required)customThe total number of rows. Allow a number greater than or equal to 0.
ascustomAn element type of the group of buttons to render as (string or function).
attachedbool|enumThe group of buttons can be attached to other content.Enums:left right top bottom
basicfalseboolBasic buttons is less pronounced.
classNamestringAdditional classes of the group of buttons.
colorenumButtons can have different colors.Enums:red orange yellow olive green teal blue violet purple pink brown grey black
compactfalseboolButtons can reduce its padding to fit into tighter spaces.
currentPageColorenumThe current page button can have different colors.Enums:Same as 'color'.
currentPageNegativefalseboolThe current page button can hint towards a negative consequence.
currentPagePositivefalseboolThe current page button can hint towards a positive consequence.
currentPagePrimaryfalseboolThe current page button can be formatted to show different levels of emphasis.
currentPageSecondaryfalseboolThe current page button can be formatted to show different levels of emphasis.
currentPageStyleobjectApply the inline-styles to the current page button.
disabledfalseboolButtons can show it is currently unable to be interacted with.
floatedenumThe group of buttons can be aligned to the left or right of its container.Enums:left right
fluidfalseboolThe group of buttons can take the width of their container.
invertedfalseboolButtons can be formatted to appear on dark backgrounds.
negativefalseboolButtons can hint towards a negative consequence.
nextPageAnimatedbool|enumThe next page button can animate to show hidden content.Enums:fade vertical
nextPageChildren'>' *1customPrimary content of the next page button.
nextPageContentcustomShorthand for primary content of the next page button.
nextPageIconcustomAdd an icon to the next page button by passing name, props object, or an <Icon />.
nextPageIconPositionenumThe labeled icon button of the next page can format an icon to appear on the left or right.Enums:left right
onClickfuncCalled after user's click.onClick(event: SyntheticEvent, data: object, offset: number)event: React's original SyntheticEvent.data: All props.offset: The number of new offset.
otherPageColorenumThe other page buttons can have different colors.Enums:Same as 'color'.
otherPageNegativefalseboolThe other page buttons can hint towards a negative consequence.
otherPagePositivefalseboolThe other page buttons can hint towards a positive consequence.
otherPagePrimaryfalseboolThe other page buttons can be formatted to show different levels of emphasis.
otherPageSecondaryfalseboolThe other page buttons can be formatted to show different levels of emphasis.
otherPageStyleobjectApply the inline-styles to the other page buttons.
positivefalseboolButtons can hint towards a positive consequence.
previousPageAnimatedbool|enumThe previous page button can animate to show hidden content.Enums:fade vertical
previousPageChildren'<' *1customPrimary content of the previous page button.
previousPageContentcustomShorthand for primary content of the previous page button.
previousPageIconcustomAdd an icon to the previous page button by passing name, props object, or an <Icon />.
previousPageIconPositionenumThe labeled icon button of the previous page can format an icon to appear on the left or right.Enums:left right
primaryfalseboolButtons can be formatted to show different levels of emphasis.
secondaryfalseboolButtons can be formatted to show different levels of emphasis.
sizeenumThe group of buttons can have different sizes.Enums:tiny small medium large huge
verticalfalseboolThe group of buttons can be formatted to appear vertically.
reducedfalseboolReduce the number of displayed buttons.
styleApply the inline-styles to the group of buttons.
tabIndexnumber|stringButtons can receive focus.

*1: Only if content and icon are null.

License

MIT, see LICENSE for details.