1.24.0 • Published 4 days ago

@s-ui/react-molecule-collapsible v1.24.0

Weekly downloads
676
License
MIT
Repository
-
Last release
4 days ago

MoleculeCollapsible

The collapsible component allows the user to expand or collapse content. We use this component to lightweight the content of a page or section.

Installation

$ npm install @s-ui/react-molecule-collapsible --save

Usage

Import the component like this:

import MoleculeCollapsible from '@s-ui/react-molecule-collapsible'

Basic usage

<MoleculeCollapsible 
    icon={svgIcon} 
    showText='Show' 
    hideText='Hide'
>
    <p>Text or content to collapse</p>
</MoleculeCollapsible>

Properties

height

It sets the maximum height in pixels when the component is collapsed. By default it is set to 100px.

<MoleculeCollapsible 
    icon={svgIcon} 
    showText='Show' 
    hideText='Hide'
    height={10}
>
    <p>Text or content to collapse</p>
</MoleculeCollapsible>

icon

The icon in svg to show next to the text to collapse or expand. It will toggle between the original position and a rotation of 180 degrees when text is collapsed and expanded.

showText

The text to show in the button to uncollapse the content.

hideText

The text to show in the button to collapse the content.

isCollapsible

When set to false, it hides the button to collapse the content when expanded. True by default.

<MoleculeCollapsible 
    hideText='Hide'
    isCollapsible={false}
    showText='Show' 
>
    <p>Text or content that's no longer collapsible</p>
</MoleculeCollapsible>

withGradient

It can be set True or False. It will show a gradient over the content when set to True. By default it is True.

<MoleculeCollapsible 
    icon={svgIcon} 
    showText='Show' 
    hideText='Hide'
    withGradient={true}
>
    <p>Text or content to collapse</p>
</MoleculeCollapsible>

withTransition

It can be set True or False. It will activate or deactivate transition effect when toggle. By default it is True.

<MoleculeCollapsible 
    icon={svgIcon} 
    showText='Show' 
    hideText='Hide'
    withTransition={true}
>
    <p>Text or content to collapse</p>
</MoleculeCollapsible>

Find full description and more examples in the demo page.

1.24.0

4 days ago

1.23.0

1 month ago

1.22.0

2 months ago

1.21.0

5 months ago

1.20.0

1 year ago

1.19.0

1 year ago

1.18.0

1 year ago

1.17.0

2 years ago

1.16.0

2 years ago

1.15.0

3 years ago

1.14.0

3 years ago

1.13.0

3 years ago

1.12.0

3 years ago

1.11.0

3 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.1.0

6 years ago