Socket
Socket
Sign inDemoInstall

rc-collapse

Package Overview
Dependencies
Maintainers
6
Versions
82
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


Version published
Weekly downloads
1.4M
increased by6.17%
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

FAQs

Package last updated on 17 Sep 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc