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

custom-features

O que ela faz

Esta habilidade mostra como construir um recurso reutilizável, ou plugin, que adiciona um novo estado ou comportamento ao TanStack Table. Serve para desenvolvedores avançados cujas necessidades não são cobertas pelos recursos integrados.

Quando usar

  • ✓Quando você precisa de um estado ou comportamento reutilizável que deve ser adicionado aos objetos da tabela.
  • ✓Quando as opções integradas e os metadados tipados não dão conta do seu renderizador ou das configurações do seu aplicativo.
  • ✓Quando você está escrevendo um plugin que precisa registrar hooks de ciclo de vida e métodos da tabela corretamente.

Link da skill

https://github.com/TanStack/table/blob/main/packages/table-core/skills/custom-features/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/table-core/skills/custom-features/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

“Os recursos integrados do TanStack Table não cobrem o que eu preciso. Como escrevo o meu próprio plugin?”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

Ela percorre como declarar o recurso, preservar o estado do usuário, adicionar métodos à tabela e aos objetos durante os hooks de ciclo de vida e registrar o plugin com um objeto de recurso estável.

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

Texto original do autor, em inglês, direto do GitHub.

Author a custom feature

Read core and feature architecture first. Use a plugin for reusable state or behavior that must augment Table objects. Built-in options and typed tableMeta/columnMeta are usually enough for renderer callbacks and application configuration.

Implementation workflow

  1. Identify the state, options, and object methods the behavior owns. If it only passes callbacks or renderer data, read scoped meta typing and use meta instead.
  2. Before declaring plugin types or writing lifecycle hooks, read the complete plugin example. It enumerates all 10 public FeatureMaps, the API assignment helpers, lifecycle ordering, and the advanced row-model maps.
  3. Declare the feature key in Plugins. Merge only FeatureMaps with matching runtime implementations; declarations alone install no behavior.
  4. Preserve user state after defaults in getInitialState; connect state updaters in default options. Install table methods with assignTableAPIs and object methods with assignPrototypeAPIs inside the corresponding lifecycle hooks.
  5. Keep the feature object and tableFeatures({ customFeature }) result stable. Register the plugin through tableFeatures so inference and composition include it.
  6. Verify the advertised state, options, methods, and resets on a constructed table. Each declared API must exist at runtime; reset behavior must respect the state owner.

Lifecycle boundaries

Use initTableInstanceData for mutable data owned by one table and resetTableInstanceData for clearing its transient contents. All feature initialization finishes before any constructTableAPIs hook. Keep method installation separate from data allocation.

Prototype methods are shared across the table's rows, columns, cells, or headers. Read per-object values through the method's current instance, and use the supported instance-data hooks for mutable fields. Read the example's installation rules before adding memoized methods or advanced row-model/cache wiring.

Common failures

  • Types without matching runtime hooks advertise APIs that do not exist.
  • Ad hoc mutation of constructed instances bypasses feature registration and inferred composition.
  • Treating the density example as the only extension pattern misses column definitions and the other public FeatureMaps. Choose the maps required by the behavior; advanced row-model declarations also require runtime pipeline/cache wiring.

Installed API discovery

Inspect node_modules/@tanstack/table-core/dist/types/TableFeatures.d.ts, the exported *_FeatureMap interfaces in dist/types/, and assignTableAPIs/assignPrototypeAPIs in dist/utils.d.ts. Follow declarations under dist/features/ for comparable stock lifecycle signatures.

Perguntas frequentes

Quando eu não devo criar um recurso personalizado?

A habilidade diz que, se o comportamento apenas passa callbacks ou dados do renderizador, você deve usar metadados tipados.

Declarar um tipo de recurso instala o comportamento?

Não. A habilidade diz que declarações sozinhas não instalam nada, então as implementações em tempo de execução devem corresponder aos tipos declarados.

Onde o plugin deve ser registrado?

Pela chamada tableFeatures, para que a inferência de tipos e a composição o incluam.

Detalhes

Descrição original do autor

Implement a Table v9 plugin when built-ins and typed meta are insufficient. Covers FeatureMaps, runtime lifecycle hooks, prototypes, and a complete checked example.

repo: TanStack/table

Popularidade

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

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas