🐛 fix: console error becasue button inside button
This commit is contained in:
parent
cfeb85f5c4
commit
0bcb7ca4d6
@ -61,6 +61,7 @@ export const tabsTheme = tv({
|
|||||||
'data-[orientation=horizontal]:focus-ring',
|
'data-[orientation=horizontal]:focus-ring',
|
||||||
// Vertical
|
// Vertical
|
||||||
'data-[orientation=vertical]:gap-2',
|
'data-[orientation=vertical]:gap-2',
|
||||||
|
'data-[orientation=vertical]:justify-start',
|
||||||
],
|
],
|
||||||
triggerList: [
|
triggerList: [
|
||||||
'flex',
|
'flex',
|
||||||
|
@ -35,20 +35,23 @@ const TabsTrigger = forwardRef<
|
|||||||
// Disabled focus state for horizontal tabs
|
// Disabled focus state for horizontal tabs
|
||||||
tabIndex={orientation === 'horizontal' ? -1 : undefined}
|
tabIndex={orientation === 'horizontal' ? -1 : undefined}
|
||||||
className={triggerWrapper({ className })}
|
className={triggerWrapper({ className })}
|
||||||
|
asChild
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{/* Need to add button in the trigger children because there's focus state inside the children */}
|
{/* Need to add button in the trigger children because there's focus state inside the children */}
|
||||||
<button
|
<button className={triggerWrapper({ className })}>
|
||||||
data-orientation={orientation}
|
<span
|
||||||
// Disabled focus state for vertical tabs
|
// Disabled focus state for vertical tabs
|
||||||
tabIndex={orientation === 'vertical' ? -1 : undefined}
|
tabIndex={orientation === 'horizontal' ? 0 : -1}
|
||||||
className={trigger()}
|
data-orientation={orientation}
|
||||||
>
|
className={trigger()}
|
||||||
{/* Put the icon on the left of the text for veritcal tab */}
|
>
|
||||||
{orientation === 'vertical' && icon}
|
{/* Put the icon on the left of the text for veritcal tab */}
|
||||||
{children}
|
{orientation === 'vertical' && icon}
|
||||||
{/* Put the icon on the right of the text for horizontal tab */}
|
{children}
|
||||||
{orientation === 'horizontal' && icon}
|
{/* Put the icon on the right of the text for horizontal tab */}
|
||||||
|
{orientation === 'horizontal' && icon}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user