Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

wrap tab lists to prevent overflow (#18859)

Charise11717493f8b
diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx
index a94b1209608..97cc9b5e177 100644
--- a/apps/docs/components/index.tsx
+++ b/apps/docs/components/index.tsx
@@ -85,7 +85,7 @@ const components = {
{props.children}
</Alert>
),
- Tabs,
+ Tabs: (props: any) => <Tabs wrappable {...props} />,
TabPanel: (props: any) => <Tabs.Panel {...props}>{props.children}</Tabs.Panel>,
h2: (props: any) => (
<Heading tag="h2" {...props}>
diff --git a/apps/docs/styles/main.scss b/apps/docs/styles/main.scss
index bb372ac62aa..d0b9484711d 100644
--- a/apps/docs/styles/main.scss
+++ b/apps/docs/styles/main.scss
@@ -249,21 +249,6 @@ article p code {
border: none;
}
-// prevent horizontal scroll on mobile for tablist tab headers
-div[role='tablist'] {
- @media screen and (min-width: 320px) {
- max-width: 320px;
- }
-
- @media screen and (min-width: 600px) {
- max-width: 520px;
- }
-
- @media screen and (min-width: 769px) {
- max-width: 620px;
- }
-}
-
/*
* sets the image in @Next/Image components
* to respect the height of the content
diff --git a/packages/ui/src/components/Tabs/Tabs.tsx b/packages/ui/src/components/Tabs/Tabs.tsx
index 4296259fa94..60c5e054517 100644
--- a/packages/ui/src/components/Tabs/Tabs.tsx
+++ b/packages/ui/src/components/Tabs/Tabs.tsx
@@ -16,6 +16,7 @@ interface TabsProps {
onChange?: any
onClick?: any
scrollable?: boolean
+ wrappable?: boolean
addOnBefore?: React.ReactNode
addOnAfter?: React.ReactNode
listClassNames?: string
@@ -35,6 +36,7 @@ const Tabs: React.FC<PropsWithChildren<TabsProps>> & TabsSubComponents = ({
onChange,
onClick,
scrollable,
+ wrappable,
addOnBefore,
addOnAfter,
listClassNames,
@@ -89,6 +91,7 @@ const Tabs: React.FC<PropsWithChildren<TabsProps>> & TabsSubComponents = ({
const listClasses = [__styles[type].list]
if (scrollable) listClasses.push(__styles.scrollable)
+ if (wrappable) listClasses.push(__styles.wrappable)
if (listClassNames) listClasses.push(listClassNames)
return (
diff --git a/packages/ui/src/lib/theme/defaultTheme.ts b/packages/ui/src/lib/theme/defaultTheme.ts
index f81d20ec1ab..73e5fe6ae68 100644
--- a/packages/ui/src/lib/theme/defaultTheme.ts
+++ b/packages/ui/src/lib/theme/defaultTheme.ts
@@ -409,6 +409,7 @@ export default {
...default__padding_and_text,
},
scrollable: `overflow-auto whitespace-nowrap no-scrollbar mask-fadeout-right`,
+ wrappable: `flex-wrap`,
content: `focus:outline-none transition-height`,
},