# Setup

Bla bla bla

# Preparation

To get a type-safe table, we must first make sure we have types. A table can conceptually be represented as a collection of objects. In svelte-datagrid, the type of this object needs te be represented as a class.

export default class Book {
  title: string;
  author: string;
  price: number;
}

# A basic example

Suppose we have a list of books

const books = [
  { title: 'The Noise of Time', author: 'Julian Barnes', price: '19.99' },
  { title: 'Kafka on the Shore', author: 'Haruki Murakami', price: '21.99' },
  { title: 'On Connection', author: 'Kae Tempest', price: '24.99' },
  // and more, probably
]

Bla bla create a table

<DataGrid type={Book} source={books} let:data>
  <Column {data} header="Title"  value={b => b.title} />
  <Column {data} header="Author" value={b => b.author} />
  <Column {data} header="Price"  value={b => b.price} />
  <ListPaginator slot=paginator />
</DataGrid>