Skip to content

[pull] main from coreui:main #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(CTabPane): add the transition property to enable control of fa…
…de animation on panels
  • Loading branch information
mrholek committed May 25, 2024
commit 5633f3c25e56c289c9c025af05f7a33e8704d59c
11 changes: 9 additions & 2 deletions packages/coreui-react/src/components/tabs/CTabPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ export interface CTabPaneProps extends HTMLAttributes<HTMLDivElement> {
* Callback fired when the component requests to be shown.
*/
onShow?: () => void
/**
* Enable fade in and fade out transition.
*
* @since 5.1.0
*/
transition?: boolean
/**
* Toggle the visibility of component.
*/
visible?: boolean
}

export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
({ children, className, onHide, onShow, visible, ...rest }, ref) => {
({ children, className, onHide, onShow, transition = true, visible, ...rest }, ref) => {
const tabPaneRef = useRef()
const forkedRef = useForkedRef(ref, tabPaneRef)

Expand All @@ -35,9 +41,9 @@ export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
<div
className={classNames(
'tab-pane',
'fade',
{
active: visible,
fade: transition,
show: state === 'entered',
},
className,
Expand All @@ -58,6 +64,7 @@ CTabPane.propTypes = {
className: PropTypes.string,
onHide: PropTypes.func,
onShow: PropTypes.func,
transition: PropTypes.bool,
visible: PropTypes.bool,
}

Expand Down