Skip to content

Update UnderlinePanels to place provided className on outermost element #6292

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
"required": true,
"description": "Tabs (UnderlinePanels.Tab) and panels (UnderlinePanels.Panel) to render"
},
{
"name": "className",
"type": "string",
"required": false,
"description": "Class name for custom styling. Is applied to the custom element, [tab-container](https://github.com/github/tab-container-element)",
"defaultValue": ""
},
{
"name": "id",
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,6 @@ describe('UnderlinePanels', () => {
<UnderlinePanels.Panel>Panel 2</UnderlinePanels.Panel>
</UnderlinePanels>
)
expect(render(<Element />).baseElement.firstChild?.firstChild?.firstChild).toHaveClass('test-class-name')
expect(render(<Element />).baseElement.firstChild?.firstChild).toHaveClass('test-class-name')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {type SxProp} from '../../sx'
import {useResizeObserver, type ResizeObserverEntry} from '../../hooks/useResizeObserver'
import useIsomorphicLayoutEffect from '../../utils/useIsomorphicLayoutEffect'
import classes from './UnderlinePanels.module.css'
import {clsx} from 'clsx'
import {BoxWithFallback} from '../../internal/components/BoxWithFallback'

export type UnderlinePanelsProps = {
Expand All @@ -49,7 +48,7 @@ export type UnderlinePanelsProps = {
*/
loadingCounters?: boolean
/**
* Class name for custom styling
* Class name for custom styling. Is applied to the custom element, [tab-container](https://github.com/github/tab-container-element)
*/
className?: string
} & SxProp
Expand Down Expand Up @@ -170,12 +169,12 @@ const UnderlinePanels: FC<UnderlinePanelsProps> = ({
}

return (
<TabContainerComponent>
<TabContainerComponent className={className}>
<UnderlineWrapper
ref={wrapperRef}
slot="tablist-wrapper"
data-icons-visible={iconsVisible}
className={clsx(className, classes.StyledUnderlineWrapper)}
className={classes.StyledUnderlineWrapper}
{...props}
>
<UnderlineItemList ref={listRef} aria-label={ariaLabel} aria-labelledby={ariaLabelledBy} role="tablist">
Expand Down
Loading