Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@ircam/gui-components
Advanced tools
Readme
Set of simple gui components (to be extended)
npm install [--save] @ircam/gui-components
import { Slider} from '@ircam/gui-components';
const slider = new Slider({
mode: 'jump',
container: '#container',
default: 0.6,
markers: [0.5],
callback: (value) => console.log(value),
});
Versatile canvas based slider.
Kind: inner class of gui-components
Param | Type | Default | Description |
---|---|---|---|
options | Object | Override default parameters. | |
[options.mode] | 'jump' | 'proportionnal' | 'handle' | 'jump' | Mode of the slider: - in 'jump' mode, the value is changed on 'touchstart' or 'mousedown', and on move. - in 'proportionnal' mode, the value is updated relatively to move. - in 'handle' mode, the slider can be grabbed only around its value. |
[options.callback] | function | Callback to be executed when the value of the slider changes. | |
[options.width] | Number | 200 | Width of the slider. |
[options.height] | Number | 30 | Height of the slider. |
[options.min] | Number | 0 | Minimum value. |
[options.max] | Number | 1 | Maximum value. |
[options.step] | Number | 0.01 | Step between each consecutive values. |
[options.default] | Number | 0 | Default value. |
[options.container] | String | Element | 'body' | CSS Selector or DOM element in which inserting the slider. |
[options.backgroundColor] | String | '#464646' | Background color of the slider. |
[options.foregroundColor] | String | 'steelblue' | Foreground color of the slider. |
[options.orientation] | 'horizontal' | 'vertical' | 'horizontal' | Orientation of the slider. |
[options.markers] | Array | [] | List of values where markers should be displayed on the slider. |
[options.showHandle] | Boolean | true | In 'handle' mode, define if the draggable should be show or not. |
[options.handleSize] | Number | 20 | Size of the draggable zone. |
[options.handleColor] | String | 'rgba(255, 255, 255, 0.7)' | Color of the draggable zone (when showHandle is true ). |
Example
import { Slider} from 'gui-components';
const slider = new Slider({
mode: 'jump',
container: '#container',
default: 0.6,
markers: [0.5],
callback: (value) => console.log(value),
});
Number
Current value of the slider.
Kind: instance property of Slider
Reset the slider to its default value.
Kind: instance method of Slider
Resize the slider.
Kind: instance method of Slider
Param | Type | Description |
---|---|---|
width | Number | New width of the slider. |
height | Number | New height of the slider. |
BSD-3-Clause
FAQs
Set of simple GUI components
The npm package @ircam/gui-components receives a total of 6 weekly downloads. As such, @ircam/gui-components popularity was classified as not popular.
We found that @ircam/gui-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.