diff --git a/docs/app/components/server/tabs/description.md b/docs/app/components/server/tabs/description.md
new file mode 100644
index 0000000000..1493199621
--- /dev/null
+++ b/docs/app/components/server/tabs/description.md
@@ -0,0 +1,3 @@
+Tabs to allow users to navigate easily between views within the same context.
+
+Each tab should contain content that is distinct from other tabs in a set for example, tabs can present different sections of news, different genres of music, or different themes of documents.
diff --git a/docs/app/components/server/tabs/examples/Default.tsx b/docs/app/components/server/tabs/examples/Default.tsx
new file mode 100644
index 0000000000..25851ca6b5
--- /dev/null
+++ b/docs/app/components/server/tabs/examples/Default.tsx
@@ -0,0 +1,16 @@
+import Tabs from '@heathmont/moon-base-tw/lib/tabs/Tabs';
+
+export const Default = () => (
+
+
+ Tab 1
+ Tab 2
+ Tab 3
+
+
+ 1
+ 2
+ 3
+
+
+);
diff --git a/docs/app/components/server/tabs/page.tsx b/docs/app/components/server/tabs/page.tsx
new file mode 100644
index 0000000000..e397a6dd4a
--- /dev/null
+++ b/docs/app/components/server/tabs/page.tsx
@@ -0,0 +1,22 @@
+import { Default } from '@/app/components/server/tabs/examples/Default';
+import ExampleSection from '@/app/components/shared/ExampleSection';
+import QuickNav from '@/app/components/shared/QuickNav';
+import { getExamples } from '@/app/utils/getExamples';
+import { MDX } from '@/components/MDX';
+
+export default async function Tabs() {
+ const { server } = await getExamples();
+ const examplesList = Object.keys(server.tabs.examples);
+ return (
+
+
Tabs
+
+
+ }
+ code={server.tabs.examples.Default}
+ />
+
+ );
+}
diff --git a/docs/app/components/types.ts b/docs/app/components/types.ts
index 2e26dc47ab..39094a042e 100644
--- a/docs/app/components/types.ts
+++ b/docs/app/components/types.ts
@@ -78,6 +78,12 @@ export interface Examples {
Default: 'string';
};
};
+ tabs: {
+ description: 'string';
+ examples: {
+ Default: 'string';
+ };
+ };
tag: {
description: 'string';
examples: {
diff --git a/workspaces/base/src/tabs/Tabs.tsx b/workspaces/base/src/tabs/Tabs.tsx
index 5dc3195c9a..f7cc8f997d 100644
--- a/workspaces/base/src/tabs/Tabs.tsx
+++ b/workspaces/base/src/tabs/Tabs.tsx
@@ -1,46 +1,25 @@
import React from 'react';
-import type Size from './private/types/Size';
+import type PanelProps from './private/types/PanelProps';
+import type Props from './private/types/Props';
+import type TabPolymorphicProps from './private/types/TabPolymorphicProps';
import getTabSize from './private/utils/getTabSize';
import mergeClassnames from '../mergeClassnames/mergeClassnames';
-type TabsRootProps = {
- className?: string;
- children?: React.ReactNode;
-};
-const TabsRoot = ({ className, children }: TabsRootProps) => (
- {children}
+const TabsRoot = ({ className, children }: Props) => (
+ {children}
);
-type ListProps = {
- className?: string;
- children?: React.ReactNode;
-};
-const List = ({ className, children }: ListProps) => (
+const List = ({ className, children }: Props) => (
{children}
);
-type TabProps = {
- className?: string;
- children?: React.ReactNode;
- isDisabled?: boolean;
- selected?: boolean;
- size?: Size;
-};
-
-type TabPolymorphicProps =
- PolymorphicComponentPropWithRef;
-
-type TabComponentProps = (
- props: TabPolymorphicProps
-) => React.ReactElement | null;
-
const Tab = React.forwardRef(
(
{
@@ -67,9 +46,10 @@ const Tab = React.forwardRef(
'after:duration-300 ltr:after:origin-top-left rtl:after:origin-top-right',
'after:scale-x-0 after:scale-y-100 ltr:hover:after:origin-top-left',
'rtl:hover:after:origin-top-right hover:after:scale-100 hover:text-piccolo',
- 'focus:outline-none',
+ 'focus:outline-none ltr:[&:local-link]:after:origin-top-left',
+ 'rtl:[&:local-link]:after:origin-top-right [&:local-link]:after:scale-x-100',
+ '[&:local-link]:text-piccolo',
isDisabled && 'opacity-30 hover:after:scale-0 cursor-not-allowed',
- 'ltr:[&:local-link]:after:origin-top-left rtl:[&:local-link]:after:origin-top-right [&:local-link]:after:scale-x-100 [&:local-link]:text-piccolo',
selected &&
'ltr:after:origin-top-left rtl:after:origin-top-right after:scale-x-100 text-piccolo',
className
@@ -109,8 +89,9 @@ const Pill = React.forwardRef(
'after:duration-300 ltr:after:origin-top-left rtl:after:origin-top-right after:scale-x-0',
'after:scale-y-100 ltr:hover:after:origin-top-left rtl:hover:after:origin-top-right',
'hover:after:scale-100 hover:text-piccolo focus:outline-none',
+ 'ltr:[&:local-link]:after:origin-top-left rtl:[&:local-link]:after:origin-top-right',
+ '[&:local-link]:after:scale-x-100 [&:local-link]:text-piccolo',
isDisabled && 'opacity-30 hover:after:scale-0 cursor-not-allowed',
- 'ltr:[&:local-link]:after:origin-top-left rtl:[&:local-link]:after:origin-top-right [&:local-link]:after:scale-x-100 [&:local-link]:text-piccolo',
selected &&
'ltr:after:origin-top-left rtl:after:origin-top-right after:scale-x-100 text-piccolo',
className
@@ -144,9 +125,9 @@ const Pill = React.forwardRef(
// className={mergeClassnames(
// getTabSize(size),
// 'flex items-center justify-center w-full whitespace-nowrap text-moon-14 text-bulma',
-// 'font-medium rounded-moon-i-sm transition-colors cursor-pointer hover:bg-gohan',
+// 'font-medium rounded-moon-i-sm transition-colors cursor-pointer hover:bg-goku',
// 'focus:outline-none',
-// selected && 'bg-gohan',
+// selected && 'bg-goku',
// isDisabled && 'opacity-30 hover:bg-transparent cursor-not-allowed'
// )}
// ref={ref}
@@ -159,25 +140,17 @@ const Pill = React.forwardRef(
// }
// );
-type PanelsProps = {
- className?: string;
- children?: React.ReactNode;
-};
-
-const Panels = ({ children }: PanelsProps) => (
- {children}
+const Panels = ({ children, className }: Props) => (
+ {children}
);
-type PanelProps = {
- id: string;
- className?: string;
- children?: React.ReactNode;
-};
-
-const Panel = ({ children, id }: PanelProps) => (
+const Panel = ({ children, id, className }: PanelProps) => (
{children}
diff --git a/workspaces/base/src/tabs/private/types/ListProps.ts b/workspaces/base/src/tabs/private/types/ListProps.ts
deleted file mode 100644
index 1c10efc8d8..0000000000
--- a/workspaces/base/src/tabs/private/types/ListProps.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import type Size from './Size';
-
-type ListProps = {
- size?: Size;
- className?: string;
- children?: React.ReactNode;
-};
-
-export default ListProps;
diff --git a/workspaces/base/src/tabs/private/types/PanelProps.ts b/workspaces/base/src/tabs/private/types/PanelProps.ts
index 63962e5d32..74189d628f 100644
--- a/workspaces/base/src/tabs/private/types/PanelProps.ts
+++ b/workspaces/base/src/tabs/private/types/PanelProps.ts
@@ -1,6 +1,7 @@
-type PanelProps = {
- className?: string;
- children?: React.ReactNode;
+import type Props from './Props';
+
+type PanelProps = Props & {
+ id: string;
};
export default PanelProps;
diff --git a/workspaces/base/src/tabs/private/types/Props.ts b/workspaces/base/src/tabs/private/types/Props.ts
new file mode 100644
index 0000000000..d916a547cb
--- /dev/null
+++ b/workspaces/base/src/tabs/private/types/Props.ts
@@ -0,0 +1,6 @@
+type Props = {
+ className?: string;
+ children?: React.ReactNode;
+};
+
+export default Props;
diff --git a/workspaces/base/src/tabs/private/types/TabComponentProps.ts b/workspaces/base/src/tabs/private/types/TabComponentProps.ts
new file mode 100644
index 0000000000..648b8f1595
--- /dev/null
+++ b/workspaces/base/src/tabs/private/types/TabComponentProps.ts
@@ -0,0 +1,7 @@
+import type TabPolymorphicProps from './TabPolymorphicProps';
+
+type TabComponentProps = (
+ props: TabPolymorphicProps
+) => React.ReactElement | null;
+
+export default TabComponentProps;
diff --git a/workspaces/base/src/tabs/private/types/TabPolymorphicProps.ts b/workspaces/base/src/tabs/private/types/TabPolymorphicProps.ts
new file mode 100644
index 0000000000..1c007692fa
--- /dev/null
+++ b/workspaces/base/src/tabs/private/types/TabPolymorphicProps.ts
@@ -0,0 +1,6 @@
+import type TabProps from './TabProps';
+
+type TabPolymorphicProps =
+ PolymorphicComponentPropWithRef;
+
+export default TabPolymorphicProps;
diff --git a/workspaces/base/src/tabs/private/types/TabProps.ts b/workspaces/base/src/tabs/private/types/TabProps.ts
index 2f42aea3de..cb77496b49 100644
--- a/workspaces/base/src/tabs/private/types/TabProps.ts
+++ b/workspaces/base/src/tabs/private/types/TabProps.ts
@@ -1,10 +1,10 @@
-import { ElementType } from 'react';
+import type Props from './Props';
+import type Size from './Size';
-type TabProps = {
- disabled?: boolean;
- as?: ElementType;
- className?: string | (({ selected }: { selected: boolean }) => string);
- children?: React.ReactNode;
+type TabProps = Props & {
+ isDisabled?: boolean;
+ selected?: boolean;
+ size?: Size;
};
export default TabProps;
diff --git a/workspaces/base/src/tabs/private/types/TabsProps.ts b/workspaces/base/src/tabs/private/types/TabsProps.ts
deleted file mode 100644
index ef96a757bc..0000000000
--- a/workspaces/base/src/tabs/private/types/TabsProps.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-type TabsProps = {
- selectedIndex?: number;
- onChange?: (index: number) => void;
- children?: React.ReactNode;
-};
-
-export default TabsProps;
diff --git a/workspaces/base/src/tabs/private/types/TabsState.ts b/workspaces/base/src/tabs/private/types/TabsState.ts
deleted file mode 100644
index 54f1fbedad..0000000000
--- a/workspaces/base/src/tabs/private/types/TabsState.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import type Size from './Size';
-
-type TabsState = {
- size?: Size;
-};
-
-export default TabsState;