Socket
Socket
Sign inDemoInstall

@hig/accordion

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hig/accordion

HIG Accordion


Version published
Weekly downloads
3
Maintainers
3
Weekly downloads
 
Created
Source

Accordion

Accordions can make content-heavy pages appear less so by vertically stacking items in lists that users can expand or contract.

Read more about when and how to use the Accordion component on the internal wiki.

Getting started

Install the package

yarn add @hig/accordion @hig/theme-context @hig/theme-data

Import the component

import Accordion from "@hig/accordion";

Basic usage

<Accordion label="foo">
  bar
</Accordion>

Customization

Indicator

The icon and position of the indicator can be customized by props, available values can be found via:

import {
  indicators,
  indicatorPositions,
  AVAILABLE_INDICATORS,
  AVAILABLE_INDICATOR_POSITIONS
} from "@hig/accordion";

Styling

Use the className prop to pass in a css class name to the outermost container of the component. The class name will also pass down to most of the other styled elements within the component.

Accordion also has a stylesheet prop that accepts a function wherein you can modify Accordion's styles. The original styles, props, current theme data and theme meta will be passed to your custom stylesheet function, and it should return an object with the same structure as the original styles. For instance

function customStylesheet(styles, props, themeData, themeMeta) {
  return {
    ...styles,
    wrapper: {
      ...styles.wrapper,
      backgroundColor: "yellow"
    },
    header: {
      ...styles.header,
      backgroundColor: props.collapsed
        ? themeData["basics.colors.green100"]
        : themeData["basics.colors.darkBlue100"]
    }
  };
}

<Accordion stylesheet={customStylesheet} label="foo">
  bar
</Accordion>

FAQs

Package last updated on 05 Aug 2020

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