Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@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
The npm package @radix-ui/react-collapsible receives a total of 1,564,732 weekly downloads. As such, @radix-ui/react-collapsible popularity was classified as popular.
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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.