Pular para o conteúdo
Skillpedia
Sites e telas (frontend)29 mil · #9813

getting-started

O que ela faz

Esta habilidade mostra como criar uma tabela dentro de um componente web Lit usando o TanStack Table. Serve para desenvolvedores que criam componentes reutilizáveis com o Lit.

Quando usar

  • ✓Quando você está criando um componente web Lit que mostra uma lista de itens em uma tabela.
  • ✓Quando você precisa que a tabela seja renderizada de novo quando os dados do componente mudam.
  • ✓Quando seu aplicativo Lit repete a mesma configuração de tabela em vários lugares e você quer uma versão reutilizável.

Link da skill

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

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/TanStack/table/blob/main/packages/lit-table/skills/getting-started/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Estou criando um componente web Lit que mostra uma lista de pessoas em uma tabela. Como configuro isso?”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

Ela explica como um controlador de tabela é associado ao componente, como cria a tabela durante a renderização e como exibe os cabeçalhos e as linhas com o auxiliar FlexRender.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do 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/.

Perguntas frequentes

O que o controlador de tabela faz?

Ele cria a tabela para o componente e pede que o componente seja atualizado quando o estado da tabela que ele usa mudar.

Preciso saber como os templates do Lit funcionam?

Conhecimento básico de Lit ajuda, porque os exemplos usam o template html e a diretiva repeat do Lit.

Isso serve só para o Lit?

Sim. Cobre a versão Lit do TanStack Table v9.

Detalhes

Descrição original do autor

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

Popularidade

Estrelas no GitHub
29 mil
Posição no ranking
#9813
Licença
MIT
Atualizada em
21/10/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas