New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rc-collapse

Package Overview
Dependencies
Maintainers
6
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-collapse

rc-collapse ui component for react

3.9.0
Source
npm
Version published
Weekly downloads
1.3M
-16.56%
Maintainers
6
Weekly downloads
 
Created

What is rc-collapse?

The rc-collapse npm package is a React component for creating collapsible panels. It allows developers to create sections of content that can be expanded or collapsed by the user, making it useful for FAQs, menus, and more. It supports accordion mode, where only one panel can be open at a time.

What are rc-collapse's main functionalities?

Basic Collapse

This code sample demonstrates how to create a basic collapsible component with two panels. Each panel has its own header and content.

import Collapse from 'rc-collapse';
import 'rc-collapse/assets/index.css';

const Panel = Collapse.Panel;

const App = () => (
  <Collapse>
    <Panel header="This is panel header 1" key="1">
      <p>Content of panel 1</p>
    </Panel>
    <Panel header="This is panel header 2" key="2">
      <p>Content of panel 2</p>
    </Panel>
  </Collapse>
);

Accordion Mode

This example shows how to enable accordion mode, where opening one panel will close the others, ensuring only one panel is open at a time.

import Collapse from 'rc-collapse';
import 'rc-collapse/assets/index.css';

const Panel = Collapse.Panel;

const App = () => (
  <Collapse accordion>
    <Panel header="This is panel header 1" key="1">
      <p>Content of panel 1</p>
    </Panel>
    <Panel header="This is panel header 2" key="2">
      <p>Content of panel 2</p>
    </Panel>
  </Collapse>
);

Other packages similar to rc-collapse

Keywords

react

FAQs

Package last updated on 28 Oct 2024

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