Socket
Socket
Sign inDemoInstall

@react-md/expansion-panel

Package Overview
Dependencies
18
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @react-md/expansion-panel

Create accessible expansion components for accordions and disclosures.


Version published
Maintainers
1
Created

Changelog

Source

5.1.6 (2023-12-11)

Bug Fixes

  • @react-md/chip: add overflow to support font icons (da44bbd), closes #1432
  • select: port fixed positioning fixes back from v6.0.0 (feb9ec6), closes #1461

Documentation

  • react-md.dev: update blog to include additional releases (b305882)

Readme

Source

@react-md/expansion-panel

Expansion panels are used to create disclosure widgets that show additional information once the component has been toggled to an "open" state. In other words, expansion panels are a styled version of a details element.

An expansion panel can be rendered standalone or within a group with the ExpansionList component and usePanels hook.

Installation

npm install --save @react-md/expansion-panel

This package is not super helpful on its own, so it is recommended to also install the following packages:

npm install --save @react-md/theme \
  @react-md/typography \
  @react-md/list \
  @react-md/icon

Documentation

You should check out the full documentation for live examples and more customization information, but an example usage is shown below.

Usage

Expansion panels are normally rendered within a list of two or more panels. To create such a list, you'll want to use the ExpansionList and ExpansionPanel components and usePanels hook:

import { render } from "react-dom";
import {
  ExpansionList,
  ExpansionPanel,
  usePanels,
} from "@react-md/expansion-panel";

const App = () => {
  const [panels, onKeyDown] = usePanels({
    count: 3,
    idPrefix: "my-panel-group",
  });

  const [panel1Props, panel2Props, panel3Props] = panels;

  return (
    <main>
      <ExpansionList onKeyDown={onKeyDown}>
        <ExpansionPanel {...panel1Props} headerChildren="Panel 1">
          Panel 1 contents...
        </ExpansionPanel>
        <ExpansionPanel {...panel2Props} headerChildren={<span>Panel 2</span>}>
          Panel 2 contents...
        </ExpansionPanel>
        <ExpansionPanel {...panel3Props} headerChildren="Panel 1">
          Panel 3 contents...
        </ExpansionPanel>
      </ExpansionList>
    </main>
  );
};

render(<App />, document.getElementById("root"));

Keywords

FAQs

Last updated on 11 Dec 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc