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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@darksnow-ui/slider

v1.0.0

Published

slider component for DarkSnow UI

Readme

Slider

An input where the user selects a value from within a given range. Built on top of Radix UI Slider primitive.

Installation

npm install @darksnow-ui/slider

Peer Dependencies

npm install react react-dom

Usage

import { Slider } from "@darksnow-ui/slider"
import { useState } from "react"

export function SliderExample() {
  const [value, setValue] = useState([50])

  return (
    <div className="space-y-4">
      <Slider
        value={value}
        onValueChange={setValue}
        max={100}
        step={1}
        className="w-[60%]"
      />
      <div className="text-sm text-theme-content-muted">
        Value: {value[0]}
      </div>
    </div>
  )
}

Props

| Prop | Type | Default | Description | |----------------|-------------------|---------|--------------------------------| | value | number[] | - | Controlled value(s) | | defaultValue | number[] | [0] | Default value(s) | | onValueChange | function | - | Called when value changes | | min | number | 0 | Minimum value | | max | number | 100 | Maximum value | | step | number | 1 | Step increment | | orientation | "horizontal" | "vertical" | "horizontal" | Slider orientation | | disabled | boolean | false | Disables the slider | | className | string | - | Additional CSS classes |

Examples

Basic Slider

<Slider defaultValue={[33]} max={100} step={1} />

Range Slider

function RangeSlider() {
  const [value, setValue] = useState([20, 80])

  return (
    <div className="space-y-4">
      <Slider
        value={value}
        onValueChange={setValue}
        max={100}
        step={1}
        className="w-[60%]"
      />
      <div className="text-sm text-theme-content-muted">
        Range: {value[0]} - {value[1]}
      </div>
    </div>
  )
}

Vertical Slider

<Slider
  orientation="vertical"
  defaultValue={[33]}
  max={100}
  step={1}
  className="h-[200px]"
/>

Volume Control

function VolumeControl() {
  const [volume, setVolume] = useState([50])

  return (
    <div className="flex items-center space-x-4">
      <VolumeXIcon className="h-4 w-4" />
      <Slider
        value={volume}
        onValueChange={setVolume}
        max={100}
        step={1}
        className="flex-1"
      />
      <Volume2Icon className="h-4 w-4" />
      <span className="text-sm w-8">{volume[0]}</span>
    </div>
  )
}

Price Range Filter

function PriceRangeFilter() {
  const [priceRange, setPriceRange] = useState([100, 500])

  return (
    <div className="space-y-4">
      <div className="flex justify-between text-sm font-medium">
        <span>Price Range</span>
        <span>${priceRange[0]} - ${priceRange[1]}</span>
      </div>
      <Slider
        value={priceRange}
        onValueChange={setPriceRange}
        max={1000}
        min={0}
        step={10}
        className="w-full"
      />
      <div className="flex justify-between text-xs text-theme-content-muted">
        <span>$0</span>
        <span>$1000</span>
      </div>
    </div>
  )
}

Accessibility

  • Full keyboard support (Arrow keys, Home, End, Page Up, Page Down)
  • Screen reader accessible with proper ARIA attributes
  • Focus management and focus indicators
  • Value announcements for screen readers

Styling

The Slider component uses DarkSnow UI design tokens:

  • Track: Background track styling
  • Range: Filled range indication
  • Thumb: Interactive handle
  • Focus: Ring outline on focus
  • Disabled: Reduced opacity and disabled cursor

Best Practices

  1. Appropriate step size: Choose step increments that make sense for your use case
  2. Visual feedback: Provide clear visual indication of current value
  3. Range limits: Set appropriate min/max values
  4. Labels: Include labels or descriptions for context
  5. Responsive design: Consider touch targets on mobile devices

Related Components