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

react-handy-modal

v1.0.4

Published

<img src="./src/assets/TSKYPP-logo.png" alt="TSKYPP Logo" style="width:100%; height:300px; border: 1px solid #ccc; border-radius: 10px; box-shadow: 3px 3px 5px #888;"> <br>

Downloads

8

Readme

react-handy-modal

Table

Installation

To install, you can use npm or yarn:

  • npm install or yarn add .
  $ npm install react-handy-modal
  $ yarn add react-handy-modal

Packages

You can install the latest version by using: | Name | Version | | :-------------------------------------------------------------------------------- | :-----------------------------------------------: | | react-handy-modal | [1.0.1 ] |

Example

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:

Basic

import { Dialog, Button, Flex } from "react-handy-modal";

Use as a component:

<div>
  <Dialog.Root>
    <Dialog.Trigger>
      <Button
        variant="solid"
        textColor="rgb(251, 251, 251)"
        bgColor="rgb(47, 46, 46)"
      >
        Open Modal
      </Button>
    </Dialog.Trigger>
    <Dialog.Content position={"slide-up"}>
      <Dialog.Title>Opened Modal</Dialog.Title>
      <Dialog.Description>Lorem ipsum dolor, sit amet</Dialog.Description>
      <Flex gap="20px" mt="60px" justify="end">
        <Dialog.Cancel>
          <Button variant="soft">Cancel</Button>
        </Dialog.Cancel>

        <Dialog.Action>
          <Button variant="solid" bgColor="rgb(30, 75, 210">
            Do something
          </Button>
        </Dialog.Action>
      </Flex>
    </Dialog.Content>
  </Dialog.Root>
</div>

Props

The Flex component accepts the following props:

  • gap (string, optional): Gap between child elements within the flex container.

  • mt (string, optional): Top margin for the flex container.

  • justify (string, optional): Horizontal alignment of child elements within the flex container.

The Content component accepts the following props:

  • position (string, optional): Position of the dialog content (either 'default' or custom).

The Button component accepts the following props:

  • textColor (string, optional): Text color of the button.
  • variant (string, optional): Button style, which can be 'solid', 'soft', or any other value.
  • bgColor (string, optional): Background color of the button.

Customization Options

Here are the customization options for the modal:

Adjust Gap Between Child Elements:

  • To change the gap between child elements within the flex container, use the gap prop.

  • You can specify the desired gap as a string value.

Set Top Margin:

  • Modify the top margin of the flex container by using the mt prop.

  • Provide the desired margin value as a string.

Horizontal Alignment of Child Elements:

  • Customize the horizontal alignment of child elements within the flex container by setting the justify prop.
  • You can choose from options like 'flex-start', 'center', 'flex-end', or any other valid alignment value.

Change Animation Position:

  • The modal provides animation options for sliding up , sliding down and fade In.

  • You can set the animation position by specifying the position prop when rendering the Content component. Choose either 'slide-up','slide-down' based on your preference.

Button Text and Style:

  • Change the text displayed on the button by providing content as the component's children.

  • Adjust the text color and background color of the button by using the textColor and bgColor props, respectively.

Button Style Variant:

  • Customize the button's style by setting the variant prop to either 'solid' or 'soft' for different border radius styles.

  • You can also specify any other value to create a different style.

Additional Style Changes

  • For more extensive style changes within the components, you can modify the CSS styles directly in your code where they are defined.

  • Look for the styles associated with each component and make adjustments as needed to achieve your desired appearance and behavior.

Demos

import { Dialog, Button, Flex } from "react-easy-modal";

const Sample = () => {
  return (
    <div style={{ padding: "20px" }}>
      <Dialog.Root>
        <Dialog.Trigger>
          {/*  you can control Button (variant = soft or solid) */}
          <Button
            variant="solid"
            textColor="rgb(251, 251, 251)"
            bgColor="rgb(47, 46, 46)"
          >
            Open Modal
          </Button>
        </Dialog.Trigger>

        {/*  you can control  (full-screen or slide-up/down ) */}
        <Dialog.Content position={"slide-up"}>
          <Dialog.Title>Opened Modal</Dialog.Title>

          <Dialog.Description>
            Lorem ipsum dolor, sit amet consectetur adipisicing elit. Unde eum,
            delectus adipisci ducimus.
          </Dialog.Description>

          {/*  you can control flex */}
          <Flex gap="20px" mt="60px" justify="end">
            <Dialog.Cancel>
              <Button variant="soft">Cancel</Button>
            </Dialog.Cancel>

            <Dialog.Action>
              <Button variant="solid" bgColor="rgb(30, 75, 210)">
                Do something
              </Button>
            </Dialog.Action>
          </Flex>
        </Dialog.Content>
      </Dialog.Root>
    </div>
  );
};

export default Sample;

Contributors

Thanks goes to these wonderful people.......