<!-- Source: https://table.svelte.page/docs/api/create-table -->

# createTable

> Define your data source and the plugins to use

**Source:** [https://table.svelte.page/docs/api/create-table](https://table.svelte.page/docs/api/create-table)

---

Every Svelte Headless Table starts with `createTable`. It takes a data source and plugin configuration, and returns a <a href="/docs/api/table">Table</a> instance.

## Usage

---

### `createTable: (data, plugins) => Table`

`data` is a Svelte store containing an array of data to present on the table. If data needs to be updated (e.g. when editing the table or lazy-fetching data from the server), use a `Writable` store.

`plugins` is an object of plugin names to plugins. Refer to <a href="/docs/plugins/overview">the plugin system</a> for how to use Svelte Headless Table plugins.

```ts
const table = createTable(data, {
    sort: addSortBy(),
    filter: addColumnFilters()
})
```
