sanity-plugin-user-select-input
Custom Input for selecting a User from the Project and storing the ID as a string.
Note: Think of the string like a weak reference. Users can be removed from the Project without first checking if their ID is used in any Document. And once removed their ID will remain stored as the field value.
This is not a replacement for creating your own schema for example staff
, author
, profile
, person
etc but rather useful for linking a Document to a Project User. For example brief
, task
, reviewer
etc
Installation
sanity install user-select-input
You have two options:
Fast: Import a helper function and customise the field's name
import {userSelectField} from 'sanity-plugin-user-select-input'
export default {
fields: [
userSelectField('reviewer'),
],
}
Customisable: Import just the Component to use in your own field:
import UserSelectInput from 'sanity-plugin-user-select-input'
export default {
fields: [
{
name: 'reviewer',
title: 'Task Reviewer',
description: 'Select a User',
type: 'string',
inputComponent: UserSelectInput,
},
],
}
License
MIT © Simeon Griggs
See LICENSE