Socket
Socket
Sign inDemoInstall

@react-md/portal

Package Overview
Dependencies
5
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @react-md/portal

This package is for including icons within react-md. There is included support for both font icons and SVG icons. There is also a helper component for applying spacing between icons and text.


Version published
Maintainers
1
Install size
37.0 kB
Created

Changelog

Source

5.1.0 (2022-03-18)

Bug Fixes

  • @react-md/app-bar: AppBarTitle now applies flex: 1 1 auto (4a47c92)
  • @react-md/tooltip: Tooltips stay visible on mobile Firefox (7039fef)

Features

  • @react-md/menu: Provide props for Menu's List (2b5fb23)
  • @react-md/tooltip: useTooltip supports new disabled option (a934ae9)

Documentation

  • @react-md/tooltip: Remove documentation around Tooltipped component (1a59190), closes #1367

Other Internal Changes

  • removed old eslint rules (88eb2b2)
  • run lint-scripts --fix for consistent-type-imports (42d839d)
  • Updated the v5.0.0 release notes (6106751)
  • @react-md/dev-utils: Fix indexer for consistent-type-imports (2d2d1e9)
  • @react-md/form: bump nanoid from 3.2.0 to 3.3.1 (e625488)
  • react-md.dev: Add demo for rendering DropdownMenus as a Grid (3ac42ef)
  • react-md.dev: Do not lazy load icons through next/head (47ccc1d)
  • react-md.dev: Fix 404 page for sandboxes (4772c88)
  • react-md.dev: Fix tooltip dense demo (efc7f8c)
  • react-md.dev: Fix usage of useTooltip when it is conditionally applied (cfca184)
  • react-md.dev: Update examples for useTooltip disabled option (f318ecf)
  • stylelint: bump stylelint plugins to latest (2bb6429)

Readme

Source

@react-md/portal

The Portal component is a simple wrapper with React's createPortal API that will automatically generate portal nodes behind the scenes as needed. Unlike the majority of react-md packages, this package does not export any styles.

Installation

npm install --save @react-md/portal

Documentation

You should check out the full documentation for live examples and more customization information, but an example usage is shown below.

Usage

The main purpose of the Portal is to be able to fix overflow issues for fixed elements within the page. If you have overflow set to anything other than the default value, fixed elements might not appear correctly. To work around this, you can portal that fixed element to a different part of the page and it'll fix the problem. If none of this makes sense to you at a first glance, you probably don't need this package.

The example below will just show the API for the portal and not a real world example.

import { useState } from "react";
import { render } from "react-dom";
import { Portal } from "@react-md/portal";

const App = () => {
  const [visible, setVisible] = useState(false);

  return (
    <>
      <button
        id="example-button"
        type="button"
        onClick={() => setVisible((prevVisible) => !prevVisible)}
      >
        Show Portal
      </button>
      <Portal>
        {visible && (
          <h3>
            This is some portalled text that will only appear when{" "}
            <code>visible</code>
          </h3>
        )}
      </Portal>
    </>
  );
};

render(<App />, document.getElementById("root"));

Keywords

FAQs

Last updated on 18 Mar 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc