본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)29k · #9813

getting-started

하는 일

이 스킬은 TanStack Table을 사용해 Lit 웹 컴포넌트 안에 표를 만드는 방법을 보여 줍니다. Lit으로 재사용 가능한 컴포넌트를 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓항목 목록을 표로 보여 주는 Lit 웹 컴포넌트를 만들 때.
  • ✓컴포넌트의 데이터가 바뀔 때 표가 다시 렌더링되어야 할 때.
  • ✓같은 표 설정을 여러 곳에서 반복하는 Lit 앱에서 재사용 가능한 버전을 원하는 경우.

스킬 링크

https://github.com/TanStack/table/blob/main/packages/lit-table/skills/getting-started/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/TanStack/table/blob/main/packages/lit-table/skills/getting-started/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“사람 목록을 보여 주는 Lit 웹 컴포넌트를 만들고 있어요. 표는 어떻게 설정하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

표 컨트롤러가 컴포넌트에 연결되는 방식, 렌더링 중에 표를 만드는 방법, FlexRender 도우미로 헤더와 행을 보여 주는 방법을 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Load intent load @tanstack/table-core#core first for the headless model, stable inputs, and column inference.

Setup

import { LitElement, html } from 'lit'
import { customElement, state } from 'lit/decorators.js'
import { repeat } from 'lit/directives/repeat.js'
import {
  FlexRender,
  TableController,
  createColumnHelper,
  tableFeatures,
} from '@tanstack/lit-table'

type Person = { id: string; name: string }

const features = tableFeatures({})
const columnHelper = createColumnHelper<typeof features, Person>()
const columns = columnHelper.columns([
  columnHelper.accessor('name', { header: 'Name' }),
])

@customElement('people-table')
export class PeopleTable extends LitElement {
  @state() private people: Array<Person> = [{ id: '1', name: 'Ada' }]
  private tableController = new TableController<typeof features, Person>(this)

  protected render() {
    const table = this.tableController.table({
      features,
      columns,
      data: this.people,
      getRowId: (row) => row.id,
    })

    return html`<table>
      <thead>
        ${repeat(
          table.getHeaderGroups(),
          (group) => group.id,
          (group) =>
            html`<tr>
              ${repeat(
                group.headers,
                (header) => header.id,
                (header) =>
                  html`<th>
                    ${header.isPlaceholder ? null : FlexRender({ header })}
                  </th>`,
              )}
            </tr>`,
        )}
      </thead>
      <tbody>
        ${repeat(
          table.getRowModel().rows,
          (row) => row.id,
          (row) =>
            html`<tr>
              ${repeat(
                row.getAllCells(),
                (cell) => cell.id,
                (cell) => html`<td>${FlexRender({ cell })}</td>`,
              )}
            </tr>`,
        )}
      </tbody>
    </table>`
  }
}

Construction and rendering

Keep one TableController as a host field. V9 takes only the host in its constructor; pass current options to controller.table(...) during every render. Recreating the controller repeats lifecycle and subscription work.

Keep features, columns, and data stable across host updates. Use FlexRender({ cell }), FlexRender({ header }), or FlexRender({ footer }) in Lit templates. The application owns semantic markup, accessibility, widths, and sticky positioning.

The controller selects all registered state by default. Narrow selected state only when host update cost requires it; use table-state for selectors and template subscriptions.

Read for the task

  • When adding or configuring optional features, load intent load @tanstack/table-core#table-features and read only references for the requested behavior.
  • For state ownership or reactive reads, read table-state.
  • When tables share features, defaults, or reusable UI, read create-table-hook.
  • When virtualizing rows or columns, read with-tanstack-virtual.
  • When upgrading v8 code, read migrate-v8-to-v9.

API discovery

Inspect node_modules/@tanstack/lit-table/dist/index.d.ts, then TableController.d.ts, flexRender.d.ts, or the relevant exported declaration. Core feature APIs are in node_modules/@tanstack/table-core/dist/features/.

자주 묻는 질문

표 컨트롤러는 무엇을 하나요?

컴포넌트를 위해 표를 만들고, 표가 사용하는 상태가 바뀌면 컴포넌트에 업데이트를 요청합니다.

Lit 템플릿 작동 방식을 알아야 하나요?

기본 지식이 도움이 됩니다. 예시는 Lit의 html 템플릿과 repeat 지시어를 사용하기 때문입니다.

Lit 전용인가요?

네, TanStack Table v9의 Lit 버전을 다룹니다.

상세 정보

작성자의 원본 설명

Create and render Table v9 with the lit adapter. Route reusable createTableHook components, Virtual integration, and framework setup; use table-state for reactive ownership.

repo: TanStack/table

인기도

GitHub 스타
29k
순위
#9813
라이선스
MIT
업데이트
2026. 10. 21.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬