# svelte-table-layout

> A dynamic table layout for Svelte, a drop-in replacement for HTML tables that use CSS grid under the hood. It lets you easily style columns and rows even if there are cells with nontrivial colspan & rowspan.

Latest version **2.0.0** (published 2024-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install svelte-table-layout
pnpm add svelte-table-layout
yarn add svelte-table-layout
bun add svelte-table-layout
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-06-08 |
| First published | 2023-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | c.sha, richard.ivanek |

## Links

- npm: https://www.npmjs.com/package/svelte-table-layout
- npm.io page: https://npm.io/package/svelte-table-layout

## Dependencies (1)

- [esm-env](https://npm.io/package/esm-env.md) ^1.0.0

## Recent versions

- 2.0.0 (latest) — 2024-06-08
- 1.0.0 — 2024-01-23
- 0.0.13 — 2023-08-11
- 0.0.12 — 2023-05-09
- 0.0.11 — 2023-04-17
- 0.0.10 — 2023-03-06
- 0.0.9 — 2023-02-28
- 0.0.8 — 2023-02-28
- 0.0.7 — 2023-02-28
- 0.0.6 — 2023-02-28
- 0.0.5 — 2023-02-28
- 0.0.4 — 2023-02-28
- 0.0.3 — 2023-02-28
- 0.0.2 — 2023-02-25
- 0.0.1 — 2023-02-25

## README

# Svelte Table Layout

A dynamic table layout for Svelte, a drop-in replacement for HTML tables that use CSS grid under the hood. It lets you easily style columns and rows even if there are cells with nontrivial colspan & rowspan.

```svelte
<Table class="my-table">
	<tr style="background: gray">
		<td>grey</td>
		<td>row</td>
		<td>with no decoration</td>
	</tr>
	<tr style="background: pink; border: 1px solid red;">
		<td colspan={2}>pink row</td>
		<td>with red border</td>
	</tr>
</Table>

<style>
	/* make all cells that intersect the third column bold */
	:global(.my-table [data-column~='3']) {
		font-weight: bold;
	}
</style>
```

It also supports `colspan=row` to make cells span the entire row, and lets you align the columns of two different tables.

```svelte
<Table bind:computedColumnWidths={columns}>
	<tr>
		<td>a-really-long-cell</td>
		<td>normal-cell</td>
		<td>xd</td>
	</tr>
	<tr>
		<td colspan="row">lorem</td>
	</tr>
</Table>

<Table {columns}>
	<tr>
		<td>a</td>
		<td>b</td>
		<td>c</td>
	</tr>
	<tr>
		<td>d</td>
		<td>e</td>
		<td>f</td>
	</tr>
</Table>
```

---
_Source: https://npm.io/package/svelte-table-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
