Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@radix-ui/react-portal
Advanced tools
The @radix-ui/react-portal package is a React component library that allows you to render components in a different part of the DOM than their parent components. This is particularly useful for rendering modals, tooltips, and other floating elements that need to break out of the normal document flow to avoid issues with overflow, z-index, and CSS inheritance.
Rendering children in a portal
This feature allows you to render a React component or any JSX outside of its parent component's DOM hierarchy. The code sample demonstrates how to use the Portal component to render a div element at the end of the document body.
{"import { Portal } from '@radix-ui/react-portal';\n\nconst MyComponent = () => (\n <Portal>\n <div>\n This will be rendered outside the parent DOM hierarchy.\n </div>\n </Portal>\n);"}
The 'react-portal' package provides similar functionality to '@radix-ui/react-portal' by allowing elements to be rendered in a portal. It is a more established package with a larger user base, but '@radix-ui/react-portal' is part of the Radix UI design system, which might offer better integration with other Radix components.
While not a direct equivalent, 'react-dom' provides the 'createPortal' API which is the underlying React feature that '@radix-ui/react-portal' and other portal libraries utilize to render components in different parts of the DOM. 'react-dom' is a part of the official React library.
react-portal
$ yarn add @radix-ui/react-portal
# or
$ npm install @radix-ui/react-portal
View docs here.
FAQs
Unknown package
The npm package @radix-ui/react-portal receives a total of 5,641,263 weekly downloads. As such, @radix-ui/react-portal popularity was classified as popular.
We found that @radix-ui/react-portal demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
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.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.