Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sanity-io/unicorn-slider
Slider input for Sanity
https://github.com/sanity-io/unicorn-slider
Last synced: 13 days ago
JSON representation
Slider input for Sanity
- Host: GitHub
- URL: https://github.com/sanity-io/unicorn-slider
- Owner: sanity-io
- Archived: true
- Created: 2017-08-04T13:33:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T00:12:32.000Z (about 2 years ago)
- Last Synced: 2024-10-03T16:21:35.594Z (about 1 month ago)
- Language: CSS
- Size: 642 KB
- Stars: 2
- Watchers: 6
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-sanity - `unicorn-slider` - Sample input plugin implemented in the [Custom input widget guide](https://www.sanity.io/docs/extending/custom-input-widgets) (Plugins)
README
# unicorn-slider
Slider input for Sanityhttps://sanity.io
## Usage, standalone
```
git clone // this repo
npm install
npm run build
cd example/
npm install
sanity start
open http://localhost:3333
```## Usage as a Sanity plugin
```
cd my-sanity-studio
sanity install unicorn-slider
mkdir parts
touch parts/inputResolver.js
```Add this to `parts/inputResolver.js`:
```
import Slider from 'part:@sanity/base/components/unicorn-slider'
export default function resolveInput(type) {
if (type.name === 'number' && type.options && type.options.range) {
return Slider
}
}
```Add this to the `parts` array in your `sanity.json` file:
```
{
"implements": "part:@sanity/form-builder/input-resolver",
"path": "./parts/inputResolver.js"
}
```Add this to one of your schema types:
```
{
name: 'unicornCount',
title: 'Number of Unicorns',
type: 'number',
description: 'Half unicorns are okay',
options: {
range: {min: 0, max: 10, step: 0.5}
}
}
```