mhkeller/layercake

graphics framework for sveltejs

Svelte

1,794

1,259 commits

updated Oct 4, 2026

See the code

README

Layer Cake layercake-logo

a headless visualization framework for mostly-reusable graphics with svelte

Tests badges npm version npm

🍰 See examples 🍰 Read the guide 🍰 API docs 🍰 View the Component Gallery 🍰 Try the starter template

Svelte versions

Since v11, the library and the examples use runes instead of the Svelte store API. See the v10 documentation archive for examples of those components.

Install

npm install --save layercake

Example

<script>
  // The library provides a main wrapper component
  // and a bunch empty layout components...
  import { LayerCake, Svg, Html, Canvas } from 'layercake';

  // ...that you fill with your own chart components,
  // that live inside your project and which you
  // can copy and paste from here as starting points.
  import AxisX from './components/AxisX.svelte';
  import AxisY from './components/AxisY.svelte';
  import Line from './components/Line.svelte';
  import Scatter from './components/Scatter.svelte';
  import Labels from './components/Labels.svelte';

  const data = [
    { x: 0, y: 1 },
    { x: 1, y: 2 },
    { x: 2, y: 3 }
  ];
</script>

<style>
  .chart-container {
    width: 100%;
    height: 500px;
  }
</style>

<div class="chart-container">
  <LayerCake
    x='x'
    y='y'
    {data}
  >
    <Svg>
      <AxisX/>
      <AxisY/>
      <Line stroke='#f0c'/>
    </Svg>

    <Canvas>
      <Scatter fill='#0fc'/>
    </Canvas>

    <Html>
      <Labels/>
    </Html>
  </LayerCake>
</div>

License

MIT

cake
charts
dataviz
delicious
dessert
graphics
layercake
layers
svelte
sveltejs

mhkeller/layercake

graphics framework for sveltejs

Svelte

1,794

1,259 commits

updated Oct 4, 2026

See the code

README

Layer Cake layercake-logo

a headless visualization framework for mostly-reusable graphics with svelte

Tests badges npm version npm

🍰 See examples 🍰 Read the guide 🍰 API docs 🍰 View the Component Gallery 🍰 Try the starter template

Svelte versions

Since v11, the library and the examples use runes instead of the Svelte store API. See the v10 documentation archive for examples of those components.

Install

npm install --save layercake

Example

<script>
  // The library provides a main wrapper component
  // and a bunch empty layout components...
  import { LayerCake, Svg, Html, Canvas } from 'layercake';

  // ...that you fill with your own chart components,
  // that live inside your project and which you
  // can copy and paste from here as starting points.
  import AxisX from './components/AxisX.svelte';
  import AxisY from './components/AxisY.svelte';
  import Line from './components/Line.svelte';
  import Scatter from './components/Scatter.svelte';
  import Labels from './components/Labels.svelte';

  const data = [
    { x: 0, y: 1 },
    { x: 1, y: 2 },
    { x: 2, y: 3 }
  ];
</script>

<style>
  .chart-container {
    width: 100%;
    height: 500px;
  }
</style>

<div class="chart-container">
  <LayerCake
    x='x'
    y='y'
    {data}
  >
    <Svg>
      <AxisX/>
      <AxisY/>
      <Line stroke='#f0c'/>
    </Svg>

    <Canvas>
      <Scatter fill='#0fc'/>
    </Canvas>

    <Html>
      <Labels/>
    </Html>
  </LayerCake>
</div>

License

MIT

cake
charts
dataviz
delicious
dessert
graphics
layercake
layers
svelte
sveltejs

Project health

Overall

4.5/10

Maintained

10/10

Code review

0/10
OpenSSF Scorecard

Latest release

11.0.0 · Sep 6, 2026

Releases this year

2

Significant stargazers

Turiiya

106 followers · starred Jun 2024

Aslak Hellesøy

819 followers · starred Apr 2023

Willow (GHOST)

284 followers · starred Sep 2024

Edgar

161 followers · starred Dec 2022