Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/table

Package Overview
Dependencies
Maintainers
44
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/table

Table schema type and input component for Sanity Studio

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
44
Created
Source

Sanity Table Plugin

This is a Sanity Studio v3 plugin. For the v2 version, please refer to the v2 repository.

This is a (triple) fork of the Sanity Plugin Table, migrated to Sanity Studio V3. Only the v3 version is maintained by Sanity.io.

example

Acknowledgements

Big thanks to the original contributors for their work!

Disclaimer

Sometimes a table is just what you need. However, before using the Table plugin, consider if there are other ways to model your data that are:

  • easier to edit and validate
  • easier to query

Approaching your schemas in a more structured manner can often pay dividends down the line.

Install

Install using npm

$ npm i --save @sanity/table

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/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',
          },
        ],
      },
    ],
  },
});

Configuration

You can optionally configure the _type used for the row object in the table schema by passing a rowType when adding the plugin. For most users this is unnecessary, but it can be useful if you are migrating from a legacy table plugin.

export default defineConfig({
  // ...
  plugins: [
    table({
      rowType: 'my-custom-row-type',
    }),
  ],
  // ...
});

License

MIT © ʞunp ʇɹǝdnɹ, Mathis Bullinger, Dave Lucia and Sanity.io

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.

Release new version

Run "CI & Release" workflow. Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.

Keywords

FAQs

Package last updated on 17 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc