Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@radix-ui/react-collapsible
Advanced tools
The @radix-ui/react-collapsible package provides components to create collapsible sections in React applications. It is designed to be accessible and customizable, allowing developers to implement collapsible features easily while maintaining good user experience for all users, including those using assistive technologies.
Basic Collapsible Component
This code demonstrates how to create a basic collapsible component using @radix-ui/react-collapsible. It includes a trigger that toggles the visibility of the content.
import * as Collapsible from '@radix-ui/react-collapsible';
function MyComponent() {
const [open, setOpen] = React.useState(false);
return (
<Collapsible.Root open={open} onOpenChange={setOpen}>
<Collapsible.Trigger>Toggle</Collapsible.Trigger>
<Collapsible.Content>
Content inside the collapsible section.
</Collapsible.Content>
</Collapsible.Root>
);
}
react-collapsible is another popular package for creating collapsible components in React. It offers similar functionality but differs in implementation details and API design. react-collapsible might be simpler to use for basic use cases, while @radix-ui/react-collapsible provides more control and customization options.
react-collapse provides components to create collapsible elements using CSS transitions for animations. It focuses more on the animation aspects and might be preferred if smooth animations are a priority. However, @radix-ui/react-collapsible offers better accessibility features out of the box.
react-collapsible
$ yarn add @radix-ui/react-collapsible
# or
$ npm install @radix-ui/react-collapsible
View docs here.
FAQs
Unknown package
We found that @radix-ui/react-collapsible 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.