Socket
Socket
Sign inDemoInstall

@paprika/collapsible

Package Overview
Dependencies
100
Maintainers
4
Versions
130
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/collapsible

Collapsible component, allows the user to expand and collapse some enclosed content.


Version published
Weekly downloads
1.7K
decreased by-3.58%
Maintainers
4
Install size
3.15 MB
Created
Weekly downloads
 

Readme

Source

@paprika/collapsible

Description

Collapsible component, allows the user to expand and collapse some enclosed content.

Installation

yarn add @paprika/collapsible

or with npm:

npm install @paprika/collapsible

Props

Collapsible

PropTyperequireddefaultDescription
a11yTextstringfalsenullDescriptive a11y text for assistive technologies. By default, text from children node will be used.
childrennodefalsenullBody content of the collapsible.
iconAlign[ "left", "right"]false"left"Set's icon alignment left or right.
iconCollapsenodefalseSets RightArrowIcon if true.
iconExpandnodefalseSets DownArrowIcon if true.
isCollapsedboolfalsetrueState of the collapsible.
isDisabledboolfalsefalseIf the collapsible is disabled.
hasOnlyIconToggleboolfalsefalse
labelnodetrue-Sets the label that will display in the collapsible
onClickfuncfalse() => {}Callback to be executed when the button is clicked or activated by keyboard.
triggerAriaDescribedbystringfalsenullaria-describedby on the trigger element.

Usage

import Collapsible from "@paprika/collapsible";

const [isCollapsed, setIsCollapsed] = React.useState(false);

const yourComponent = () => {
  return (
    <Collapsible
      a11yText="collapsible section"
      isCollapsed={isCollapsed}
      isDisabled={false}
      label="Click me to show/hide the content"
      iconAlign="left"
      onClick={() => setIsCollapsed(!isCollapsed)}
    >
      <p>
        <strong>Content</strong> – children of the &lt;Collapsible&gt; is hidden while the collapsible is collapsed, and
        visible with it is expanded.
      </p>
    </Collapsible>
  );
};

export default yourComponent;
  • Storybook Showcase
  • GitHub source code
  • Create GitHub issue
  • CHANGELOG

FAQs

Last updated on 06 Jan 2024

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