diff --git a/src/hooks/useItems.tsx b/src/hooks/useItems.tsx
index 2bc5db7..27f7e7b 100644
--- a/src/hooks/useItems.tsx
+++ b/src/hooks/useItems.tsx
@@ -24,6 +24,7 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => {
const {
children,
label,
+ wrapper,
key: rawKey,
collapsible: rawCollapsible,
onItemClick: rawOnItemClick,
@@ -50,7 +51,7 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => {
isActive = activeKey.indexOf(key) > -1;
}
- return (
+ const collapsePanel = (
{
{children}
);
+
+ if (wrapper) {
+ return wrapper(collapsePanel);
+ }
+
+ return collapsePanel;
});
};
diff --git a/src/interface.ts b/src/interface.ts
index 7a36bed..5288153 100644
--- a/src/interface.ts
+++ b/src/interface.ts
@@ -1,5 +1,6 @@
import type { CSSMotionProps } from 'rc-motion';
import type * as React from 'react';
+import type { ReactNode } from 'react';
export type CollapsibleType = 'header' | 'icon' | 'disabled';
@@ -16,6 +17,7 @@ export interface ItemType
> {
key?: CollapsePanelProps['panelKey'];
label?: CollapsePanelProps['header'];
+ wrapper?: ReactNode;
ref?: React.RefObject;
}