Accordion
Installation
- yarn
- pnpm
- npm
yarn add @mercell/accordion-react
pnpm add @mercell/accordion-react
npm install --save @mercell/accordion-react
The Accordion has necessary peerDependencies, please make sure that you have them in your project
"@carbon/icons-react": "^10.49.0",
"@mercell/tailwind": "^6.0.1",
"@mercell/use-accordion-react-hook": "^3.0.6",
"@mercell/use-expanded-state-react-hook": "^2.0.6",
"classnames": "^2.3.1",
"react": "^17.0.2"
Usage
To render Accordion in your project you just simply import it
import {
Accordion,
AccordionProps,
AccordionHeader,
AccordionContent,
} from '@mercell/accordion-react';
Types, definitions, etc.
- Types
- Changelog
- Figma
AccordionProps
interface AccordionProps {
id: string;
isExpanded?: boolean;
onExpand?: (id: string, isExpanded: boolean) => void;
mountOnlyOnExpand?: boolean
} & Omit<JSX.IntrinsicElements['button'], 'value'>
Name | Type | Default | Required | Description |
---|---|---|---|---|
id | string | - | yes | necessary to create action |
isExpanded | boolean | false | no | setting initial state of the accordion (collapsed or not) |
mountOnlyOnExpand | boolean | false | no | mount content component only when expanded |
onExpand | function | false | no | callback function is fired when state change (expand or not) |
AccordionHeaderProps
interface AccordionHeaderProps {
buttonIconClassName?: string;
buttonIconContent?: string;
childrenWrapperClassName?: string;
iconProps?: CarbonIconProps;
} & JSX.IntrinsicElements['button'] &
Omit<JSX.IntrinsicElements['button'], 'value'> &
Omit<JSX.IntrinsicElements['button'], 'onClick'>
Name | Type | Default | Required | Description |
---|---|---|---|---|
buttonIconClassName | string | - | no | passing className property to the button icon tag |
buttonIconContent | ReactNode | 'Show more' | no | Content for the text next to the dropdown icon |
childrenWrapperClassName | string | - | no | passing className property to the children wrapper tag |
iconProps | CarbonIconProps | - | no | all possible properties allowed by CarbonIconProps |
AccordionContent
AccordionContent has JSX.IntrinsicElements['div'] type.
Change Log - @mercell/accordion-react
This log was last generated on Thu, 17 Nov 2022 14:09:58 GMT and should not be manually modified.
6.0.1
Thu, 17 Nov 2022 14:09:58 GMT
Patches
- Fix font-semibold
6.0.0
Fri, 11 Nov 2022 09:18:57 GMT
Breaking changes
- New styling approach - use only tailwind classes, add tailwind-merge library
5.0.0
Thu, 15 Sep 2022 06:07:41 GMT
Breaking changes
- Migration to Tailwind3, React 18 and ViteJS from webpack.
4.0.12
Thu, 08 Sep 2022 13:02:50 GMT
Patches
- Add mountOnlyOnExpand property to Accordion component as a feature where dev team can decided if content of AccordionContent should be mount always or only when expanded
4.0.11
Thu, 14 Jul 2022 13:28:46 GMT
Patches
- Updated hover state to remove sticky hover on mobile
4.0.10
Thu, 30 Jun 2022 10:57:49 GMT
Patches
- Package.json refactor, add test suite, more tests soon
4.0.9
Mon, 30 May 2022 07:22:23 GMT
Patches
- Update accordion styling to consume external classes properly
4.0.8
Fri, 08 Apr 2022 10:19:50 GMT
Patches
- Bump dependencies
4.0.7
Mon, 28 Feb 2022 12:45:49 GMT
Patches
- Dependency update
4.0.6
Mon, 28 Feb 2022 10:55:32 GMT
Patches
- Bump typescript
4.0.5
Tue, 01 Feb 2022 13:00:55 GMT
Patches
- Change usage of scrollheight hook to also check width of window
4.0.4
Wed, 26 Jan 2022 16:19:19 GMT
Patches
- Move dependencies to peerDependencies to avoid duplication in installation process in project
- Adding the same peerDependencies to devDependencies
4.0.3
Mon, 20 Dec 2021 08:22:32 GMT
Patches
- Add childrenWrapperClassName to the tag
4.0.2
Sat, 18 Dec 2021 18:44:24 GMT
Patches
- Add childrenWrapperClassName props to AccordionHeader
4.0.1
Thu, 16 Dec 2021 09:14:54 GMT
Patches
- Add onExpand callback to track component state
4.0.0
Wed, 15 Dec 2021 22:20:34 GMT
Breaking changes
- Update to match figma design
3.0.5
Fri, 12 Nov 2021 13:08:30 GMT
Patches
- Add @mercell/tailwind to devDeps to be always up to date
3.0.4
Fri, 05 Nov 2021 11:10:13 GMT
Patches
- Bump peerDependency
3.0.3
Thu, 04 Nov 2021 10:10:16 GMT
Patches
- Tailwind type fix
- Revert tailwind version
3.0.2
Wed, 03 Nov 2021 15:28:42 GMT
Patches
- react types >=17
3.0.1
Wed, 27 Oct 2021 12:53:13 GMT
Patches
- Gitignore fix
3.0.0
Mon, 18 Oct 2021 07:16:21 GMT
Breaking changes
- New local build process with webpack without storybook, add npmignore and update dependencies
2.0.1
Tue, 12 Oct 2021 11:37:45 GMT
Patches
- Added a container class and styled it to have a 1px alto border
2.0.0
Tue, 07 Sep 2021 15:54:06 GMT
Breaking changes
- Add isExpanded prop
1.1.5
Mon, 12 Jul 2021 10:50:09 GMT
Patches
- Updating dependencies
- Updating dependencies
1.1.4
Tue, 06 Apr 2021 09:31:41 GMT
Patches
- Fixing an issue where import was wrong
1.1.3
Wed, 24 Mar 2021 10:17:01 GMT
Patches
- Enabling eslint
1.1.2
Tue, 23 Mar 2021 13:40:42 GMT
Patches
- Adding esm module export
1.1.1
Wed, 17 Mar 2021 10:01:28 GMT
Patches
- Adding readme
1.1.0
Wed, 24 Feb 2021 11:34:29 GMT
Minor changes
- Expand state is now manage by component
1.0.2
Fri, 19 Feb 2021 09:41:17 GMT
Patches
- bump
1.0.1
Fri, 05 Feb 2021 09:50:54 GMT
Patches
- target es5
1.0.0
Thu, 04 Feb 2021 10:58:00 GMT
Breaking changes
- Added component
Sometimes it can take some time until Figma will render component inside embed iframe. Try to click plus icon to 'reset' initial loader. (Works only in Chrome)
Click me to open figma in the new card