Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solenya-slider

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solenya-slider

A custom slider for solenya that:

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Solenya Slider

A custom slider for solenya that:

  • Optionally displays the current value
  • Optionally displays ticks or labeled ticks
  • Works consistently across all major browsers (including IE11) and mobile devices
  • Bypasses the inputRange control, to allow customisation without excessive browser-dependent css hacking
  • Internally leverages the interactjs library to ensure compatability with touch devices
  • Accessibility Support

Installation

npm solenya-slider

Playground / Demo

https://stackblitz.com/edit/solenya-slider

Usage

The usage of slider is as follows:

export class SliderTest extends Component
{
    rating = 70
    
    view() {
        return slider({
            target: this,
            prop: () => this.rating,
            min: 0,
            max: 100,
            style: {                  
                ticks: "ticks",
                thumbWidth: 50
            }
        })             
    }}

The visualisation of the current value can be a function of the underlying numeric value. For example:

            style: {                  
                ...
                currentLabel: n => n + "%"
            }

The style property has common styling properties for sliders. However, for low level control we can set the attributes for each part of the slider. For example, here we customize the border of the slider thumb:

        return slider({
            ....
            thumbAttrs: {
                boxShadow: "4px 4px 4px rgba(0, 0, 0, .2), 0 0 8px"
            }
        })  

You can set the focused styling of the thumb and label with the thumbFocus or labelFocus properties. For example:

        return slider({
            ....
            style: {
                thumbFocus: {
                    backgroundColor: "hotpink"
                },
                labelFocus: {
                    color: "white"
                }
            }
        })  

Future Improvements

Possible future improvements:

  • More extensibility
  • Vertical orientation
  • Select a range of values
  • Quick default styling for thumb (e.g. inline, outside, none)

The code is small, so copy the source code to customize yourself if necessary.

FAQs

Package last updated on 29 Mar 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc