Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-overlays

Package Overview
Dependencies
Maintainers
2
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-overlays

Utilities for creating robust overlay components

  • 3.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
960K
decreased by-14.89%
Maintainers
2
Weekly downloads
 
Created

What is react-overlays?

The react-overlays package provides a set of components and utilities for creating overlays, modals, tooltips, and other UI elements that float above the main content. It is designed to be flexible and customizable, making it easy to integrate into various React applications.

What are react-overlays's main functionalities?

Modal

The Modal component allows you to create a modal dialog that can be shown or hidden based on the component's state. The example demonstrates how to toggle the visibility of the modal using a button.

```jsx
import React, { useState } from 'react';
import { Modal } from 'react-overlays';

function Example() {
  const [show, setShow] = useState(false);

  const handleClose = () => setShow(false);
  const handleShow = () => setShow(true);

  return (
    <div>
      <button onClick={handleShow}>Show Modal</button>
      <Modal show={show} onHide={handleClose}>
        <div>
          <h4>Modal Title</h4>
          <button onClick={handleClose}>Close</button>
        </div>
      </Modal>
    </div>
  );
}

export default Example;
```

Tooltip

The Tooltip component, used in conjunction with OverlayTrigger, allows you to display a tooltip when the user hovers over or focuses on an element. The example shows how to attach a tooltip to a button.

```jsx
import React from 'react';
import { OverlayTrigger, Tooltip } from 'react-overlays';

function Example() {
  const renderTooltip = (props) => (
    <Tooltip {...props}>Tooltip content</Tooltip>
  );

  return (
    <OverlayTrigger placement="right" overlay={renderTooltip}>
      <button>Hover me</button>
    </OverlayTrigger>
  );
}

export default Example;
```

Dropdown

The Dropdown component provides a way to create dropdown menus. The example demonstrates a simple dropdown with a toggle button and a menu containing several items.

```jsx
import React from 'react';
import { Dropdown } from 'react-overlays';

function Example() {
  return (
    <Dropdown>
      <Dropdown.Toggle>Dropdown Button</Dropdown.Toggle>
      <Dropdown.Menu>
        <Dropdown.Item eventKey="1">Action</Dropdown.Item>
        <Dropdown.Item eventKey="2">Another action</Dropdown.Item>
        <Dropdown.Item eventKey="3">Something else</Dropdown.Item>
      </Dropdown.Menu>
    </Dropdown>
  );
}

export default Example;
```

Other packages similar to react-overlays

Keywords

FAQs

Package last updated on 20 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc