Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix lit code example in TableLanding.tsx
  • Loading branch information
plycos committed Feb 11, 2026
commit dbc39710c3582e1c972532f7efdbb6ac12a8bc2e
64 changes: 45 additions & 19 deletions src/components/landing/TableLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,31 +210,57 @@ const table = useVueTable({ data, columns, getCoreRowModel: getCoreRowModel() })
},
lit: {
lang: 'ts',
code: `import { LitElement, customElement, html } from 'lit'
import { createLitTable, getCoreRowModel, flexRender } from '@tanstack/lit-table'
code: `
import { html, LitElement } from 'lit'
import { customElement } from 'lit/decorators.js'
import {
flexRender,
getCoreRowModel,
TableController,
} from '@tanstack/lit-table'

const data = [{ id: 1, name: 'Ada' }]
const columns = [{ accessorKey: 'name', header: 'Name' }]

@customElement('simple-table')
export class SimpleTable extends LitElement {
table = createLitTable({ data, columns, getCoreRowModel: getCoreRowModel() })

render() {
return html\`<table>
<thead>
\${this.table.getHeaderGroups().map((hg) => html\`<tr>
\${hg.headers.map((header) => html\`<th>\${flexRender(header.column.columnDef.header, header.getContext())}</th>\`)}
</tr>\`)}
</thead>
<tbody>
\${this.table.getRowModel().rows.map((row) => html\`<tr>
\${row.getVisibleCells().map((cell) => html\`<td>\${flexRender(cell.column.columnDef.cell, cell.getContext())}</td>\`)}
</tr>\`)}
</tbody>
</table>\`
}
}`,
private tableController = new TableController(this)

render() {
const table = this.tableController.table({
columns,
data,
getCoreRowModel: getCoreRowModel(),
})
return html\`
<table>
<thead>
\${table.getHeaderGroups().map((hg) => html\`
<tr>
\${hg.headers.map((header) => html\`
<th>
\${flexRender(header.column.columnDef.header, header.getContext())}
</th>
\`)}
</tr>
\`)}
</thead>
<tbody>
\${table.getRowModel().rows.map((row) => html\`
<tr>
\${row.getVisibleCells().map((cell) => html\`
<td>
\${flexRender(cell.column.columnDef.cell, cell.getContext())}
</td>
\`)}
</tr>
\`)}
</tbody>
</table>
\`
}
}
`,
},
qwik: {
lang: 'tsx',
Expand Down