Skip to content

Commit 65c8222

Browse files
authored
Fix tabs display with long labels (#2605) (#2606)
* Add tabs--allow-multiline class to handle tabs with long labels * Use it on document concept page
1 parent 22a6f5c commit 65c8222

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

docusaurus/docs/cms/api/document.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Manipulating documents with the [Document Service API](/cms/api/document-service
3333

3434
The following diagrams represent all the possible variations of content depending on which features, such as [Internationalization (i18n)](/cms/features/internationalization) and [Draft & Publish](/cms/features/draft-and-publish), are enabled for a content-type:
3535

36-
<Tabs>
36+
<Tabs className="tabs--allow-multiline">
3737
<TabItem value="document-only" label="Neither i18n nor Draft & Publish enabled">
3838

3939
<MermaidWithFallback

docusaurus/src/scss/tabs.scss

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// Variables
55
:root body {
6-
// Using variables to make future changes easier
76
--custom-tabs-px: var(--strapi-spacing-5);
87
--custom-tabs-py: var(--strapi-spacing-2);
98
--ifm-tabs-padding-horizontal: var(--custom-tabs-px);
@@ -111,6 +110,39 @@
111110
}
112111
}
113112
}
113+
114+
// Usage: add "tabs--allow-multiline" class to <Tabs> container
115+
&.tabs--allow-multiline &__item {
116+
height: auto;
117+
min-height: var(--tabs-item-height);
118+
max-width: 200px;
119+
120+
display: flex;
121+
align-items: center;
122+
justify-content: center;
123+
text-align: center;
124+
125+
button {
126+
white-space: normal !important;
127+
line-height: 1.3;
128+
height: auto !important;
129+
min-height: 32px;
130+
131+
display: flex;
132+
align-items: center;
133+
justify-content: center;
134+
text-align: center;
135+
width: 100%;
136+
137+
// Limit to 2 lines maximum
138+
overflow: hidden;
139+
display: -webkit-box;
140+
-webkit-line-clamp: 2;
141+
-webkit-box-orient: vertical;
142+
143+
padding: 4px 8px;
144+
}
145+
}
114146
}
115147

116148
/** Tabs inside Details component */

0 commit comments

Comments
 (0)