Agent skill

Ktui Datatable

by keenthemes in keenthemes/ktui

KtUI DataTable (KTDataTable) — local/remote data, sorting, filtering, pagination, checkbox selection, state persistence, fixed layouts, event system, and architecture.

MITAuto-check passedDevelopment

Install Ktui Datatable

skills CLI
$ npx skills add keenthemes/ktui --skill ktui-datatable -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install keenthemes/ktui ktui-datatable --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/keenthemes/ktui.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/ktui-datatable .claude/skills/ktui-datatable && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ktui-datatable
GitHub stars
151
Token cost
~2.6k tokens
SKILL.md length
627 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
MIT

At a glance

KtUI DataTable (KTDataTable) — local/remote data, sorting, filtering, pagination, checkbox selection, state persistence, fixed layouts, event system, and architecture.

  • Works in 12 steps: Basic Usage → Config Options → Programmatic API → …
  • Customizing DataTable components
  • SKILL.md covers 1. Basic Usage, 2. Config Options, 3. Programmatic API and 4. Column Config, plus 9 more sections
  • Calls npm and npx

What it does

Ktui Datatable is an agent skill from keenthemes/ktui. KtUI DataTable (KTDataTable) — local/remote data, sorting, filtering, pagination, checkbox selection, state persistence, fixed layouts, event system, and architecture. Use this skill when building, debugging, or customizing DataTable components.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Agent memory. The repository describes itself as: Open-source collection of customizable UI components for Tailwind CSS and vanilla JavaScript. The licence is MIT.

When your agent uses it

  • Customizing DataTable components
  • Tasks that involve Agent memory

Example prompts

  • “/ktui-datatable”

Requirements

  • Node.js

Workflow steps

12 steps, taken from the step headings in SKILL.md.

  1. Basic Usage
  2. Config Options
  3. Programmatic API
  4. Column Config
  5. Remote Data Provider
  6. Fixed Column Widths
  7. Column Filters
  8. Empty State
  9. Event System
  10. Architecture
  11. Pitfalls
  12. Build & Testing

What it can do on your machine

Read from SKILL.md and the folder at commit 74a8e60. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • ktui.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Ktui Datatable loads about 2.6k tokens when it runs. Until then it costs about 65 tokens; SKILL.md has 627 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~65
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from keenthemes/ktui at commit 74a8e60, republished under its MIT licence (© keenthemes). 627 words, ~2,561 tokens.

Download SKILL.mdSave it as .claude/skills/ktui-datatable/SKILL.md (or your agent's skills folder).
name
ktui-datatable
description
KtUI DataTable (KTDataTable) — local/remote data, sorting, filtering, pagination, checkbox selection, state persistence, fixed layouts, event system, and architecture. Use this skill when building, debugging, or customizing DataTable components.

KTDataTable — AI Agent Reference

Full reference for the DataTable component in KtUI. Package: @keenthemes/ktui. Class: KTDataTable. Root attribute: data-kt-datatable.

Always prefer ktui.io/docs/datatable docs and examples over guessing markup or options.


1. Basic Usage

html
<div data-kt-datatable="true">
  <table>
    <thead>
      <tr>
        <th data-kt-datatable-column="name">Name</th>
        <th data-kt-datatable-column="email">Email</th>
      </tr>
    </thead>
    <tbody></tbody>
  </table>
</div>
ts
import { KTDataTable } from '@keenthemes/ktui';

const dt = KTDataTable.getInstance(tableEl);

2. Config Options

OptionTypeDescription
apiEndpointstringRemote data URL
requestMethodstringHTTP method (default 'POST')
requestHeadersobjectCustom headers
mapResponsefunctionTransform API response
mapRequestfunctionTransform request params
pageSizenumberRows per page
pageSizesnumber[]Page size options
stateSavebooleanPersist state in localStorage
columnsobjectColumn config (render, checkbox, sortType, sortValue, createdCell)
sortobjectSort config with classes and callback
searchobjectSearch config with delay and callback
paginationobjectPagination markup config
loadingobjectSpinner template
checkboxobjectRow checkbox config (checkedClass, preserveSelection)
lockedLayoutobjectSticky headers/columns
tableLayoutstring'fixed' for fixed column widths (use with <colgroup>)
filterobjectColumn filter config (type, value)
infoEmptystringEmpty state HTML (supports innerHTML)

3. Programmatic API

ts
const dt = KTDataTable.getInstance(tableEl);

dt.sort('name');
dt.sort('name', 'desc');           // explicit sort order
dt.goPage(2);
dt.setPageSize(25);
dt.search('query');
dt.setFilter({ column: 'status', type: 'text', value: 'active' });
dt.reload();        // re-fetch from API
dt.redraw();        // re-render current data
dt.getState();      // { page, sortField, sortOrder, pageSize, ... }
dt.check(value);    // check a row by value
dt.uncheck(value);  // uncheck a row by value
dt.getChecked();    // get array of checked row values
dt.dispose();
Instance management
Static methodReturns
KTDataTable.getInstance(el)Existing instance or null
KTDataTable.getOrCreateInstance(el, config?)Existing or new instance
KTDataTable.init()Scans DOM, creates instances

4. Column Config

ts
columns: {
  name: {
    title: 'Full Name',
    render: (item, data, ctx) => `<strong>${item}</strong>`,
    sortType: 'string', // or 'numeric'
    sortValue: (cellValue, rowData) => rowData.firstName + ' ' + rowData.lastName,
    createdCell: (cell, cellData, rowData, row) => {
      cell.classList.add('text-primary');
    },
  },
  actions: {
    checkbox: true,
  },
}

5. Remote Data Provider

Response shape
ts
interface KTDataTableResponseDataInterface {
  data: KTDataTableDataInterface[];
  totalCount: number;
}
Config
ts
{
  apiEndpoint: 'https://api.example.com/users',
  requestMethod: 'POST',
  requestHeaders: { 'Authorization': 'Bearer ...' },
  mapResponse: (response) => ({ data: response.items, totalCount: response.total }),
  mapRequest: (params) => ({ ...params, page: params.page + 1 }),
}

6. Fixed Column Widths

Use tableLayout: 'fixed' with <colgroup> for consistent column widths across pages:

html
<table data-kt-datatable-table="true" style="table-layout: fixed; width: 100%;">
  <colgroup>
    <col style="width: 40px">    <!-- checkbox -->
    <col style="width: 70px">    <!-- ID -->
    <col>                         <!-- Name (auto-fill) -->
    <col style="width: 120px">   <!-- Status -->
  </colgroup>
</table>

7. Column Filters

Client-side filtering with setFilter():

ts
dt.setFilter({ column: 'status', type: 'text', value: 'active' });
dt.setFilter({ column: 'price', type: 'numeric', value: { min: 10, max: 100 } });

Filter pipeline runs between search and sort.


8. Empty State

Default: When data.length === 0, renders a single row with infoEmpty text (default: "No records found"). Supports HTML.

Custom via data attribute:

html
<div data-kt-datatable="true"
     data-kt-datatable-info-empty='<div class="py-10 text-center">No records found</div>'>

Pitfall — never hardcode empty state HTML in <tbody>: The DataTable reads tbody rows as "data" on init. Hardcoded content gets treated as 1 row and disappears on re-render. Always use data-kt-datatable-info-empty or the JS infoEmpty config.


9. Event System

All events dispatch through dual channel:

  1. Internal callbacks (.on()) — bare name
  2. DOM CustomEvents (addEventListener) — namespaced as kt.datatable.<event>
EventPayloadWhen
update—Data changed. Call getState() for details.
sort{ field, order }Column header click
change{ cancel }Before checkbox toggle (cancelable)
changed—After checkbox change. Call getChecked().
checked{ value }Row checked
unchecked{ value }Row unchecked
fetchError{ response, error, status, statusText }Remote JSON parse failure
error{ error }Network fetch failure
ts
// Internal callback
dt.on('sort', (payload) => { console.log(payload.field); });

// DOM CustomEvent
el.addEventListener('kt.datatable.sort', (e) => {
  console.log(e.detail.payload.field);
});

Show full SKILL.md (283 more words)Show less

10. Architecture

Source: src/components/datatable/

FilePurpose
datatable.tsMain class — constructor, _updateData(), _draw(), _finalize(), _dispose()
datatable-local-provider.tsLocal mode data fetch with checksum-based DOM invalidation
datatable-remote-provider.tsRemote API mode with AbortController
datatable-state-store.tsState management — patchState(), setPage(), setSort()
datatable-checkbox.tsCheckbox handler — header check, row check, reapplyCheckedStates()
datatable-table-renderer.tsRenders data rows into <tbody>
datatable-pagination-renderer.tsRenders pagination buttons, page size selector
datatable-sort.tsColumn sort handler with AbortController-based cleanup
datatable-defaults.tsDATATABLE_DEFAULTS — static config constants
datatable-utils.tsShared stripHtml() utility
datatable-search-handler.tsDebounced search input handler
datatable-state-persistence.tslocalStorage save/load with try/catch guards
datatable-registry.tsInstance Map + DOM fallback
datatable-layout-plugin.tsSticky header/locked columns plugin
datatable-spinner.tsLoading spinner show/hide
datatable-contracts.tsInterfaces and type contracts
datatable-column-utils.tsColumn resolution utilities
types.tsType definitions (config, state, data interfaces)
index.tsBarrel exports
Lifecycle (Critical)

Every data update follows this sequence:

_updateData()
  ├── fetchSync() or fetch()     ← reads from DOM or API
  ├── _draw()
  │     ├── _cleanupForRedraw()  ← cleans listeners + DOM artifacts (NOT registry)
  │     ├── _updateTable()       ← re-renders tbody rows
  │     ├── _updatePagination()  ← re-renders pagination buttons
  │     ├── afterDraw layoutPlugin hook
  │     └── _saveState()         ← persists to localStorage
  ├── _finalize()
  │     ├── _checkbox.init()     ← re-queries DOM, calls reapplyCheckedStates()
  │     ├── _sortHandler.initSort()
  │     ├── searchHandler.attach()
  │     ├── KTComponents.init()
  │     ├── spinner.hide()
  │     └── update _contentChecksum  ← MUST be last (after DOM modifications)
  └── emit 'update'

ORDER MATTERS. _finalize() modifies the DOM. Any checksum saved before _finalize() will be stale.


11. Pitfalls

ProblemCauseFix
Empty pagination after checkbox select_contentChecksum saved before _finalize()Save checksum at END of _finalize()
Corrupted localStorage persistsState shrank originalData to current pagelocalStorage.removeItem('kt_datatable_<id>')
Sort listener leakcloneNode(true) destroys th attrsUses AbortController pattern internally
Filter stored but never appliedsetFilter() writes to state but fetchSync() ignores itFilter pipeline runs between search and sort
Hardcoded empty state in <tbody>DataTable reads tbody rows as "data" on initUse data-kt-datatable-info-empty attribute instead
Column widths shift on paginationtable-layout: auto recalculates per pageUse table-layout: fixed with <colgroup>
Checkbox events invisible to addEventListenerWas only internal callbacksNow dispatches as kt.datatable.* CustomEvents
Parallel refactoring on shared repo failsTight coupling between filesExecute sequentially on single branch

12. Build & Testing

bash
cd ~/Sites/keenthemes/ktui/ktui
npx vitest run src/components/datatable    # all pass
npx tsc --noEmit                           # typecheck
npm run build:webpack                      # full bundle
npm run build:lib                          # ESM + CJS library builds

Do NOT edit lib/esm/ or lib/cjs/ directly — they're generated from npm run build:lib.


13. Documentation

© keenthemes, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/ktui-datatable of keenthemes/ktui.

Open the folder on GitHubat commit 74a8e60

Compare with similar skills

Ktui Datatable next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Ktui Datatable compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ktui Datatable this skillkeenthemes/ktui151—~2.6kAutomated safety check: PassMIT
Commit Context Lookuprohitg00/agentmemory29k—~522Automated safety check: PassApache-2.0
Beacon Memory DistillAsymptote-Labs/agent-beacon1.8k—~3kAutomated safety check: PassMIT
Shellm Architecture Referencelaude-institute/headlong1.2k—~2kAutomated safety check: NotesApache-2.0
Fireworks Tech Graphninehills/skills2813 repos~8kAutomated safety check: PassMIT
Mem0 Status Checkmem0ai/mem067k—~1.5kAutomated safety check: PassApache-2.0

Similar skills

  • Commit Context Lookup

    rohitg00/agentmemory

    Traces a file, function or line back to the agent session behind its current commit, using git blame and a memory lookup, and reports only what the records show.

    29k GitHub stars~522 tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Beacon Memory Distill

    Asymptote-Labs/agent-beacon

    Turn recorded agent sessions (Beacon traces from Claude Code, Cursor, Codex, OpenCode, and other harnesses) into reviewed, reusable project memory.

    1.8k GitHub stars~3k tokensUpdated today
    DevelopmentAuto-check passed
  • Shellm Architecture Reference

    laude-institute/headlong

    Explains how shellm's bash-based recursive LLM shell fits together - its core engine, identity system, memory, skills and trajectory log.

    1.2k GitHub stars~2k tokensUpdated yesterday
    DevelopmentAuto-check: notes
  • Fireworks Tech Graph

    ninehills/skills

    A skill your agent uses when the user wants to create any technical diagram - architecture, data flow, flowchart, sequence, agent/memory, or concept map - and export as SVG+PNG.

    281 GitHub starsUsed in 3 repos~8k tokens
    DevelopmentAuto-check passed
  • Runs a four-part diagnostic on the mem0 plugin, checking the API key, identity resolution, memory search and memory write, then reports one pass-or-fail summary.

    67k GitHub stars~1.5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Agent Memory Discipline Loop

    rohitg00/agentmemory

    Makes persistent agent memory pay off by searching before work starts and saving each decision the moment it settles, rather than batching a summary at the end.

    29k GitHub stars~831 tokensUpdated 2 days ago
    DevelopmentAuto-check passed

More from keenthemes/ktui

  • Ktui Install

    keenthemes/ktui

    Install, configure, and initialize KtUI (Keenthemes Tailwind UI) in any project.

    151 GitHub stars~994 tokensUpdated 3 mo ago
    Auto-check passed
  • Ktui Select

    keenthemes/ktui

    KtUI Select (KTSelect) — rich searchable multi-select dropdown replacing native select.

    151 GitHub stars~1.9k tokensUpdated 3 mo ago
    Auto-check passed
  • Ktui

    keenthemes/ktui

    Comprehensive guide to KtUI (Keenthemes Tailwind UI) — components, theming, initialization, data-attribute API, event system, helpers, and common patterns.

    151 GitHub stars~5.4k tokensUpdated 3 mo ago
    Auto-check passed

Questions about Ktui Datatable

What does Ktui Datatable do?

KtUI DataTable (KTDataTable) — local/remote data, sorting, filtering, pagination, checkbox selection, state persistence, fixed layouts, event system, and architecture. Ktui Datatable is an agent skill from keenthemes/ktui. KtUI DataTable (KTDataTable) — local/remote data, sorting, filtering, pagination, checkbox selection, state persistence, fixed layouts, event system, and architecture.

When should I use Ktui Datatable?

Ktui Datatable fits situations like: customizing DataTable components; tasks that involve Agent memory.

How do I install Ktui Datatable in Claude Code?

Run `npx skills add keenthemes/ktui --skill ktui-datatable -a claude-code`. Or copy the skill folder (skills/ktui-datatable in keenthemes/ktui) into .claude/skills/ktui-datatable in your project. Claude Code loads it when a task matches its description.

How do I install Ktui Datatable in Codex?

Run `npx skills add keenthemes/ktui --skill ktui-datatable -a codex`. Or copy the skill folder (skills/ktui-datatable in keenthemes/ktui) into .agents/skills/ktui-datatable in your project. Codex loads it when a task matches its description.

Can I use Ktui Datatable in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add keenthemes/ktui --skill ktui-datatable -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ktui-datatable, .gemini/skills/ktui-datatable, .github/skills/ktui-datatable and .opencode/skills/ktui-datatable in your project.

What does Ktui Datatable need to run?

Going by SKILL.md and its folder, Ktui Datatable needs the command-line tools its instructions call (npm and npx). Our summary lists: Node.js.

Does Ktui Datatable access the network?

SKILL.md names 1 domain. As links in the text: ktui.io. This is read from the text; nothing was executed.

Is Ktui Datatable safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Ktui Datatable use?

Ktui Datatable is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ktui Datatable use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Ktui Datatable?

Skills that share tags, products or a category with Ktui Datatable: Commit Context Lookup (rohitg00/agentmemory, 29k stars), Beacon Memory Distill (Asymptote-Labs/agent-beacon, 1.8k stars), Shellm Architecture Reference (laude-institute/headlong, 1.2k stars) and Fireworks Tech Graph (ninehills/skills, 281 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ktui Datatable?

keenthemes (a GitHub organization) maintains it in keenthemes/ktui, which has 151 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on June 17, 2026.

Source: keenthemes/ktui on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.