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

@ijsto/react-slideout

v1.4.0

Published

Lightweight & Accessible React Slideout Component

Downloads

204

Readme

react-slideout

Accessible SlideOut component for React.JS

📖 Table of Contents

📦 Installation

To install, you can use npm:

$ npm install @ijsto/react-slideout

or yarn:

$ yarn add @ijsto/react-slideout

🔨 How to Use

Here is a simple example of react-modal being used in an app with some custom styles and focusable input elements within the modal content:

import React, { useState } from "react";
import SlideOut from "@ijsto/react-slideout";

const MySlideOut = () => {
  const [slideOutIsOpen, setSlideOutIsOpen] = useState(false);

  const openSlideOut = () => {
    setSlideOutIsOpen(true);
  };

  const closeSlideOut = () => {
    setSlideOutIsOpen(false);
  };

  return (
    <div>
      <button onClick={openSlideOut}>Open Modal</button>
      <SlideOut isOpen={slideOutIsOpen} onClose={closeSlideOut}>
        <h2>My Slide Out</h2>

        <div>This is the content inside React Slide Out component.</div>
        <button onClick={closeSlideOut}>Close slide-out</button>
      </SlideOut>
    </div>
  );
};

More examples are coming soon.

📜 API documentation

Props

The following propertiess are available:

| Property name | Type | Default | Description | | ------------------------- | ------------------------------------------------------------------ | --------------------- | --------------------------------------------------------------------------------------- | | bg | CSS Color | "white" | Any legal CSS color value component | | children | A React component | - | Any React component - this will appear in the slideout | | classNamePrefix | string | - | Namespace - will be applied to all SlideOut components | | closeComponent | React Component or html element | - | Custom close button component | | hideClose | boolean | false | Use this to hide close button. You can use parent component to handle state and toggle | | isOpen | boolean | - | Controls whether the slideout is visible | | max-width | CSS unit | 100% | Custom max-width of the the Slideout container. | offsetTop | CSS Unit | 0 | Offset slideout from top. Useful to account for the header height. | | onClose | function | internal state toggle | A function that will close the Slideout | | onCloseComponentKeyDown | function | - | Accessibility handler | | onCloseComponentKeyPress | function | - | Accessibility handler | | onCloseComponentKeyUp | function | - | Accessibility handler | | onOverlayKeyPress | function | - | Accessibility handler | | overflowShouldLock | Boolean | true | Locks the document body overflow-y | | overlayColor | HEX Color code | "#000000" (black) | Changes overlay color must be in HEX format (example: "#ffffff") | | overlayOpacity | integer from 0 to 1 | 0.5 | Changes default opacity of the overlay | | padding | CSS unit | - | Applied to the inner SlideOut container | | shouldCloseOnOverlayClick | boolean | true | To disable closing, when user clicks on overlay set shouldCloseOnOverlayClick={false} | | slideFrom | string | "left" | Determines the location from where slideout will appear | | speed | integer | 0.3s | Controls the speed of the slideout animation | | width | CSS unit | 350px | Custom width of the the Slideout | | zIndexIncrement | integer | 0 | Increments all zIndexes by the provided value. See default zIndexes below. |

Stacking (zIndexes)

By default Slideout components have the following zIndexes:

Here are the available classNames:

  • wrapper // 7
  • close-overlay // 8
  • body // 9

Styling

We provide more fine-grained control over all React-Slideout components via CSS class names.

Here are the available classNames:

  • wrapper // the top-level Slideout component
  • body // the Slideout component content
  • close-button //
  • close-component // wrapper that wrapper your custom close component
  • close-overlay // style overlay background, opacity, z-index etc.

🎬 Demos

Coming soon.

🗺️ Roadmap

  • Add entry from other sides
  • Add focus management system
  • Improve accessibility

🙆‍♂️ Contributions

Please feel free to submit PRs for the above (Roadmap) goals or otherwise

iJS.to