# ContentTable

The ContentTable component provides a definition list<dl> with two columns to display key-value pairs.

Example

Storyblok

This component exists in Storyblok too. Uses Storyblok plugin "table" (Apps > Table -> install).

blok: {
  // required
  table: {
    plugin: 'translateable-table',
    thead: [
      {
        _uid: '',
        value: 'Head1'
      },
      {
        _uid: '',
        value: 'Head2'
      }
    ],
    tbody: [
      {
        _uid: '',
        component: '_table_row',
        body: [
          {
            _uid: '',
            component: '_table_col',
            value: 'one'
          },
          {
            _uid: '',
            component: '_table_col',
            value: 'two'
          }
        ]
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

# Dependencies

None.

# Props

Name Type Required Default Description
table Object true - Check the structure above.

# Variants

None.

# Example

Good

<!-- Use the prop to pass the content to the component. -->
<ContentTable
  :table="{
    thead: [
      {
        value: 'Head1'
      },
      {
        value: 'Head2'
      }
    ],
    tbody: [
      {
        _uid: '1234asdf',
        body: [
          {
            _uid: 'asdf1234',
            value: 'one'
          },
          {
            _uid: 'asdf1235',
            value: 'two'
          }
        ]
      }
    ]
  }"
/>

<!-- Pass data from an object -->
<ContentTable :table="blok.table" />
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Bad

<!-- Use the props for passing the content.
  This Component does not have a slot. -->
<ContentTable>
  <tr>
    <td>Column 1</td>
    <td>Column 2</td>
  </tr>
  <tr>
    <td>Column 1</td>
    <td>Column 2</td>
  </tr>
</ContentTable>
1
2
3
4
5
6
7
8
9
10
11
12