3.0.0 • Published 1 year ago

@bitfo/sanity-plugin-table v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Sanity Table Plugin

This is a (double) fork of the Sanity Plugin Table, migrated to Sanity Studio V3.

Forked form rdunk/sanity-plugin-table. Forked form MathisBullinger/sanity-plugin-another-table.

example

Install

Install using npm

$ npm i sanity-plugin-table@v3

Usage

Add the plugin to your project configuration. Then use the type in your schemas

// sanity.config.ts

import { defineConfig } from 'sanity';

import { table } from 'sanity-plugin-table';

export default defineConfig({
  name: 'default',
  title: 'My Cool Project',
  projectId: 'my-project-id',
  dataset: 'production',
  plugins: [
    // Include the table plugin
    table(),
  ],
  schema: {
    types: [
      {
        name: 'product',
        title: 'Product',
        type: 'document',
        fields: [
          {
            // Include the table as a field
            // Giving it a semantic title
            name: 'sizeChart',
            title: 'Size Chart',
            type: 'table',
          },
        ],
      },
    ],
  },
});

Development

The project can be built using npm run build.

To test the plugin in a Sanity project, run npm run link-watch, then sanity-plugin-table can be tested inside the Sanity Studio. Follow the directions in plugin-kit for more details.