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

@radix-ui/react-popper

Package Overview
Dependencies
Maintainers
6
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-popper

  • 1.1.2-rc.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.5M
decreased by-4.15%
Maintainers
6
Weekly downloads
 
Created

What is @radix-ui/react-popper?

@radix-ui/react-popper is a React component library that provides a set of primitives for creating popper elements, such as tooltips, dropdowns, and other floating elements. It leverages the Popper.js library to handle positioning and provides a highly customizable and accessible API.

What are @radix-ui/react-popper's main functionalities?

Basic Popper

This example demonstrates a basic popper setup with an anchor element and a popper content element.

```jsx
import { Popper } from '@radix-ui/react-popper';

function BasicPopper() {
  return (
    <Popper>
      <Popper.Anchor>
        <button>Anchor</button>
      </Popper.Anchor>
      <Popper.Content>
        <div>Popper Content</div>
      </Popper.Content>
    </Popper>
  );
}
```

Custom Positioning

This example shows how to customize the positioning of the popper content relative to the anchor element by setting the `placement` prop.

```jsx
import { Popper } from '@radix-ui/react-popper';

function CustomPositioningPopper() {
  return (
    <Popper placement="right">
      <Popper.Anchor>
        <button>Anchor</button>
      </Popper.Anchor>
      <Popper.Content>
        <div>Popper Content</div>
      </Popper.Content>
    </Popper>
  );
}
```

Transition Effects

This example demonstrates how to add transition effects to the popper content by controlling the `open` state and using CSS for animations.

```jsx
import { Popper } from '@radix-ui/react-popper';
import { useState } from 'react';

function TransitionPopper() {
  const [open, setOpen] = useState(false);

  return (
    <Popper open={open} onOpenChange={setOpen}>
      <Popper.Anchor>
        <button onClick={() => setOpen(!open)}>Toggle Popper</button>
      </Popper.Anchor>
      <Popper.Content>
        <div className="popper-content">Popper Content</div>
      </Popper.Content>
    </Popper>
  );
}
```

Other packages similar to @radix-ui/react-popper

FAQs

Package last updated on 17 May 2023

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