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

responsive-react-actionsheet

v1.1.2

Published

Lightweight responsive action sheet / bottom sheet for React — self-injecting styles, themeable colors, zero dependencies, TypeScript types

Readme

responsive-react-actionsheet

Lightweight responsive action sheet with animation for React web applications

NPM License

  • No stylesheet import — the component injects its own styles
  • Themeable via props or CSS custom properties
  • SSR safe, ships ESM + CJS with TypeScript types
  • Zero runtime dependencies

Install

npm install --save responsive-react-actionsheet

React 16.8 or newer is required (it is a peer dependency).

Demo

All three example variants, in order — with a cancel button, without one, and a fully themed dark sheet driven by the color props. Run it yourself:

cd example && npm install && npm run dev

Usage

One import. The stylesheet is injected automatically the first time a sheet mounts.

import React, { useState } from 'react'

import Actionsheet from 'responsive-react-actionsheet'

const menus = ['Modes', 'Profile', 'Settings']

const App = () => {
  const [visible, setVisible] = useState(false)
  const [selected, setSelected] = useState('')

  const handleActionClick = (i: number) => {
    setSelected(menus[i])
    setVisible(false)
  }

  return (
    <>
      <button onClick={() => setVisible(true)}>Open</button>

      <Actionsheet
        visible={visible}
        menus={menus}
        onClick={handleActionClick}
        onRequestClose={() => setVisible(false)}
        showCancelButton
        cancelText='Custom Cancel text'
        // the four color props are optional — omit them for the light default
        backgroundColor='#1f2430'
        textColor='#e6e6e6'
        cancelTextColor='#7dd3fc'
        overlayColor='rgba(0, 0, 0, 0.7)'
      />

      <h4>{selected}</h4>
    </>
  )
}

export default App

Reference

API

| Property | description | Type | Default | | ------------------ | ---------------------------------------------- | ------------------------------- | -------------------- | | visible | handles visibility of the action sheet | boolean | false | | menus | array of list items to show | string[] | - | | onClick | handle click on list items | function(index: number) => void | - | | onRequestClose | function to close the action sheet | function() => void | - | | showCancelButton | flag to show or hide the cancel button | boolean | false | | cancelText | modify cancel text if showCancelButton is true | string | 'Cancel' | | backgroundColor | surface color of the menu and cancel sheets | string | rgba(246,246,246,.9) | | textColor | color of the menu item labels | string | #000 | | cancelTextColor | color of the cancel button label | string | #ff7878 | | overlayColor | color of the backdrop behind the sheet | string | rgba(0,0,0,.5) |

Styling

The four color props are independent — pass only the ones you want to change, and the rest fall back to the defaults in the table above.

Each prop sets a CSS custom property on the sheet's root element, so you can also theme it from your own stylesheet without touching props — useful for media queries or a global dark mode:

.ras-actionsheet {
  --ras-bg: #1f2430;
  --ras-text: #e6e6e6;
  --ras-cancel-text: #7dd3fc;
  --ras-overlay: rgba(0, 0, 0, 0.7);
}

For anything beyond color, the class names are stable and unhashed: ras-actionsheet, ras-show, ras-backdrop, ras-wrap, ras-menu, ras-menu-item, ras-cancel, ras-cancel-btn.

Upgrading from 1.0.x

Existing code keeps working. Two things worth knowing:

  • The CSS import is no longer needed. import 'responsive-react-actionsheet/dist/index.css' still resolves and is still published, so you do not have to remove it — it is simply redundant now. Loading it alongside the injected copy is harmless.
  • onClick now receives a real number. It previously handed back the raw data-id attribute, which was the string "0", "1", … despite the docs and types promising a number. If you were comparing strictly (i === '1') or concatenating the argument, update those call sites.

The React peer range is now ^16.8 || ^17 || ^18 || ^19; React 16.0–16.7 are no longer supported, because the component uses hooks to inject its styles.

Development

npm install          # installs and builds
npm run verify       # generated-file check, lint, typecheck, tests, build
npm test             # unit tests only

Styles are authored in src/styles.css. That file is the single source of truth: scripts/generate-styles.mjs turns it into src/styles.ts (which is what gets injected at runtime) and scripts/copy-css.mjs copies it to dist/index.css for the legacy import path. Both run automatically as part of npm run build and npm test — edit the .css, never the generated .ts.

To run the demo app:

cd example && npm install && npm run dev

License

MIT © codeAesthetic