Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Orientation of tabs component does not work in RadixUI

Tags:

reactjs

radix

I am using RadixUI and there is orientation props, which could be vertically set. I tried to use this prop and expect that thabs will be aligned in column but it does not work:

  <Tabs.Root orientation="vertical" className="TabsRoot" defaultValue="tab1">

Question: Did someone faced this issue and how to solve it?

like image 212
Asking Avatar asked Dec 01 '25 12:12

Asking


2 Answers

According to Radix UI, they are a style-free library, which means that the orientation prop does not change the UI. You would need to apply the styles. vertical means that the up / down arrow will move focus within the component

You can read more about the functionality here https://github.com/radix-ui/website/issues/463

like image 148
unhackit Avatar answered Dec 03 '25 03:12

unhackit


I tried the same with orientation without success and then found this question. You can style shadcn tabs so that they display vertically rather than horizontally. Here is how I did it by styling the component:

<TabsList className="flex mt-6 md:flex-col md:items-start md:space-y-2 md:mt-12">
  <TabsTrigger value="general">General</TabsTrigger>
  <TabsTrigger value="billing">Billing</TabsTrigger>
  <TabsTrigger value="security">Security</TabsTrigger>
</TabsList>

In my case I am using tailwindcss and I only need the vertical layout past the md breakpoint

like image 23
stelloprint Avatar answered Dec 03 '25 05:12

stelloprint



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!