npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

woby-slider

v1.0.4

Published

<p align="center"> A fast & lightweight woby component as a drop in replacement for HTML5 input range slider element. </p>

Downloads

4

Readme

Woby-Slider

Ported from React-Rangeslider

Installation

Using npm (use --save to include it in your package.json)

$ npm install woby-slider --save

Using yarn (this command also adds woby-slider to your package.json dependencies)

$ yarn add woby-slider

Getting Started

Woby-slider is bundled with a slider component & default styles which can be overridden depending on your design requirements.

With a module bundler like webpack that supports either CommonJS or ES2015 modules, use as you would anything else:

// Using an ES6 transpiler like Babel
import { Slider } from 'woby-slider'

// To include the default styles
import 'woby-slider/lib/index.css'

// Not using an ES6 transpiler
var Slider = require('woby-slider')

The UMD build is also available on unpkg:

<script src="https://unpkg.com/woby-slider/umd/rangeslider.min.js"></script>

You can find the library on window.ReactRangeslider. Optionally you can drop in the default styles by adding the stylesheet.

<link rel="stylesheet" href="https://unpkg.com/woby-slider/umd/rangeslider.min.css" />

Check out docs & examples.

Basic Example

import { $, $$, useEffect, type JSX } from 'woby'
import { Slider } from "woby-slider"

function Horizontal() {
    // Initialize the state value
    const value = $<number>(10)

    // Event handler for the change event start
    const handleChangeStart = () => {
        console.log("Change event started")
    }

    // Event handler for the change event completion
    const handleChangeComplete = () => {
        console.log("Change event completed")
    }

    useEffect(() => console.log($$(value)))
    return (
        <div class="slider">
            <Slider
                min={0}
                max={100}
                value={value}
                onChangeStart={handleChangeStart}
                onChange={value}
                onChangeComplete={handleChangeComplete}
            />
            <div class="value">{value}</div>
        </div>
    )
}

export default Horizontal

API

Rangeslider is bundled as a single component, that accepts data and callbacks only as props.

Component

import Slider from 'woby-slider'

// inside render
<Slider
  min={Number}
  max={Number}
  step={Number}
  value={Number}
  orientation={String}
  reverse={Boolean}
  tooltip={Boolean}
  labels={Object}
  handleLabel={String}
  format={Function}
  onChangeStart={Function}
  onChange={Function}
  onChangeComplete={Function}
/>

Props

Prop | Type | Default | Description --------- | ------- | ------- | ----------- min | number | 0 | minimum value the slider can hold max | number | 100 | maximum value the slider can hold step | number | 1 | step in which increments/decrements have to be made value | number | | current value of the slider orientation | string | horizontal | orientation of the slider tooltip | boolean | true | show or hide tooltip reverse | boolean | false | reverse direction of vertical slider (top-bottom) labels | object | {} | object containing key-value pairs. { 0: 'Low', 50: 'Medium', 100: 'High'} handleLabel | string | '' | string label to appear inside slider handles format | function | | function to format and display the value in label or tooltip onChangeStart | function | | function gets called whenever the user starts dragging the slider handle onChange | function | | function gets called whenever the slider handle is being dragged or clicked onChangeComplete | function | | function gets called whenever the user stops dragging the slider handle.

Development

To work on the project locally, you need to pull its dependencies and run npm start.

$ npm install
$ npm start

Issues

Feel free to contribute. Submit a Pull Request or open an issue for further discussion.

License

MIT