diff --git a/apps/web/content/docs/components/tabs.mdx b/apps/web/content/docs/components/tabs.mdx index dec1526e6..352bbf33e 100644 --- a/apps/web/content/docs/components/tabs.mdx +++ b/apps/web/content/docs/components/tabs.mdx @@ -53,6 +53,12 @@ Here's an example on how you can set the activate tab programatically using the +## Vertical Tabs + +Use this example to show a vertically aligned set of tabs on the left side of the page. + + + ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](/docs/customize/theme). diff --git a/apps/web/examples/tabs/index.ts b/apps/web/examples/tabs/index.ts index a769dc770..62e7a9b09 100644 --- a/apps/web/examples/tabs/index.ts +++ b/apps/web/examples/tabs/index.ts @@ -1,6 +1,7 @@ export { fullWidth } from "./tabs.fullWidth"; export { root } from "./tabs.root"; export { stateOptions } from "./tabs.stateOptions"; +export { vertical } from "./tabs.vertical"; export { withIcons } from "./tabs.withIcons"; export { withPills } from "./tabs.withPills"; export { withUnderline } from "./tabs.withUnderline"; diff --git a/apps/web/examples/tabs/tabs.vertical.tsx b/apps/web/examples/tabs/tabs.vertical.tsx new file mode 100644 index 000000000..153bbe70b --- /dev/null +++ b/apps/web/examples/tabs/tabs.vertical.tsx @@ -0,0 +1,63 @@ +"use client"; + +import { Tabs } from "flowbite-react"; +import { type CodeData } from "~/components/code-demo"; + +const code = ` +import { Tabs } from "flowbite-react"; + +export function Component() { + return ( + + +

Content 1

+
+ +

Content 2

+
+ +

Content 3

+
+ +

Content 4

+
+ +

Content 5

+
+
+ ); +} +`; + +export function Component() { + return ( + + +

Content 1

+
+ +

Content 2

+
+ +

Content 3

+
+ +

Content 4

+
+ +

Content 5

+
+
+ ); +} + +export const vertical: CodeData = { + type: "single", + code: { + fileName: "client", + language: "tsx", + code, + }, + githubSlug: "tabs/tabs.vertical.tsx", + component: , +}; diff --git a/packages/ui/src/components/Tabs/Tabs.stories.tsx b/packages/ui/src/components/Tabs/Tabs.stories.tsx index 8eab80b74..c73f6ac91 100644 --- a/packages/ui/src/components/Tabs/Tabs.stories.tsx +++ b/packages/ui/src/components/Tabs/Tabs.stories.tsx @@ -16,7 +16,7 @@ export default { }, style: { control: "radio", - options: ["default", "underline", "pills", "fullWidth"], + options: ["default", "underline", "pills", "fullWidth", "vertical"], }, }, } as Meta; @@ -103,3 +103,19 @@ FullWidth.args = { style: "fullWidth", }; FullWidth.storyName = "Full width"; + +export const Vertical = (args: TabsProps): JSX.Element => ( + + Profile content + Dashboard content + Settings content + Contacts content + + Disabled content + + +); +Vertical.args = { + style: "vertical", +}; +Vertical.storyName = "Vertical Tabs"; diff --git a/packages/ui/src/components/Tabs/Tabs.tsx b/packages/ui/src/components/Tabs/Tabs.tsx index fb61a450c..ceeac4542 100644 --- a/packages/ui/src/components/Tabs/Tabs.tsx +++ b/packages/ui/src/components/Tabs/Tabs.tsx @@ -33,6 +33,7 @@ export interface TabStyles { fullWidth: string; pills: string; underline: string; + vertical: string; } export interface TabStyleItemProps { @@ -126,7 +127,7 @@ const TabsComponent = forwardRef( })); return ( -
+