0.13.3 • Published 4 months ago

@bolttech/molecules-table v0.13.3

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Table Component

The Table component is a React component that provides a sortable table structure. It includes components for the table head, table head column, table body, table row, and table column.

Installation

To use the Table component, you need to have the @bolttech/atoms-icon package installed:

npm install @bolttech/frontend-foundations @bolttech/molecules-table

or

yarn add @bolttech/frontend-foundations @bolttech/molecules-table

Usage

You can use the Table component by importing it and including it in your JSX. Here's an example:

import React from 'react';
import { Table } from '@bolttech/molecules-table';
import { bolttechTheme, BolttechThemeProvider } from '@bolttech/frontend-foundations'; // Adjust the path to your component

function App() {
  const handleSort = (sortList) => {
    console.log('Sort List:', sortList);
    // Perform sorting logic here
  };

  return (
    <BolttechThemeProvider theme={bolttechTheme}>
      {/* Table component */}
      <Table onSort={handleSort} dataTestId="example">
        <TableHead>
          <TableHeadColumn sortable={true}>Column 1</TableHeadColumn>
          <TableHeadColumn sortable={true}>Column 2</TableHeadColumn>
          <TableHeadColumn>Column 3</TableHeadColumn>
        </TableHead>
        <TableBody>
          <TableRow>
            <TableColumn>Data 1</TableColumn>
            <TableColumn>Data 2</TableColumn>
            <TableColumn>Data 3</TableColumn>
          </TableRow>
          {/* Add more rows as needed */}
        </TableBody>
      </Table>
    </BolttechThemeProvider>
  );
}

export default App;

Props

The Table component accepts the following props: | Prop | Type | Description | | ------------ | ---------- | ----------------------------------------- | | dataTestId | string | The data-testid attribute for testing. | | onSort | function | The function to be called when sorting. | | allowMultipleSort | boolean| Represent if the table should allow sorting by multiple columns | | children | ReactNode| The child components of the table. |

Each TableHeadColumn component also accepts the following prop:

PropTypeDescription
sortablebooleanDetermines if the column is sortable or not.

Functionality

The Table component provides the following functionality:

  • Table Structure: Renders a table structure with table head, table head columns, table body, table rows, and table columns.
  • Sorting: Allows users to sort columns in ascending, descending, or unsorted order.
  • Customizable Content: Allows you to customize the column headers and table data.

Contribution

Contributions to the Table component are welcomed. If you encounter issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the component's Bitbucket repository.

0.13.3

4 months ago

0.13.1

6 months ago

0.13.2

6 months ago

0.11.0

7 months ago

0.10.1

7 months ago

0.12.0

6 months ago

0.13.0

6 months ago

0.12.1

6 months ago

0.10.0

8 months ago

0.0.1

7 months ago

0.3.0

10 months ago

0.9.0

9 months ago

0.8.0

9 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.7.0

9 months ago

0.6.0

10 months ago

0.2.4

10 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.6

11 months ago

0.1.5

12 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago