Certainly! Here's the README.md for the provided `Collapse` component:
npm install @bolttech/atoms-collapseCertainly! Here's the README.md for the provided Collapse component:
A React component to create collapsible sections with headers and content.
Use the package manager npm or yarn to install the component.
``bash`
npm install @bolttech/frontend-foundations @bolttech/atoms-collapse
or
`bash`
yarn add @bolttech/frontend-foundations @bolttech/atoms-collapse
The Collapse component accepts the following properties:
| Prop | Type | Description |
|-------------|---------------|--------------------------------------------------------------------------------------------------------|
| titleText | string | The text content of the collapse header. |boolean
| isOpen | | Determines whether the collapse is open or closed. |string
| imgCollapse | or element | An image URL or an element to be displayed as the collapse header icon. |string
| status | | The status of the collapse (e.g., 'default', 'error', 'success'). |function
| onClick | | Callback function to handle the collapse header click event. |node
| children | | The content to be displayed within the collapsed section. |string
| dataTestId | | The data-testid attribute for testing. |string
| variant | | Size variant a prop that should be the value 'small' or 'large' |Icons
| icons | | Icons referenced with status |
`jsx
import React, {useState} from 'react';
import {Collapse} from '@bolttech/atoms-collapse';
import {bolttechTheme, BolttechThemeProvider} from "@bolttech/frontend-foundations";
const ExampleComponent = () => {
const [isCollapseOpen, setIsCollapseOpen] = useState(false);
const handleCollapseClick = (isOpen) => {
setIsCollapseOpen(isOpen);
};
return (
isOpen={isCollapseOpen}
imgCollapse="https://example.com/collapse-icon.png"
status="default"
onClick={handleCollapseClick}
dataTestId="custom-collapse"
>
{/ Content to display within the collapsed section /}
);
};
export default ExampleComponent;
``
Contributions are welcome! For any bug fixes, improvements, or new features, please open an issue or submit a pull request.
Please make sure to follow the code standards and test your changes before submitting.