Table

Data table component

Basic Usage

When you use HTML table tags, Podo UI's default styles are automatically applied.

HTML
<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Email</th>
      <th>Role</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John Doe</td>
      <td>[email protected]</td>
      <td>Admin</td>
    </tr>
    <tr>
      <td>Jane Smith</td>
      <td>[email protected]</td>
      <td>User</td>
    </tr>
  </tbody>
</table>
Live Example:
NameEmailRole
John Doe[email protected]Admin
Jane Smith[email protected]User
Mike Johnson[email protected]User

List Style

Adding the .list class applies a hover effect to rows, making them look like a clickable list.

Live Example (hover over the rows):
TitleAuthorDate
Announcement TitleAdmin2024-01-15
Post TitleUser12024-01-14
Another PostUser22024-01-13

Border Style

Adding the .border class displays a bottom border on each cell.

Live Example:
ProductPriceStock
Product A$10050
Product B$20030
Product C$150100

Fill Style

Adding the .fill class applies background color to rows.

Live Example:
NameDepartmentPosition
John DoeDevelopmentTeam Lead
Jane SmithDesignAssociate
Mike JohnsonMarketingManager

Combined Styles

You can combine multiple classes. .list.fill applies both background color and hover effect.

Live Example (.list.fill):
RankNameScore
1Kim XX95
2Lee XX92
3Park XX88

Using in SCSS

component.module.scss
@use 'podo-ui/mixin' as *;

table {
  width: 100%;
  border-collapse: separate;
  border-radius: r(2);
  border: 1px solid color(border);

  // List style (hover effect)
  &.list > tbody > tr {
    &:hover {
      cursor: pointer;
      background-color: color(default-fill);
    }
  }

  // Border style
  &.border > thead,
  &.border > tbody {
    > tr > th,
    > tr > td {
      border-bottom: 1px solid color(border);
    }
  }

  // Fill style
  &.fill > thead,
  &.fill > tbody {
    > tr {
      background-color: color(default-fill);
    }
  }

  // Cell padding
  > thead,
  > tbody {
    > tr {
      > th,
      > td {
        padding: s(3) s(4);
        text-align: left;
      }
    }
  }
}