Skip to content

ScTable

ScTable 컴포넌트는 컬럼 그룹, 헤더, 본문을 슬롯으로 제공하며, 고정 헤더(sticky) 및 테이블 높이 조절 기능을 지원합니다.


번호이름업체명E-mail
1Kim(주) 가나다kim@example.com
2Lee(주) HYBElee@example.com
3Park(주) YGpark@example.com
4Song(주) JYPpark@example.com
5Ryu(주) 플레디스park@example.com
6Yi(주) 네이버park@example.com
7Jang(주) 구글코리아park@example.com
8Yang(주) 삼성park@example.com
vue
<sc-table>
  <template #thead>
    <tr>
      <th style="width: 80px; text-align: center">번호</th>
      <th style="width: 130px; text-align: center">이름</th>
      <th style="text-align: center">업체명</th>
      <th style="width: 200px; text-align: center">E-mail</th>
    </tr>
  </template>

  <tr v-for="(item, idx) in items" :key="item.id">
    <td class="text-center">{{ idx + 1 }}</td>
    <td class="text-center">{{ item.name }}</td>
    <td style="text-align: left">{{ item.enterprise }}</td>
    <td style="text-align: left">{{ item.email }}</td>
  </tr>
</sc-table>

<script setup>
import {reactive} from "vue";

const items = reactive([
  { id: '1', name: 'Kim', email: 'kim@example.com', enterprise: '(주) 가나다' },
  { id: '2', name: 'Lee', email: 'lee@example.com', enterprise: '(주) HYBE' },
  { id: '3', name: 'Park', email: 'park@example.com', enterprise: '(주) YG' },
  { id: '4', name: 'Song', email: 'park@example.com', enterprise: '(주) JYP' },
  { id: '5', name: 'Ryu', email: 'park@example.com', enterprise: '(주) 플레디스' },
  { id: '6', name: 'Yi', email: 'park@example.com', enterprise: '(주) 네이버' },
  { id: '7', name: 'Jang', email: 'park@example.com', enterprise: '(주) 구글코리아' },
  { id: '8', name: 'Yang', email: 'park@example.com', enterprise: '(주) 삼성' }
]);
</script>

✨ 사용 예시 모음

▸ 고정 헤더 & 높이 지정 sticky

번호이름업체명E-mail
1Kim(주) 가나다kim@example.com
2Lee(주) HYBElee@example.com
3Park(주) YGpark@example.com
4Song(주) JYPpark@example.com
5Ryu(주) 플레디스park@example.com
6Yi(주) 네이버park@example.com
7Jang(주) 구글코리아park@example.com
8Yang(주) 삼성park@example.com
vue
<sc-table sticky height="200">
  <template #thead>
    <tr>
      <th style="width: 80px">번호</th>
      <th style="width: 130px">이름</th>
      <th>업체명</th>
      <th style="width: 200px">E-mail</th>
    </tr>
  </template>

  <tr v-for="(item, idx) in items" :key="item.id">
    <td class="text-center">{{ idx + 1 }}</td>
    <td class="text-center">{{ item.name }}</td>
    <td>{{ item.enterprise }}</td>
    <td>{{ item.email }}</td>
  </tr>
</sc-table>

🛠️ Props

이름타입기본값설명
typeString'default'테이블 스타일 타입 (현재 'default'만 지원)
stickyBooleanfalse헤더를 상단에 고정(sticky)
heightNumber | String''테이블 컨테이너 높이(px). 지정 시 스크롤 활성화

📤 이벤트 (Emits)

ScTable는 커스텀 이벤트를 방출하지 않습니다.


🔳 슬롯 (Slots)

이름설명
colgroup<colgroup> 엘리먼트로 컬럼 너비를 정의합니다
thead<thead> 엘리먼트로 테이블 헤더를 작성합니다
default<tbody> 내 기본 행(Row) 마크업을 작성합니다
tbody<tbody> 엘리먼트를 직접 정의하며, 기본 본문은 숨김 처리됩니다

🎨 스타일 클래스

클래스명설명
.sc-table컴포넌트 최상위 <table> 클래스
.sc-table-colgroup<colgroup> 래퍼
.sc-table-thead<thead> 래퍼
.header-stickysticky 모드 시 적용되는 헤더 고정 클래스
.sc-table-tbody기본 <tbody> 래퍼