Skip to content

Commit

Permalink
make <Tab /> accept ComponentProps<'div'> (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Sep 2, 2022
1 parent c4a9782 commit 9064112
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-emus-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra-theme-docs': patch
---

make `<Tab />` accept `ComponentProps<'div'>`
13 changes: 10 additions & 3 deletions packages/nextra-theme-docs/src/components/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, ReactNode } from 'react'
import React, { ComponentProps, ReactElement, ReactNode } from 'react'
import cn from 'clsx'
import { Tab as HeadlessTab } from '@headlessui/react'

Expand Down Expand Up @@ -75,9 +75,16 @@ export function Tabs({
)
}

export function Tab({ children }: { children: ReactNode }): ReactElement {
export function Tab({
children,
className,
...props
}: ComponentProps<'div'>): ReactElement {
return (
<HeadlessTab.Panel className="focus:outline-none focus-visible:ring">
<HeadlessTab.Panel
className={cn('focus:outline-none focus-visible:ring', className)}
{...props}
>
{children}
</HeadlessTab.Panel>
)
Expand Down

0 comments on commit 9064112

Please sign in to comment.