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

@pearson-ux/range-slider

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pearson-ux/range-slider

Input range slider web component

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

Pearson Range Slider Web Component

Table of Contents

  1. Demo
  2. Install
  3. Usage
  4. API
    1. Attributes
    2. Events
  5. React

A shareable, accessible input range slider

Demo

https://pearson-ux.github.io/web-components/range-slider/

Installation

Run the following in your terminal:

# my-app is the directory containing your app
cd my-app
npm install --save @pearson-ux/range-slider

Usage

Import the web component onto the page, inbetween the <head> tags, like so:

<head>
  <!-- Polyfills -->
   <script type="text/javascript">
     if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
       document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/webcomponents-loader.js"><\/script>');
       document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/custom-elements-es5-adapter.js"><\/script>');
     } else {
       document.write('<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-loader.js"><\/script>');
       document.write('<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/custom-elements-es5-adapter.js"><\/script>');
     }
   </script>
   <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

  <!-- Web component script -->
   <script src="path/to/pearson-range-slider.js"></script>

</head>

Important Notes:

  1. The import path will be in the node_modules folder, which is usually held outside the applicaiton source. If you publish your application to a ./public or ./dist folder you will want to write a script to copy this dependency to a desired location.

Add the pearson-range-slider open and closing tags to the page.

API

Attributes

All attributes in this API are optional.

AttributeTypeDefaultDescription
minBoolunsetSet the minimum number of the slider.
maxStringunsetSet the maximum number of the slider
stepStringunsetThe stepping interval
toptextStringunsetText that is centered above the slider
righttextStringunsetText that is to the right of the slider
inputBoolBOOLSetting to true, adds an optional input box to control the slider
bottomtextStringunsetText that is below the input

Emitted Events

EventDescription
changeWill fire when the range-slider drags across the bar or when an input value is entered.

React

To use these web components in your react application do the following. First install the component.

npm  install --save @pearson-ux/range-slider

Import your component on the page you would like to use it on

import "@pearson-ux/range-slider";

Then use the markup in your JSX code. You can pass props in to available API attributes.

render () {
   return (
      <div>
		<pearson-range-slider min="0" max="5" step="any" toptext="Target Weight" bottomtext="" righttext="lb"></pearson-range-slider>
      </div>
   )
}

Keywords

FAQs

Package last updated on 07 Nov 2019

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