experiment_id: web-retrieval-v1
fixture_id: /docs/integrations/js-frameworks-&-libs/svelte
mode: provenance
representation: html
origin_response_id: a62c1abb0c781933c44a377784829f18
version: 2026-10-21
version_created_at_utc: 2026-10-21T20:42:35.731Z
version_nonce: 90e3b6fbd6608434160d3c5062271db3
generated_at_utc: 2026-11-10T15:58:04.400Z
response_nonce: 658bfac423ea38fc22544f5c44aed605
Docs Version 1

Svelte Integration

ZingGrid works with your development stack, including Svelte! In this guide, we'll walk you through how to add ZingGrid to your Svelte 3 project.

Usage

  1. For this example we'll start with a new Svelte app:

    npx degit sveltejs/template zinggrid-svelte-helloworld
    cd zinggrid-svelte-helloworld
    npm install 
    npm install zinggrid
    npm run dev

    You can now view the app in a browser at localhost:8080 (check the output of npm run dev, it might be running on a different port).

  2. In the <script> section of App.svelte, import ZingGrid. We'll also remove the name component property:

    <script>
      import 'zinggrid'
    </script>
  3. Now remove the contents of <main> and replace them with a zing-grid component:

    <main>
      <zing-grid />
    </main>

    When you save the file, the page should refresh and show an empty ZingGrid, with the message There are no records to display.

  4. Let's add some data and update the zinggrid component to show it. First, define the data in the <script> section:

    <script>
      import 'zinggrid'
    
      const data = [
        {"name": "Sousage", "breed": "Dachshund"},
        {"name": "Plop", "breed": "Corgi"},
        {"name": "Floof", "breed": "Pomeranian"}
      ]
    </script>
  5. Change the zing-grid component to look like this:

<main>
  <zing-grid caption="Dogs" data={JSON.stringify(data)} />
</main>

Altogether, this is what it'll look like (the unused styles have been removed as well):

```javascript
<script>
  import 'zinggrid'

  const data = [
      {"name": "Sousage", "breed": "Dachshund"},
      {"name": "Plop", "breed": "Corgi"},
      {"name": "Floof", "breed": "Pomeranian"}
  ]
</script>

<main>
  <zing-grid caption="Dogs" data={JSON.stringify(data)} />
</main>

<style>
  main {
  	padding: 1em;
  	margin: 0 auto;
  }
</style>

For more details on integrating ZingGrid into a Svelte app, see this article.

Top

[integrations: svelte]

On This Page