Skip to content

CSS: table

.instui-tablethtd용 스타일이 적용된 데이터 테이블로, 선택적 캡션과 호버, 고정 레이아웃, 스택형 카드 레이아웃을 포함합니다.

-layout-stacked의 경우, 순수 CSS만으로 각 열 헤더의 텍스트를 셀 안으로 가져올 수 없으므로 모든 셀에 data-label를 부여하고 스택형 카드에서는 ::before를 통해 이를 표시합니다. 개별 부품은 table.head, table.body, table.row, table.cell, table.col-header, 및 table.row-header 멤버를 참조하세요.

Source: body.css

접근성

테이블에 <caption>로 레이블을 붙이고, 열 헤더는 <th scope="col">로, 행 헤더는 <th scope="row">로 표시하세요. 헤더 행이 시각적으로 숨겨져 있으므로 -layout-stacked에서는 모든 셀에 data-label를 부여하세요.

사용법

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/table.css";

예제들

html
<table class="instui-table -hover">
  <caption>Top-rated films</caption>
  <thead>
    <tr>
      <th scope="col">Rank</th>
      <th scope="col">Title</th>
      <th scope="col">Year</th>
      <th scope="col">Rating</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>The Shawshank Redemption</td>
      <td>1994</td>
      <td>9.3</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>The Godfather</td>
      <td>1972</td>
      <td>9.2</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>The Godfather: Part II</td>
      <td>1974</td>
      <td>9.0</td>
    </tr>
  </tbody>
</table>

구조

text
.instui-table.-hover
  caption
  thead
    th
  tbody
    tr
      td, th[scope="row"]
flowchart TD n0[".instui-table.-hover"]:::cssdoc-root n1("caption"):::cssdoc-part n2("thead"):::cssdoc-part n3("th"):::cssdoc-part n4("tbody"):::cssdoc-part n5("tr"):::cssdoc-part n6("td, th[scope=&quot;row&quot;]"):::cssdoc-part n0 --> n1 n2 --> n3 n0 --> n2 n5 --> n6 n4 --> n5 n0 --> n4 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

수정자

수정자설명
.-hover호버 시 행을 강조합니다. @affects table.row — 행의 호버 경계선을 확보하고 색을 입힙니다.
.-layout-fixed고정 테이블 레이아웃(동일 너비의 열).
.-layout-stacked각 행을 셀별 data-label를 통해 카드처럼 쌓습니다. @affects table.head @affects table.body @affects table.row @affects table.cell @affects table.col-header @affects table.row-header — 각 부분을 블록으로 쌓고 헤더를 적절히 숨기거나 레이블을 붙입니다.

부분

부분설명
.caption선택적 테이블 캡션.

사용된 토큰

Token타입
--instui-component-table-background<color>LightDarklight-dark(#ffffff, #10141A)
--instui-component-table-cell-padding-horizontal<length>0.75rem
--instui-component-table-cell-padding-vertical<length>0.5rem
--instui-component-table-col-header-color<color>LightDarklight-dark(#273540, #F2F4F5)
--instui-component-table-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-table-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-table-font-size<length>1rem
--instui-component-table-head-font-weight<integer>600

하위 컴포넌트