Socket
Socket
Sign inDemoInstall

rc-align

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-align

align ui component for react


Version published
Weekly downloads
1.2M
decreased by-4.2%
Maintainers
1
Weekly downloads
 
Created

What is rc-align?

The rc-align package is a React component that provides functionality for aligning elements relative to other elements. It is useful for creating tooltips, dropdowns, and other UI components that need to be positioned dynamically based on the position of other elements.

What are rc-align's main functionalities?

Basic Alignment

This feature allows you to align an element relative to a target element. In this example, the aligned element is positioned such that its top-left corner is aligned with the bottom-left corner of the target element.

import Align from 'rc-align';

const Example = () => (
  <Align
    target={() => document.getElementById('target-element')}
    align={{ points: ['tl', 'bl'] }}
  >
    <div>Aligned Element</div>
  </Align>
);

Dynamic Alignment

This feature allows for dynamic alignment that adjusts when the window is resized. The aligned element is positioned with an additional offset of 10 pixels below the target element.

import Align from 'rc-align';

const Example = () => (
  <Align
    target={() => document.getElementById('target-element')}
    align={{ points: ['tl', 'bl'], offset: [0, 10] }}
    monitorWindowResize
  >
    <div>Aligned Element</div>
  </Align>
);

Custom Target

This feature allows you to specify a custom target for alignment. Instead of aligning to an existing DOM element, you can provide custom coordinates and dimensions.

import Align from 'rc-align';

const Example = () => (
  <Align
    target={() => ({ left: 100, top: 200, width: 50, height: 50 })}
    align={{ points: ['tl', 'bl'] }}
  >
    <div>Aligned Element</div>
  </Align>
);

Other packages similar to rc-align

Keywords

FAQs

Package last updated on 07 Aug 2015

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