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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-aria-gradient-slider

v0.0.2

Published

A gradient slider built with React Aria.

Readme

react-aria-gradient-slider

A gradient slider component built with React Aria.
Supports adding, removing, dragging, and editing color stops with keyboard accessibility.

Demo

https://react-aria-gradient-slider.vercel.app

Features

  • Add and drag color stops on a gradient track
  • Automatic interpolated color insertion when adding stops (adjustable via drag)
  • Oklab / Oklch support via culori
  • Headless API using render props
  • Keyboard and screen reader accessibility via React Aria
  • Controlled state via value / onChange (uncontrolled component not supported)

Installation

npm install react-aria-gradient-slider

API

Components

<GradientSlider>
  <Label />
  <SliderTrack>
    {({ background }) => (
      <ColorStop>
        {({ background, isFocusVisible }) => ()}
      </ColorStop>
    )}
  </SliderTrack>
  <ColorInput>
    {({ value, onChange }) => ()}
  </ColorInput>
  <RemoveStop>
    {({ onPress, isDisabled }) => ()}
  </RemoveStop>
  <AddStop>
    {({ onPress, isDisabled }) => ()}
  </AddStop>
</GradientSlider>

<GradientSlider>

Root container that provides context to all child components.
Only newly added props are shown. defaultValue / onChangeEnd are not supported.

| Props | Types | Description | Required | | --------------- | -------------------------------------- | --------------------------------------- | ------------ | | value | ColorStops | Controlled color stops | Yes | | onChange | Dispatch<SetStateAction<ColorStops>> | Callback when color stops change | Yes | | mode | "oklab" \| "oklch" | Color space used for interpolation | Yes | | selectedId | SelectedId | ID of the currently selected color stop | Conditional¹ | | setSelectedId | Dispatch<SetStateAction<SelectedId>> | Callback to update the selected stop | Conditional¹ |

¹ selectedId and setSelectedId must both be provided or both omitted.

<SliderTrack>

Renders the gradient track.
Render props: { background: string }

<ColorStop>

Renders a draggable thumb for each color stop.
Enter / Space to select a stop, Delete / Backspace to remove it.

| Props | Types | Description | Required | | ------- | -------- | -------------------------- | -------- | | index | number | Index in the value array | Yes |

Render props: { background: string, isFocusVisible: boolean }

<ColorInput>

Provides the color value and change handler for a specific color stop.

| Props | Types | Description | Required | | ----- | -------- | ---------------------------- | -------- | | id | string | ID of the color stop to edit | Yes |

Render props: { value: Color, onChange: (color: Color) => void }

<RemoveStop>

Provides a handler to remove a specific color stop. Disabled when only 2 stops remain.

| Props | Types | Description | Required | | ----- | -------- | ------------------------------ | -------- | | id | string | ID of the color stop to remove | Yes |

Render props: { onPress: () => void, isDisabled: boolean }

<AddStop>

Provides a handler to add a new color stop.
By default, adds to the right of the selected stop (or the first stop). Pass id to specify the reference stop.

| Props | Types | Description | Required | | ----- | -------- | ------------------------ | -------- | | id | string | ID of the reference stop | No |

Render props: { onPress: () => void, isDisabled: boolean }

Hooks

useGradientSliderState(props)

Manages gradient slider state (wraps React Stately's useSliderState)

useGradientSlider(props, state, trackRef)

Provides ARIA behavior for the gradient slider track (wraps React Aria's useSlider)

useColorStop(opts, state)

Provides ARIA behavior for an individual color stop thumb (wraps React Aria's useSliderThumb)

Types

| Types | Definition | | ------------ | --------------------------------------------- | | ColorStop | { id: string; value: number; color: Color } | | ColorStops | [ColorStop, ColorStop, ...ColorStop[]] | | Mode | "oklab" \| "oklch" | | SelectedId | string \| null |

Note: ColorStop is not exported on its own. Color is a React Stately type.

Development

bun install        # Install dependencies
bun run play       # Start playground
bun run build      # Build the library
bun run test       # Run tests
bun run typecheck  # Type check
bun run lint       # Lint
bun run fmt        # Format

License

MIT