feat(data_table): DataTable component with TanStack Table Core#450
Open
djalmaaraujo wants to merge 51 commits intoruby-ui:mainfrom
Open
feat(data_table): DataTable component with TanStack Table Core#450djalmaaraujo wants to merge 51 commits intoruby-ui:mainfrom
djalmaaraujo wants to merge 51 commits intoruby-ui:mainfrom
Conversation
- Add DataTable component files and Stimulus controller - Add docs page with live search, sort, and pagination demo - Add demo controller with fake employee data - Add route, controller action, and menu entry
…xt, Components table, TanStack links
…emove p text-sm classes
…ve, and template element rationale
…isualCodeExample, docs clarity
…ng interpolation, hash braces)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a fully-featured
DataTablecomponent powered by TanStack Table Core (framework-agnostic, vanilla JS) and wired with a Stimulus controller.Architecture: TanStack manages all table state (pagination, sorting, filtering, row selection, column visibility, row expansion) client-side. For server-driven tables, the Stimulus controller fetches JSON from a
src:endpoint and re-renders rows via JS. For static tables, everything works entirely client-side with no server round-trips.Components added
DataTable— root wrapper, hosts the Stimulus controllerDataTableContent— renders<table>,<thead>,<tbody>with Stimulus targets; includes<template>elements for sort icons, checkboxes, chevrons, and expanded row markupDataTableToolbar— search input + per-page selectorDataTableBulkActions— selection count bar with slot for action buttonsDataTableColumnToggle— column visibility dropdown (show/hide columns)DataTablePagination— prev/next buttons + page indicatorDataTableCell*— typed cell renderers:Text,Badge,Currency,Number,Percent,Date,Boolean,Link,TruncateDataTableExpandedRow— content slot for expandable rowsStimulus controller features
src:value) — fetchesapplication/json, updates TanStack data, re-renders rowssrc:) — sort, filter, paginate entirely in-browsersync_url: true) — reflects current page/sort/search in the address baroptions:value) for advanced use casesDocs page
Full interactive demo with 100 fake employees, server-side search/sort/pagination via a demo controller (
Docs::DataTableDemoController). Includes prose documentation, code examples for all major features, and a component API table.Test plan
/docs/data_table— hero demo loads with 10 rowssrc:) works without network requests