8000 feat(CTabPane): add the `transition` property to enable control of f… · coreui/coreui-react@5633f3c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5633f3c

Browse files
committed
feat(CTabPane): add the transition property to enable control of fade animation on panels
1 parent 1f424df commit 5633f3c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/coreui-react/src/components/tabs/CTabPane.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@ export interface CTabPaneProps extends HTMLAttributes<HTMLDivElement> {
1818
* Callback fired when the component requests to be shown.
1919
*/
2020
onShow?: () => void
21+
/**
22+
* Enable fade in and fade out transition.
23+
*
24+
* @since 5.1.0
25+
*/
26+
transition?: boolean
2127
/**
2228
* Toggle the visibility of component.
2329
*/
2430
visible?: boolean
2531
}
2632

2733
export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
28-
({ children, className, onHide, onShow, visible, ...rest }, ref) => {
34+
({ children, className, onHide, onShow, transition = true, visible, ...rest }, ref) => {
2935
const tabPaneRef = useRef()
3036
const forkedRef = useForkedRef(ref, tabPaneRef)
3137

@@ -35,9 +41,9 @@ export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
3541
<div
3642
className={classNames(
3743
'tab-pane',
38-
'fade',
3944
{
4045
active: visible,
46+
fade: transition,
4147
show: state === 'entered',
4248
},
4349
className,
@@ -58,6 +64,7 @@ CTabPane.propTypes = {
5864
className: PropTypes.string,
5965
onHide: PropTypes.func,
6066
onShow: PropTypes.func,
67+
transition: PropTypes.bool,
6168
visible: PropTypes.bool,
6269
}
6370

0 commit comments

Comments
 (0)
0