Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@radix-ui/react-dialog
Advanced tools
The @radix-ui/react-dialog package is a React component library that provides accessible and customizable dialog components. It allows developers to create modal dialogs, which are UI overlays that can contain text, forms, or other interactive elements. These dialogs are often used to capture user input or present information without navigating away from the current page.
Basic Dialog
This feature allows you to create a basic modal dialog with a trigger button. When the button is clicked, the dialog opens, displaying the content within a portal overlay. The dialog can be closed with the close button.
{"import * as Dialog from '@radix-ui/react-dialog';\n\nfunction App() {\n return (\n <Dialog.Root>\n <Dialog.Trigger>Open Dialog</Dialog.Trigger>\n <Dialog.Portal>\n <Dialog.Overlay />\n <Dialog.Content>\n <Dialog.Title>Dialog Title</Dialog.Title>\n <Dialog.Description>This is a basic dialog example.</Dialog.Description>\n <Dialog.Close>Close</Dialog.Close>\n </Dialog.Content>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}"}
Non-modal Dialog
This feature allows you to create a non-modal dialog, which does not lock the user's interaction with the rest of the application. The dialog can be opened and closed similar to a modal, but the background content remains interactive.
{"import * as Dialog from '@radix-ui/react-dialog';\n\nfunction App() {\n return (\n <Dialog.Root modal={false}>\n <Dialog.Trigger>Open Non-modal Dialog</Dialog.Trigger>\n <Dialog.Content>\n <Dialog.Title>Non-modal Dialog Title</Dialog.Title>\n <Dialog.Description>This is a non-modal dialog example.</Dialog.Description>\n <Dialog.Close>Close</Dialog.Close>\n </Dialog.Content>\n </Dialog.Root>\n );\n}"}
Animated Dialog
This feature demonstrates how to add animations to the dialog's overlay and content when they are being shown. Custom animations are defined using keyframes and applied to the styled components.
{"import * as Dialog from '@radix-ui/react-dialog';\nimport { keyframes, styled } from '@stitches/react';\n\nconst overlayShow = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: 1 },\n});\n\nconst contentShow = keyframes({\n '0%': { opacity: 0, transform: 'translate(-50%, -48%) scale(.96)' },\n '100%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },\n});\n\nconst StyledOverlay = styled(Dialog.Overlay, {\n animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards`,\n});\n\nconst StyledContent = styled(Dialog.Content, {\n animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards`,\n});\n\nfunction App() {\n return (\n <Dialog.Root>\n <Dialog.Trigger>Open Animated Dialog</Dialog.Trigger>\n <Dialog.Portal>\n <StyledOverlay />\n <StyledContent>\n <Dialog.Title>Animated Dialog Title</Dialog.Title>\n <Dialog.Description>This is an animated dialog example.</Dialog.Description>\n <Dialog.Close>Close</Dialog.Close>\n </StyledContent>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}"}
react-modal is a popular package for creating accessible modal dialogs in React applications. It provides similar functionality to @radix-ui/react-dialog but has a different API and may offer different customization options.
material-ui, also known as @mui/material, offers a Dialog component as part of its comprehensive UI kit for React. It follows Material Design guidelines and provides a rich set of features for creating dialogs, with a focus on Material Design aesthetics.
reactstrap provides Bootstrap-styled components for React, including a Modal component. It is similar to @radix-ui/react-dialog in that it allows for the creation of dialogs, but it is styled according to Bootstrap's design system.
react-dialog
$ yarn add @radix-ui/react-dialog
# or
$ npm install @radix-ui/react-dialog
View docs here.
FAQs
Unknown package
The npm package @radix-ui/react-dialog receives a total of 2,296,272 weekly downloads. As such, @radix-ui/react-dialog popularity was classified as popular.
We found that @radix-ui/react-dialog 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.