Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rdunk/sanity-plugin-table
Table schema type and input component for Sanity
https://github.com/rdunk/sanity-plugin-table
Last synced: 13 days ago
JSON representation
Table schema type and input component for Sanity
- Host: GitHub
- URL: https://github.com/rdunk/sanity-plugin-table
- Owner: rdunk
- License: mit
- Created: 2018-11-16T14:33:49.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T02:58:54.000Z (over 1 year ago)
- Last Synced: 2024-10-03T21:35:49.301Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 423 KB
- Stars: 35
- Watchers: 4
- Forks: 28
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sanity - `sanity-plugin-table` - Adds a new `type: 'table'` field type. (Plugins)
README
> **Notice**: Version 2.x of this plugin includes a breaking change, see the [Configuration](#configuration) section to migrate existing data.
![example](https://user-images.githubusercontent.com/8467307/48703530-e369be00-ebeb-11e8-8299-14812461aee8.gif)
## Install
Install using the [Sanity CLI](https://www.sanity.io/docs/cli).
```bash
$ sanity install table
```## Usage
Simply specify `table` as a field type in your schema.
```js
export default {
name: 'product',
title: 'Product',
type: 'document',
fields: [
{
name: 'sizeChart',
title: 'Size Chart',
type: 'table', // Specify 'table' type
},
],
};
```## Configuration
You can create a configuration file to provide the `_type` used for table row data. This is especially useful if you are upgrading or have existing data, as version `2.x` of this plugin uses `tableRow` by default, replacing `row` used in version `1.x`.
In your studio, create a `config/table.json` file (relative to the root directory). The `rowType` string value can be whatever you like. Use `row` if you are migrating existing data from version 1 to 2.
```json
{
"rowType": "row"
}
```## License
[MIT](http://opensource.org/licenses/MIT)