0.2.0 • Published 6 years ago

@govuk-frederic/object-table v0.2.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

ObjectTable

Import

  import ObjectTable from '@govuk-frederic/object-table';

Usage

Simple

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

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

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

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

Properties

PropRequiredDefaultTypeDescription
defaultTransform(value = '-') => valuefunc
fields[]arrayOfobject Object
hideWithNoValuesfalsebool
object{}object
skipEmptyValuesfalsebool
titlenullnode
0.2.0

6 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago