1.3.2 • Published 1 year ago

react-collapsible-wrapper v1.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

React collapsible wrapper

Lightweight collapsible wrapper that is easy to use and customizable.

screen-gif

Install

npm i react-collapsible-wrapper

Properties

Required

  • isOpen (boolean) If wrapper should collapse or not

Optional

  • duration (number) | Transition duration in seconds | Based on content
  • easing (string) | Acceleration curve | linear
  • tagName (string) | The wrapper tag | div
  • ref (MutableRefObject<HTMLElement>) | Get element reference | Internally created
  • updateAfterInitRender: (boolean) | Force update after initial render | false
  • updateHeightOnResize: (boolean) | Recalculate height on window resize | false
  • tabIndex
  • className
  • id
  • style
  • onTransitionEnd
  • onChange

Simple Example:

import React, { useState } from "react";
import Collapse from "react-collapsible-wrapper";

const ExampleComponent = () => {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <article>
      <Collapse isOpen={isOpen}>
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed egestas, mi vel ultrices lacinia, lacus nibh
          vestibulum nunc, ac fringilla nisl magna tempor mi.
        </p>
      </Collapse>

      <button onClick={() => setIsOpen(!isOpen)}>Click me!</button>
    </article>
  );
};

export default ExampleComponent;
1.3.2

1 year ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago