mcpField
L
layerchart-svelte5

layerchart-svelte5

github.com/spences10Development94129 installsUpdated 2w ago
Repository

About layerchart-svelte5

A pattern reference for using LayerChart with Svelte 5, intended for developers building charts. It documents snippet-based tooltip and chart context patterns, tooltip modes, and chart examples; Svelte 5 use requires the `next` package tag.

Key features

  1. 01Svelte 5 setup with `layerchart@next`
  2. 02Snippet-based tooltip patterns
  3. 03Chart context and gradient snippets
  4. 04Tooltip modes by chart type
  5. 05Area, bar, pie, and graph references

Use cases

  1. 01Build a bar chart with band tooltips
  2. 02Add bisect-x tooltips to time series
  3. 03Create scatter plots with quadtree tooltips

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/spences10/svelte-skills-kit --skill layerchart-svelte5

After installing, type/layerchart-svelte5in Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
full-patterns.md
graph-patterns.md
tooltip-modes.md

Details

From the project README

LayerChart Svelte 5

Docs: next.layerchart.com (NOT layerchart.com - that's Svelte 4)

Install

npm i layerchart@next d3-scale

CRITICAL: Use @next tag. Stable (1.x) is Svelte 4 only.

Quick Start

<Chart {data} x="date" y="value" tooltip={{ mode: 'bisect-x' }}>
	<Svg><Area class="fill-primary/20" /><Highlight points /></Svg>
	<Tooltip.Root>{#snippet children({ data })}{data.value}{/snippet}</Tooltip.Root>
</Chart>

Core Patterns

  • Tooltip: {#snippet children({ data })} - NOT let:data
  • Chart context: {#snippet children({ context })}
  • Gradient: {#snippet children({ gradient })}
  • Enable tooltip: tooltip={{ mode: 'band' | 'bisect-x' }}
  • Type data: {#snippet children({ data }: { data: MyType })}

Tooltip Modes

ModeUse Case
bandBar charts (scaleBand)
bisect-xTime-series area/line
quadtree-xArea (nearest x)
quadtreeScatter plots

References

Comments

Markdown supported