- Easy to use
- Lightweight (~4kb Gzip)
- Fully responsive.
- Highly customizable.
- No 3rd party dependencies.
- Typescript
$ npm i butter-collapsible
$ yarn add butter-collapsible
// Import statement
import { Collapsible } from "butter-collapsible";
// Here's an example of how to use it
export const MyComponent = () => {
return (
<>
<Collasible
trigger="Click me to see more"
content="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ducimus officia voluptate totam minima cum? Laboriosam, recusandae veritatis dolore saepe quibusdam nesciunt esse delectus aut consequuntur ex aliquid, enim cupiditate commodi!"
roundedSize={"lg"}
/>
</>
);
};
Here's a table of all available props for the Collapsible.
Prop | Description | Type | default |
---|---|---|---|
trigger* | The part of the collapsible that you click to expand. | string | JSX.Element |
|
content* | The part shown after the collapsible is expanded. | string | JSX.Element |
|
rounded | Determines whether the collapsible wrapper would be rounded. | boolean |
true |
roundedSize | Sets the size of the collapsible wrapper's rounded corners. | sm | md | lg | xl |
md |
triggerIcon | Icon at the left of collapsible trigger | string | JSX.Element |
+ |
color | Applied as collapsible wrapper border color | string |
#333333 |
borderWidth | Applied as collapsible wrapper border width | number |
2 |
paddingSize | Applied as collapsible wrapper padding size | sm | md | lg | xl |
md |
Butter-Collapsible is an opensource project and public contribution is always welcomed. You can check Issues for bugs to fix or features to add.
- Fork this repository.
- Clone the forked repository to your local machine.
- Create a new branch with a name like this - feature/name-of-feature.
- Run
npm
to install dependencies. - Write code and then commit changes.
- Run
npm run build
to compile a build into the dist folder. - Now You can decide to manually copy the index.tsx and index.scss file from here into a local project in order to test the feature/bug you have fixed.
- Alternatively, run
npm link
in your local butter-collapsible root folder. - On the local project you want to test the features on, run
npm link 'butter-collapsible'
. - Now navigate back to the terminal on your local butter-collapsible folder and then run
npm link ../path-to-test-project/node_modules/react
. This will make butter-collapsible use the copy of react from your local test project. Now you can test your changes. - After all is done, push to your forked repository and then send a pull request.
MIT (c) Raymond Duru-young.