# react-styled-table

> - Run Storybook to test UI

Latest version **1.1.1** (published 2023-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-styled-table
pnpm add react-styled-table
yarn add react-styled-table
bun add react-styled-table
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-04-02 |
| First published | 2023-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 83.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ruchika Gamage |
| Maintainers | ruchika89 |

## Links

- npm: https://www.npmjs.com/package/react-styled-table
- Repository: https://github.com/ruchika9999/styled-react-table
- Homepage: https://github.com/ruchika9999/styled-react-table#readme
- Issues: https://github.com/ruchika9999/styled-react-table/issues
- npm.io page: https://npm.io/package/react-styled-table

## Dependencies (3)

- [styled-components](https://npm.io/package/styled-components.md) ^5.3.9
- [react-resize-detector](https://npm.io/package/react-resize-detector.md) ^8.0.4
- [@react-hook/window-size](https://npm.io/package/@react-hook/window-size.md) ^3.1.1

## Recent versions

- 1.1.1 (latest) — 2023-04-02
- 1.1.0 — 2023-03-23
- 1.0.9 — 2023-03-23
- 1.0.8 — 2023-03-23
- 1.0.7 — 2023-03-23
- 1.0.6 — 2023-03-23
- 1.0.5 — 2023-03-22
- 1.0.4 — 2023-03-22
- 1.0.3 — 2023-03-22
- 1.0.2 — 2023-03-22
- 1.0.1 — 2023-03-22
- 1.0.0 — 2023-03-22

## README

- Run Storybook to test UI

```bash
npm run storybook
```


- Example Code

```bash
import { Table, Tbody, Td, Th, Thead, Tr, TextAlign } from "styled-react-table";

const theme = {
  tableStyle: {
    breakpoints: {
      mobile: "@media only screen and (max-width: 768px)",
      tablet: "@media only screen and (max-width: 992px)",
      desktop: "@media only screen and (min-width: 1200px)"
    },
    colors: {
      primary: "#7256f8",
      secondary: "#EFEDFD",
      dark: "#000000",
      light: "#FFFFFF",

      primaryColorScaleOne: "#EFEDFD",
      primaryColorScaleTwo: "#DEDAFA",

      fontColor: "#000000",

      grayScaleLevelOne: "#f7f7f7",
      grayScaleLevelTwo: "#a8a8a8",

      tableHeader: "#f7f7f7",
      tableBorderColor: "#e1e1e1"
    },

    fontSize: {
      mobile: "16px",
      tablet: "18px",
      desktop: "20px"
    }
  }
};

export interface Operations {
  id: string;
  operator: string;
  headsetDisplay: string;
  availability: string;
}

export interface TablePropsType {
  tableData: Operations[];
};

const headers = [
  {
    name: "Operator",
    textAlign: TextAlign.START
  },
  {
    name: "Headset Display",
    textAlign: TextAlign.START
  },
  {
    name: "3G Availability",
    textAlign: TextAlign.START
  }
];


const App: React.FC<TablePropsType> = (props) => {
  const { tableData } = props;

  return (
    <Table theme={theme}>
      <Thead>
        <Tr>
          {headers.map((header, index) => (
            <Th key={index} textAlign={header.textAlign}>
              {header.name}
            </Th>
          ))}
        </Tr>
      </Thead>
      <Tbody>
        {tableData?.map((company: Operations) => (
          <Tr key={company.id} id={company.id}>
            <Td firstColumn>{company.operator}</Td>
            <Td>{company.headsetDisplay}</Td>
            <Td lastColumn>{company.availability}</Td>
          </Tr>
        ))}
      </Tbody>
    </Table>
  );
};

export default App;

```

[Demo](https://codesandbox.io/p/sandbox/table-component-ruchika-gamage-forked-54me8l?file=%2Fsrc%2Fcomponent%2FTables%2FTableWithSorting.tsx)

---
_Source: https://npm.io/package/react-styled-table · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
