# mui-editable-table-component

> A react component for editabl table

Latest version **1.1.0** (published 2019-05-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install mui-editable-table-component
pnpm add mui-editable-table-component
yarn add mui-editable-table-component
bun add mui-editable-table-component
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-05-11 |
| First published | 2019-05-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 64.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | yash rathore |
| Maintainers | contactyash |
| Keywords | editable, table, materialui, react |

## Links

- npm: https://www.npmjs.com/package/mui-editable-table-component
- Repository: https://github.com/contactyash/mui-editable-table-component
- Homepage: https://github.com/contactyash/mui-editable-table-component#readme
- Issues: https://github.com/contactyash/mui-editable-table-component/issues
- npm.io page: https://npm.io/package/mui-editable-table-component

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-05-11
- 1.0.10 — 2019-05-11
- 1.0.9 — 2019-05-11
- 1.0.7 — 2019-05-11
- 1.0.6 — 2019-05-11
- 1.0.5 — 2019-05-11
- 1.0.4 — 2019-05-10
- 1.0.3 — 2019-05-10
- 1.0.2 — 2019-05-10
- 1.0.1 — 2019-05-10
- 1.0.0 — 2019-05-10

## README

# mui-editable-table-component

| props           | type             | description                                                                                                                                                                                                                                                                                                                                   |
| --------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| defaultData     | array of objects | rows of data already added                                                                                                                                                                                                                                                                                                                    |
| fieldsArr       | array of objects | each obj with **validation** key a function which is called with event and its columns data,here check validation return false to show error,**label** for table head(required),name(required),you can give **type**(optional) select,if you give select type then **selectMessage**,**options** are required,**error** message to show error |
| getData         | function         | this function is called on save and delete to provide all data to parent                                                                                                                                                                                                                                                                      |
| tableName       | string           | name of table,default is mytable                                                                                                                                                                                                                                                                                                              |
| initWithoutHead | boolean          | if true only show add button and no heads,if no data available                                                                                                                                                                                                                                                                                |
| addRowBtnText   | string           | button text for add Row Button                                                                                                                                                                                                                                                                                                                |

---

Example and source code available at [codesandbox](https://codesandbox.io/s/oj4x9rxl89)

```

const fieldsArr = const fieldsArr = [
  {
    label: "Name of UBO", (required)
    name: "name", (required)
    validation: (e,coloumnData) => {
      const name = e.target.value;
      if (name.length > 6) {
        return false;
      } else {
        return true;
      }
    },
    error: "Enter a good name"
  },
 {
    label: "RelationShip",
    selectMessage: "Select",
    name: "relationship",
    type: "select",
    options: [
      { label: "None", value: "" },
      { label: "Share Holder", value: "shareholder" },
      { label: "Director", value: "director" }
    ],
    validation: (e, a) => {
      const name = e.target.value;
      if (name.length > 6) {
        return false;
      } else {
        return true;
      }
    },
    error: "go home kid"
  },
];

 <EditableTable
  defaultData={[]}
  giveToParent={getData}
  fieldsArr={fieldsArr}
/>
```

## CSS Usage

To apply css you have below keys available for each correspondence tag element. Also if you want to use old css classnames,then these keys with sufix \_tableName are also available.

```
import EditableTable from 'mui-editable-table-component'

 const styles = () => ({
  table: {},
  tableHead: {},
  tableHeadRow: {},
  tableHeadCell: {},
  tableBody: {},
  tableBodyRow: {},
  tableBodyCell: {},
  inputWrapperDiv: {},
  input: {},
  error: {},
  selectFormControl: {},
  selectInputLabel: {},
  select: {},
  selectMenuItem: {},
  saveBtn: {},
  cancelBtn: {},
  addBtn: {},
  deleteBtn: {},
  editBtn: {}
});

for plain old css(if table is mytable)

.table_mytable{
background:red;
}
.tableHead_mytable{
colour:blue;
}

export default withStyles(styles)(EditableTable);


```

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