PropsTable

Table components designed to display to prop lists

Handy component to display props for a component.



Allows customization for different purposes:


- Header titles can be customised

- Items' property names can be customised

- Up to 3 columns can be skipped






Standard Props Table Example

Prop Name

Type

Default

Required

Description

title

String

"Props"

optional

The title of the component, shown as a header.

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 '@hummingbot/hbui/components/table/PropsTable'
2
3<PropsTable
4  title='Standard Props Table Example'
5  items={[
6    {
7      propName: "title",
8      type: 'String',
9      default: '"Props"',
10      required: 'optional',
11      description: 'The title of the component, shown as a header.'
12    },
13    {
14      propName: 'description',
15      type: 'String',
16      default: "' '",
17      required: 'optional',
18      description: 'card description'
19    },
20    {
21      propName: 'children',
22      type: 'JSX',
23      default: 'null',
24      required: 'optional',
25      description: 'Custom JSX content'
26    },
27    {
28      propName: 'linkURL',
29      type: 'String',
30      default: "' '",
31      required: 'optional',
32      description: 'link destination URL'
33    },
34    {
35      propName: 'external',
36      type: 'Boolean',
37      default: 'false',
38      required: 'conditional',
39      description: 'when a link is external, pass {true}'
40    },
41    {
42      propName: 'linkClass',
43      type: 'Class',
44      default: 'null',
45      required: 'conditional',
46      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"'
47    }
48  ]}
49/>






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



Custom example

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 '@hummingbot/hbui/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/>






PropsTable Props

Prop Name

Type

Default

Required

Description

title

String

Props

optional

The table's title header

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