Skip to content

Latest commit

 

History

History

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

solid-knobs

solid-knobs

Table of contents

Component Properties

Components

Functions

Ranges

Namespaces

Components

Arc

Arc(props): Element

Arc is a simple utility component that returns a <path /> element for drawing an arc segment in an SVG element.

Parameters

Name Type
props ArcProps

Returns

Element


Control

Control(props): Element

The Control component implements a higher-level control that covers the most common use cases and takes care of accessibility. It uses ParameterGestureHandler under the hood and you should probably use Control instead of ParameterGestureHandler for most cases.

Example

import { Control } from 'solid-knobs';

...

<Control range={range} value={value()} onChange={setValue}>
  // your custom control visualisation goes here
</Control>

Parameters

Name Type
props ControlProps

Returns

Element


ImageStripControl

ImageStripControl(props): Element

Builds on top of the Control component, bringing easy-to-use support for image strip control graphics as generated by e.g. KnobMan.

Parameters

Name Type
props ImageStripControlProps

Returns

Element


ParameterGestureHandler

ParameterGestureHandler(props): any

The ParameterGestureHandler component doesn't render anything itself, it simply wraps an existing element and makes it behave like a control by giving it the following abilities:

  • Click and drag the element up/down to change the value.
  • Scroll on top of the element to change the value.
  • Hold shift while changing the value to change it more precisely.
  • After focusing the element, the up/down/left/right arrow keys can be used to nudge the value by different increments.

It also takes care of blocking user selection on the page while dragging.

Example

import { ParameterGestureHandler } from 'solid-knobs';

...

<ParameterGestureHandler {...props}>
 {ref =>
   <div ref={ref}>
     // custom visualisation code
   </div>
 }
</ParameterGestureHandler>

Parameters

Name Type
props ParameterGestureHandlerProps

Returns

any


ValueInput

ValueInput(props): JSX.Element

A glorified input element that formats the value according to a range and properly handles user input.

Parameters

Name Type
props ValueInputProps

Returns

JSX.Element

Functions

createSmoothedValue

createSmoothedValue(value, speed?, threshold?): Accessor<number>

A utility function that smoothly animates the changes of a numerical value.

Example

const [value, setValue] = createSignal(0.5);

const smoothedValue = createSmoothedValue(value);

createEffect(() =>
  console.log(smoothedValue())
);

Parameters

Name Type Default value Description
value () => number undefined The value to animate.
speed number 1 The relative speed at which to animate the value (optional, default = 1).
threshold number 0.001 How close the value has to be to the target for the animation to stop (optional, default = 0.001).

Returns

Accessor<number>

A SolidJS signal that contains the animated value.

Ranges

Range

Ƭ Range: ContinuousRange | ChoiceRange

A Range specifies the range, scale, and UI behaviours of a controlled value. There are two types of range: ContinuousRange and ChoiceRange.

Defined in

range/range.ts:8


RangeType: Object

The type of a range. Currently the only possible types are Continuous and Choice.

Defined in

range/range.ts:16

ContinuousRange: Object

The most common type of range that is used for continuous numerical values (e.g. frequency, volume, etc).

Defined in

range/range.ts:23

Scale: Object

The scaling of a ContinuousRange.

Defined in

range/range.ts:88

ChoiceRange: Object

A range that represents a finite number of choices with textual labels (think enums).

Defined in

range/range.ts:99

Choice: Object

Used by ChoiceRange.

Defined in

range/range.ts:116