1.2.4 • Published 10 months ago

@madebythread/thread-kit v1.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@madebythread/thread-kit

A collection of opinionated plugins, fields, & components for building in Sanity Studio. Some plugins have been adapted from various users to better fit our needs.

Installation

npm install @madebythread/thread-kit

Features & Usage

Character Count Input

Adds a little character count tag to a text or string field.

Add as a component input:

  • The character limit is pulled from .max() rule. The default is 160
import { CharacterCountInput } from '@madebythread/thread-kit'

defineField({
  name: 'title',
  type: 'string',
  components: {input: CharacterCountInput},
  validation: (Rule) => Rule.required().max(70),
}),

Link

All credit to Sanity Plugin Link Field – This is just a modified/simplified version of their plugin. See their documentation for more.

Modifications:
  • No custom Links
  • Adjusted input styling
  • Text by default
  • Validation requirements for all fields

Setup plugin in sanity.config.ts:

import { linkField } from '@madebythread/thread-kit'

export default defineConfig({
  //...
  plugins:[
    //...
    linkField({
      linkableSchemaTypes: pageTypes,
      enableAnchorLinks: false, //optional default is true
      enableLinkParameters: false //optional default is true
    })

  ]
})

defineSlug

This is a slug input field that allows for folder a prefix. This component is dapted from hdoro's slug plugin

For frontend: can query for slug.fullUrl and get the prefix. But you still have access to slug.current

import { defineSlug } from '@madebythread/thread-kit'

defineSlug({
  name: 'slug', //required
  options: {
    url: URL, //required to show full url
    folder: 'podcast/media', //optional
    locked: true, //optional
  },
}),

Forms

Coming Soon

License

MIT © Kegan Sovay

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.

1.2.4

10 months ago

1.2.3

10 months ago

1.2.0

10 months ago

1.2.2

10 months ago

1.2.1

10 months ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago