<table class="table">
    <thead class="table__head">
        <tr class="table__head-row">
            <th class="table__head-cell" scope="col">Lorem ipsum</th>
            <th class="table__head-cell" scope="col">Dolor sit amet</th>
            <th class="table__head-cell" scope="col">Lorem ipsum</th>
        </tr>
    </thead>

    <tbody class="table__body">
        <tr class="table__row">

            <td class="table__cell">Lorem ipsum</td>

            <td class="table__cell"><a class="link link--internal" href="#"><span class="link__text u-underline">Lorem ipsum</span></a><br><i>Lorem ipsum</i></td>

            <td class="table__cell">Lorem ipsum</td>
        </tr>
        <tr class="table__row">

            <td class="table__cell">Lorem ipsum</td>

            <td class="table__cell"><a class="link link--internal" href="#"><span class="link__text u-underline">Lorem ipsum</span></a><br><i>Lorem ipsum</i></td>

            <td class="table__cell">Lorem ipsum</td>
        </tr>
        <tr class="table__row">

            <td class="table__cell">Lorem ipsum</td>

            <td class="table__cell"><a class="link link--internal" href="#"><span class="link__text u-underline">Lorem ipsum</span></a><br><i>Lorem ipsum</i></td>

            <td class="table__cell">Lorem ipsum</td>
        </tr>
        <tr class="table__row">

            <td class="table__cell">Lorem ipsum</td>

            <td class="table__cell"><a class="link link--internal" href="#"><span class="link__text u-underline">Lorem ipsum</span></a><br><i>Lorem ipsum</i></td>

            <td class="table__cell">Lorem ipsum</td>
        </tr>
        <tr class="table__row">

            <td class="table__cell">Lorem ipsum</td>

            <td class="table__cell"><a class="link link--internal" href="#"><span class="link__text u-underline">Lorem ipsum</span></a><br><i>Lorem ipsum</i></td>

            <td class="table__cell">Lorem ipsum</td>
        </tr>
    </tbody>

</table>
<table {{ html_attributes({
  id: id ?? false,
  class: 'table',
}, attrs ?? {}) }}>
  {% if header|default %}
    <thead class="table__head">
      {% set header = header[0] is not iterable ? [header] : header %}
      {% for row in header %}
        <tr class="table__head-row">
          {% for cell in row %}
            <th {{ html_attributes({
              class: 'table__head-cell',
              align: cell.align ?? false,
              width: cell.width ?? false,
              scope: cell.scope ?? 'col',
              colspan: cell.colspan ?? false,
              rowspan: cell.rowspan ?? false,
              style: cell.style ?? false,
            }) }}>
              {{- (cell.text ?? cell) | componentize -}}
            </th>
          {% endfor %}
        </tr>
      {% endfor %}
    </thead>
  {% endif %}

  <tbody class="table__body">
    {% for row in rows %}
      <tr class="table__row">
        {% for cell in row %}
          {% set tag = cell.headcell|default ? 'th' : 'td' %}

          <{{ tag }} {{ html_attributes({
            class: 'table__cell',
            scope: cell.scope ?? (tag == 'th' ? 'row' : false),
            align: cell.align ?? false,
            colspan: cell.colspan ?? false,
            rowspan: cell.rowspan ?? false,
            style: cell.style ?? false,
          }) }}>
            {{- (cell.text ?? cell) | componentize -}}
          </{{ tag }}>
        {% endfor %}
      </tr>
    {% endfor %}
  </tbody>

  {% if footer|default %}
    <tfoot class="table__foot">
      {% set footer = footer[0] is not iterable ? [footer] : footer %}
      {% for row in footer %}
        <tr class="table__foot-row">
          {% for cell in row %}
            <th {{ html_attributes({
              class: 'table__foot-cell',
              align: cell.align ?? false,
              width: cell.width ?? false,
              scope: cell.scope ?? 'col',
              colspan: cell.colspan ?? false,
              rowspan: cell.rowspan ?? false,
              style: cell.style ?? false,
            }) }}>
              {{- (cell.text ?? cell) | componentize -}}
            </th>
          {% endfor %}
        </tr>
      {% endfor %}
    </thead>
  {% endif %}

  {%- if caption|default %}
    <caption class="table__caption">
      {{- caption | componentize -}}
    </caption>
  {% endif %}
</table>
{
  "header": [
    [
      {
        "text": "Lorem ipsum"
      },
      {
        "text": "Dolor sit amet"
      },
      {
        "text": "Lorem ipsum"
      }
    ]
  ],
  "rows": [
    [
      "Lorem ipsum",
      "<a href=\"#\">Lorem ipsum</a><br /><i>Lorem ipsum</i>",
      "Lorem ipsum"
    ],
    [
      "Lorem ipsum",
      "<a href=\"#\">Lorem ipsum</a><br /><i>Lorem ipsum</i>",
      "Lorem ipsum"
    ],
    [
      "Lorem ipsum",
      "<a href=\"#\">Lorem ipsum</a><br /><i>Lorem ipsum</i>",
      "Lorem ipsum"
    ],
    [
      "Lorem ipsum",
      "<a href=\"#\">Lorem ipsum</a><br /><i>Lorem ipsum</i>",
      "Lorem ipsum"
    ],
    [
      "Lorem ipsum",
      "<a href=\"#\">Lorem ipsum</a><br /><i>Lorem ipsum</i>",
      "Lorem ipsum"
    ]
  ]
}
  • Content:
    :root {
      --table-color: currentColor;
      --table-caption-color: currentColor;
      --table-border-color: var(--color-cyan-light);
    }
    
    .table {
      border-collapse: collapse;
      color: var(--table-color);
      font-size: 1.6rem;
      inline-size: 100%;
      line-height: var(--line-height-body);
    }
    
    .table__head-row,
    .table__foot-row {
      background-color: var(--table-border-color);
      color: var(--table-header-color);
    }
    
    .table__head-cell,
    .table__foot-cell {
      font-size: 1.8rem;
      font-weight: 600;
    }
    
    .table__head-cell,
    .table__cell,
    .table__foot-cell {
      border: 2px solid var(--table-border-color);
      hyphens: auto;
      line-height: var(--line-height-body);
      padding: 1rem 2rem;
      text-align: start;
      vertical-align: text-top;
    }
    
    .table__caption {
      caption-side: bottom;
      color: var(--table-caption-color);
      font-family: var(--font-headline);
      font-size: 1.4rem;
      line-height: var(--line-height-body);
      margin-block-start: 1rem;
      text-align: start;
    }
    
  • URL: /components/raw/table/table.scss
  • Filesystem Path: src/components/1-atoms/table/table.scss
  • Size: 947 Bytes

No notes defined.