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

react-float-anchor

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-float-anchor

React component for positioning an element aligned to another

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2K
decreased by-13.37%
Maintainers
1
Weekly downloads
 
Created
Source

react-float-anchor

Circle CI npm version

This is a React component for anchoring a fixed position element, such as a dropdown menu, to the edge of an element on the page. The fixed position element will automatically be placed so that it fits on the screen if possible, and it will automatically reposition if needed when the user scrolls.

Example

The above example can be tried here:

https://streakyc.github.io/react-float-anchor/example/

You can find its code in the example directory. The example may be compiled by running:

npm install
npm run example-build

You can build the example with live editing enabled (using react-transform-hmr and browserify-hmr) by running:

npm run example-watch

FloatAnchor

This module exports the FloatAnchor React component, which takes the following props:

  • anchor must be a single React Element. This element will be placed in the page where the FloatAnchor element was used, with no added wrapper elements around it.
  • float must be null or a single React Element. This element will be placed in a container div which has position:fixed styling, is attached directly to the document body, and is positioned to line up with the anchor element.
  • options is an optional object of options to control how the float element is aligned to the anchor element. The options are the same as those supported by contain-by-screen (version ^1.0).

The FloatAnchor component has a reposition method, which you should call if you change the size of the contents of the anchor or float elements.

If you want interactive dropdown menus, check out the react-menu-list module that is built with this!

Types

Flow Type declarations for this module are included! As of Flow v0.22, you must add the following entries to your .flowconfig file's options section for them to work:

[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable

Keywords

FAQs

Package last updated on 07 Apr 2016

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