Open brentrobbins opened 1 year ago
This works perfectly fine on chrome, i think it is a browser issue
Same for me, works on the Documentation page of shadcn-ui, but locally the tab switch is not working
@brentrobbins. I am experiencing the same issue. were you able to resolve it?
@brentrobbins. I am experiencing the same issue. were you able to resolve it?
Not yet.
I was experiencing this today due to hydration issues - had to enable "client:load" in astro for it to work, keep up the good work :)
Same issue, using Nextjs.
I noticed the tab doesn't handle active automatically and isn't aware of which tab is active. You will have to handle these your self.
on react, it would be:
import { useState } from "react";
export function Tab(){
const [openTab, setOpenTab] = useState("reply")
return(
<Tabs
defaultValue="reply"
value={openTab}
onValueChange={setOpenTab}
className="w-full p-2">
<TabsList className="grid w-2/6 grid-cols-2 rounded-lg">
<TabsTrigger className={openTab === "reply" && "bg-white text-gray-900"} value="reply">Reply</TabsTrigger>
<TabsTrigger className={openTab === "note" && "bg-white text-gray-900"} value="note">Note</TabsTrigger>
</TabsList>
<TabsContent value="reply">
<p>Reaply</p>
</TabsContent>
<TabsContent value="note">
<p>Reaply</p>
</TabsContent>
)
}
For some reason the tabs are not switching content when you use a component within TabsContent. For example if you have something like the following you will see the same component content when you select either tab. It only shows the first tab content's header even when you click the second tab, but the content within the p tag will switch.