# @govuk-frederic/object-table

> Renders a table from an object whose properties match provided fields. Also supports transforms for values.

Latest version **0.2.0** (published 2019-02-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @govuk-frederic/object-table
pnpm add @govuk-frederic/object-table
yarn add @govuk-frederic/object-table
bun add @govuk-frederic/object-table
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-02-13 |
| First published | 2018-08-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 85.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Steve Sims |
| Maintainers | loque-, penx, petelockey, steve_sims |

## Links

- npm: https://www.npmjs.com/package/@govuk-frederic/object-table
- Homepage: https://github.com/stevesims/govuk-frederic/tree/master/components/object-table
- npm.io page: https://npm.io/package/@govuk-frederic/object-table

## Dependencies (2)

- [@govuk-frederic/table](https://npm.io/package/@govuk-frederic/table.md) ^0.2.0
- [@govuk-frederic/utils](https://npm.io/package/@govuk-frederic/utils.md) ^0.2.0

## Recent versions

- 0.2.0 (latest) — 2019-02-13
- 0.1.3 — 2018-11-08
- 0.1.2 — 2018-10-23
- 0.1.1 — 2018-08-24
- 0.1.0 — 2018-08-21
- 0.0.6 — 2018-08-13
- 0.0.5 — 2018-08-13
- 0.0.4 — 2018-08-07

## README

ObjectTable
===========

### Import
```js
  import ObjectTable from '@govuk-frederic/object-table';
```
<!-- STORY -->

### Usage

Simple
```jsx
const fields = [
  { key: 'one', heading: 'One' },
  { key: 'two', heading: 'Two' },
  { key: 'three', heading: 'Three' },
  { key: 'four', heading: 'Four' },
];
const object = { one: 'test', two: 'test', three: '', four: null };
const title = ['Heading'];

<ObjectTable fields={fields} object={object} title={title}/>;
```

With skipEmptyValues
```jsx
const fields = [
  { key: 'one', heading: 'One' },
  { key: 'two', heading: 'Two' },
  { key: 'three', heading: 'Three' },
  { key: 'four', heading: 'Four' },
];
const object = { one: 'test', two: 'test', three: '', four: null };
const title = ['Heading'];

<ObjectTable fields={fields} object={object} title={title} skipEmptyValues={false}/>
```

With hideWithNoValues
```jsx
const fields = [
  { key: 'one', heading: 'One' },
  { key: 'two', heading: 'Two' },
];
const object = { };
const title = ['Heading'];

<ObjectTable fields={fields} object={object} title={title} hideWithNoValues />;
```

### Properties
Prop | Required | Default | Type | Description
:--- | :------- | :------ | :--- | :----------
 `defaultTransform` |  | ```(value = '-') => value``` | func | 
 `fields` |  | ```[]``` | arrayOf[object Object] | 
 `hideWithNoValues` |  | ```false``` | bool | 
 `object` |  | ```{}``` | object | 
 `skipEmptyValues` |  | ```false``` | bool | 
 `title` |  | ```null``` | node |

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