fix(theme): ignored className attribute on lazy loaded TabItem (#10219)

This commit is contained in:
Balthasar Hofer 2024-06-18 16:51:22 +02:00 committed by GitHub
parent 88788cec90
commit 591914ca5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -122,7 +122,9 @@ function TabContent({
// fail-safe or fail-fast? not sure what's best here // fail-safe or fail-fast? not sure what's best here
return null; return null;
} }
return cloneElement(selectedTabItem, {className: 'margin-top--md'}); return cloneElement(selectedTabItem, {
className: clsx('margin-top--md', selectedTabItem.props.className),
});
} }
return ( return (
<div className="margin-top--md"> <div className="margin-top--md">

View file

@ -46,3 +46,17 @@ export const isMacOS = typeof window !== 'undefined' && navigator.platform.start
``` ```
When clicking tabs above, they should stay under cursor and we should adjust the scroll position. When clicking tabs above, they should stay under cursor and we should adjust the scroll position.
## Tabs with className and lazy loading
<Tabs lazy>
<TabItem value="apple" label="Apple" className="alert alert--primary" default>
This is an apple 🍎
</TabItem>
<TabItem value="orange" label="Orange" className="alert alert--secondary">
This is an orange 🍊
</TabItem>
<TabItem value="banana" label="Banana" className="alert alert--success">
This is a banana 🍌
</TabItem>
</Tabs>