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

react-bootstrap-table-control

v1.3.0

Published

This component facilitates the control and display of tables.

Downloads

19

Readme

React Bootstrap Table Control

This component facilitates the control and display of tables.

Install

npm install react-bootstrap-table-control

Usage

Component usage example.

TableControl

import 'bootstrap/dist/css/bootstrap.min.css';

import React, { useState, useEffect } from 'react';
import { TableControl } from 'react-bootstrap-table-control';

export default () => {
  return <TableControl
    header={[
      { key: "id", name: "#" },
      { key: "name", name: "Name" },
      { key: "description", name: "Description" }
    ]}
    itens={[
      { id: 1, name: "Name 1", description: "Description 1" },
      { id: 2, name: "Name 2", description: "Description 2" },
      { id: 3, name: "Name 3", description: "Description 3" },
      { id: 4, name: "Name 4", description: "Description 4" },
      { id: 5, name: "Name 5", description: "Description 5" }
    ]}
  />
}

You can see a interative component in Storybook.

Props

TableControl

| Name | Type | Default | Description | | --------------- | ------------------------------------- | ---------------------------------- | ----------------------------------------------------------------------------- | | header | Header[] | - | Required. List of header values | | sortable | boolean | false | Enable sort action | | onClickHeader | Sort => any | sort => console.log(sort) | Header click function | | sort | Sort | { column: 'id', direction: "ASC" } | Sort direction | | itens | Item[] | - | Required. List of itens displayed in table | | emptyMessage | JSX.Element | string | "No results" | Message displayed when items equals zero | | clikcable | boolean | false | Show clickable action | | onClickItem | Item => any | item => console.log(item) | Item click function | | fillEmptyColumn | boolean | true | Create empty td if item is undefined | | total | number | 0 | Total of itens | | totalPosition | "both" | "top" | "bottom" | "none" | "both" | Total itens number | | pagination | boolean | true | Show pagination | | page | number | 1 | Active page | | limit | number | 25 | Max itens per page, it's minimum value is itens length | | between | number | 4 | Max itens in left and right when page is in center, it's minimum value is 1 | | ellipsis | number | 1 | Number itens after ellipsis, its maximum value is equal (between - 2) | | next | boolean | true | Control if prev and next actions will be displayed | | last | boolean | false | Control if fist and last actions will be displayed | | onClickPage | number => any | page => console.log(page) | Pagination click function | | isLoading | boolean | false | Loading status | | loadingLines | number | limit | Number of lines that will be displayed during loading | | tableProps | object | {} | table properties | | theadProps | object | {} | thead properties | | trProps | object | {} | thead tr properties | | tbodyProps | object | {} | tbody properties |

Types

Sort

| Name | Type | Default | Description | | --------- | --------------- | ------- | ----------------------------- | | column | string | - | Required. Colum name sort | | direction | "ASC" | "DESC" | - | Sort direction |

Header

| Name | Type | Default | Description | | ------- | --------------------- | ------- | ------------------------- | | name | JSX.Element | string | - | Required. Header name | | key | string | - | Required. Key name | | sort | boolean | - | Sortable column | | thProps | object | - | th properties |

Item

| Name | Type | Default | Description | | ------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | | trType | "default" | "blocked" | "clickable" | When used into TableControl, this value is "default" if clickable is false, and "clickable" if clickable is true | Type of item action | | trProps | object | - | tr properties | | [key: string] | any | Td | - | Column value or Td type for a specific view |

Td

| Name | Type | Default | Description | | ------- | ------ | ------- | -------------------------- | | value | any | - | Required. Column value | | tdProps | object | - | td properties |

Changelog

See full changelog in GitHub.

License

MIT