PropsTable

Table components designed to display props

Example:


Prop Name

Type

Default

Required

Description

description

String

' '

optional

card description

children

JSX

null

optional

Custom JSX content

linkURL

String

' '

optional

link destination URL

external

Boolean

false

conditional

when a link is external, pass {true}

linkClass

Class

null

conditional

if "linkUrl" is given and refers to an internal link, pass the "Link" class you are using, eg. imported from "react-router-dom" or "gatsby" or "next/link"



Code to reproduce the example above:



1import { PropsTable } from '@tempoplatform/tpds/components/table/PropsTable'
2
3<PropsTable
4  title='Standard Props Table Example'
5  items={[
6    {
7      propName: 'children',
8      type: 'JSX',
9      default: 'null',
10      required: 'optional',
11      description: 'Custom JSX content'
12    },
13    {
14      propName: 'linkURL',
15      type: 'String',
16      default: "' '",
17      required: 'optional',
18      description: 'link destination URL'
19    },
20    {
21      propName: 'external',
22      type: 'Boolean',
23      default: 'false',
24      required: 'conditional',
25      description: 'when a link is external, pass {true}'
26    },
27    {
28      propName: 'linkClass',
29      type: 'Class',
30      default: 'null',
31      required: 'conditional',
32      description: 'if "linkUrl" is given and refers to an internal link, pass the "Link" class you are using, eg. imported from "react-router-dom" or "gatsby" or "next/link"'
33    }
34  ]}
35/>






Customization

The next example shows how to:


- Set custom header names

- Set custom property names of the given entries

- Skip one of the columns to have only 4 total



Ingredient

Amount

Cook time

Notes

Chocolate

100

20

Must be Swiss made.

Egg

20

15

Scrambled to perfection.

Chantilly

5

7

Add on top only at the end.

Cherry

3

Don't cook

Place on top of the chantilly to finalize.



1import { PropsTable } from '@tempoplatform/tpds/components/table/PropsTable'
2
3<PropsTable
4  title='Custom example'
5  skipColumn4
6  col1Name="Ingredient"
7  col2Name="Amount"
8  col3Name="Cook time"
9  col5Name="Notes"
10  param1Name="name"
11  param2Name="grams"
12  param3Name="minutes"
13  param5Name="notes"
14  items={[
15    {
16      name: "Chocolate",
17      grams: '100',
18      minutes: '20',
19      notes: 'Must be Swiss made.'
20    },
21    {
22      name: 'Egg',
23      grams: '20',
24      minutes: "15",
25      notes: 'Scrambled to perfection.'
26    },
27    {
28      name: 'Chantilly',
29      grams: '5',
30      minutes: '7',
31      notes: 'Add on top only at the end.'
32    },
33    {
34      name: 'Cherry',
35      grams: '3',
36      minutes: "Don't cook",
37      notes: 'Place on top of the chantilly to finalize.'
38    }
39  ]}
40/>






Prop Name

Type

Default

Required

Description

items

Array

true

required

Array of objects with the properties as shown in the example code.

omitTitle

Boolean

false

no

Pass "true" to omit the title header.

col1Name

String

Prop Name

optional

Set to customise the name of the first header label

col2Name

String

Type

optional

Set to customise the name of the second header label

col3Name

String

Default

optional

Set to customise the name of the third header label

col4Name

String

Required

optional

Set to customise the name of the fourth header label

col5Name

String

Description

optional

Set to customise the name of the fifth header label

param1Name

String

propName

optional

Set to customise the name of the first property name

param2Name

String

type

optional

Set to customise the name of the second property name

param3Name

String

default

optional

Set to customise the name of the third property name

param4Name

String

required

optional

Set to customise the name of the fourth property name

param5Name

String

description

optional

Set to customise the name of the fifth property name

skipColumn2

Boolean

false

optional

Set 'true' to skip the second column

skipColumn3

Boolean

false

optional

Set 'true' to skip the third column

skipColum4

Boolean

false

optional

Set 'true' to skip the fourth column