@blockly/field-slider
A Blockly slider field.
Installation
Yarn
yarn add @blockly/field-slider
npm
npm install @blockly/field-slider --save
Usage
This field is an extension of the Blockly.FieldNumber field. See the Blockly.FieldNumber documentation on what parameters and configurations this field supports.
JavaScript
import * as Blockly from 'blockly';
import {FieldSlider} from '@blockly/field-slider';
Blockly.Blocks['test_field_slider'] = {
init: function () {
this.appendDummyInput()
.appendField('slider: ')
.appendField(new FieldSlider(50), 'FIELDNAME');
},
};
JSON
import * as Blockly from 'blockly';
import '@blockly/field-slider';
Blockly.defineBlocksWithJsonArray([
{
type: 'test_field_slider',
message0: 'slider: %1',
args0: [
{
type: 'field_slider',
name: 'FIELDNAME',
value: 50,
},
],
},
]);
License
Apache 2.0