Table
행과 열로 데이터를 비교하고 정렬·필터·선택을 제공합니다.
사용 가이드
#가벼운 목록의 조회·정렬·선택에 사용합니다. 대량 데이터의 가상화가 필요하면 Grid를 사용하세요.
열과 데이터 연결
columns에key·label을,rows에 JavaScript 배열을 전달합니다.행 식별자 지정
rowKey에 변하지 않는 고유한 키를 지정하세요.필요한 조작 켜기
열별
sortable·filterable과selectionMode의none·single·multiple을 선택하고 이벤트를 앱 상태에 연결합니다.
예제
#기능별 예제
#34개 주제에서 필요한 기능을 선택하세요. 속성 설정, 메서드 호출, 이벤트 결과와 슬롯 구성을 실행 화면과 코드로 확인할 수 있습니다.
일치하는 기능이 없습니다.
API reference
#이름에 마우스를 올리거나 키보드로 선택하면 적용 코드를 확인할 수 있습니다. 터치 화면에서는 이름을 누르세요.
<sy-table>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
SyTableColumn[] | string | [] | key·label·sortable·filterable 등의 열 정의 배열입니다. 객체·배열 값은 JavaScript 프로퍼티로 전달합니다. | |
SyTableRow[] | string | [] | 행 데이터 배열입니다. 각 행의 키가 고유해야 합니다. 객체·배열 값은 JavaScript 프로퍼티로 전달합니다. | |
SyTableRow[] | string | '' | Alias of `rows`; takes precedence when set so consumers can bind data without choosing a name. 객체·배열 값은 JavaScript 프로퍼티로 전달합니다. | |
string | 'id' | Field name used to identify a row uniquely. Spec name: `row-key`. | |
'none' | 'single' | 'multiple' | 'none' | Selection mode. Spec name: `selection-mode`. | |
'none' | 'horizontal' | 'vertical' | 'full' | 'outline' | 'horizontal' | 행·열·외곽 테두리를 표시하는 방식입니다. | |
'solid' | 'dashed' | 'dotted' | 'solid' | Border line style for every divider in the table — outer frame, column dividers (`variant: 'vertical' | 'full'`), and row dividers (`variant: 'horizontal' | 'full'`). Width and colour stay on the design-system tokens; only the dash pattern changes. Spec name: `line-style`. | |
boolean | false | Alternate row background colour. | |
boolean | false | Reduce row height. | |
boolean | true | Pin the header inside the scroll container. Spec name: `sticky-header`. | |
boolean | false | Hide the column header (`<thead>`). Use when the table has columns but the visual design omits the header — e.g. the row-header pattern where the leftmost column already identifies each row, or when the header lives outside the table. Spec name: `hide-header`. | |
boolean | false | Render the first data column as a row header (`<th scope="row">`). Useful for grids where the leftmost column identifies the row (think spreadsheet row labels). Spec name: `row-header`. | |
boolean | true | Pin the row header to the left edge while the body scrolls horizontally. Has no effect unless `row-header` is also set. Spec name: `sticky-row-header`. | |
string | 'No data' | Empty-state text when no rows are present. Spec name: `empty-text`. | |
string | '' | Currently sorted column key. Spec name: `sort-key`. | |
SyTableSortDirection | 'none' | Active sort direction. Spec name: `sort-direction`. | |
string[] | string | [] | 현재 선택한 행 키 배열입니다. 객체·배열 값은 JavaScript 프로퍼티로 전달합니다. | |
boolean | false | 처리 중임을 표시합니다. | |
string | '' | Optional accessible label applied to the `<table>` element. | |
boolean | false | Allow the user to drag a column's right edge to resize it. The new width is committed on pointer-up and a `columnResized` event fires. Resize state is keyed by `column.key` so initial `column.width` and explicit changes coexist. Drag handles appear on every cell (header + body) so the user can grab the column edge from any row. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<{ key: string; direction: SyTableSortDirection }> | 이벤트의 detail에서 결과를 확인하세요. | |
CustomEvent<{ selectedKeys: string[]; selectedRows: SyTableRow[] }> | 이벤트의 detail에서 결과를 확인하세요. | |
CustomEvent<{ row: SyTableRow; index: number; key: string; originalEvent: MouseEvent | KeyboardEvent }> | 이벤트의 detail에서 결과를 확인하세요. | |
CustomEvent<{ key: string; value: string; filters: Record<string, string> }> | Fires after a column filter is applied or cleared. `value` is the committed text (empty string = filter cleared); `filters` is a snapshot of every active filter so consumers can serialize the entire filter set. | |
CustomEvent<{ key: string; width: number; widths: Record<string, number> }> | Fires when a resize gesture commits the new width on pointer-up. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<SyTableRow[]> | 선택된 행 데이터 배열을 반환합니다. | |
Promise<void> | 모든 행 선택을 해제합니다. | |
Promise<void> | 지정한 키의 행을 선택합니다. | |
Promise<void> | 열의 정렬 방향을 설정합니다. | |
Promise<void> | 로딩 표시를 켜거나 끕니다. | |
Promise<void> | 표의 스크롤을 맨 위로 이동합니다. | |
Promise<void> | Programmatically set or clear a column filter. Pass an empty string to clear. Bypasses the popover UI so consumers can drive filters from external controls (saved views, query string, etc.). Fires `filterChanged`. | |
Promise<Record<string, string>> | Returns a snapshot of every active filter keyed by column key. | |
Promise<void> | Clears every active filter at once. Fires `filterChanged` with `key: ''`. | |
Promise<void> | Programmatically set the rendered width (in pixels) of a column. Pass `0` to revert to the column's intrinsic width. |
Slots
| Slot | Description |
|---|---|
| 컴포넌트의 본문 또는 자식 항목입니다. |