diff --git a/docs/catalog/components/tabs-slide-indicator.mdx b/docs/catalog/components/tabs-slide-indicator.mdx index 640c7b3b1..86384d8a4 100644 --- a/docs/catalog/components/tabs-slide-indicator.mdx +++ b/docs/catalog/components/tabs-slide-indicator.mdx @@ -42,8 +42,8 @@ import { VariablesExplorer } from "/snippets/variables-explorer.jsx"; commas. Two or more names rebuild the row, one name or none leaves the authored markup alone, since a single tab has nowhere to slide to. - On every default the result is identical to the original: three 86px tabs in - a light pill track, a near-black pill sliding from the first to the second. + With the defaults, this renders three 86px tabs in a light pill track. The + near-black pill and white active label move from the first tab to the second. -->
- +
\n \n \n \n \n
\n
\n \n
\n
\n \n\n \n \n\n\n"} \ No newline at end of file +{"html":"\n\n \n \n \n Tabs Slide Indicator - Demo\n \n \n \n \n \n
\n \n \n
\n \n \n \n \n \n \n\n"} \ No newline at end of file diff --git a/registry/components/tabs-slide-indicator/demo.html b/registry/components/tabs-slide-indicator/demo.html index 99c36446a..e97610f0a 100644 --- a/registry/components/tabs-slide-indicator/demo.html +++ b/registry/components/tabs-slide-indicator/demo.html @@ -35,6 +35,7 @@ } .hf-transition-tabs-slide-indicator { --hf-tab-x: 0px; + --hf-tab-offset: var(--hf-tab-x); position: relative; display: inline-grid; grid-template-columns: repeat(3, 86px); @@ -52,21 +53,36 @@ height: 36px; border-radius: 999px; background: #18181b; - transform: translateX(var(--hf-tab-x)); + transform: translateX(var(--hf-tab-offset)); box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18); } .hf-transition-tabs-slide-indicator button { + --hf-tab-highlight-start: clamp( + 0px, + calc(var(--hf-tab-offset) - var(--hf-tab-index) * 86px), + 86px + ); + --hf-tab-highlight-end: clamp( + 0px, + calc(var(--hf-tab-offset) + 86px - var(--hf-tab-index) * 86px), + 86px + ); position: relative; z-index: 1; height: 36px; border: 0; - background: transparent; - color: #71717a; + background-color: transparent; + background-image: linear-gradient( + to right, + #6f6f78 0 var(--hf-tab-highlight-start), + #fff var(--hf-tab-highlight-start) var(--hf-tab-highlight-end), + #6f6f78 var(--hf-tab-highlight-end) 100% + ); + background-clip: text; + -webkit-background-clip: text; + color: transparent; font-weight: 600; } - .hf-transition-tabs-slide-indicator button:nth-of-type(2) { - color: #fff; - } @@ -88,8 +104,9 @@ { "id": "labels", "type": "string", "role": "content", "label": "Labels", "description": "The tab names, separated by commas. Two or more names rebuild the row.", "default": "Plan,Debug,Ask" } ]' > - + @@ -171,6 +188,7 @@ diff --git a/registry/components/tabs-slide-indicator/tabs-slide-indicator.html b/registry/components/tabs-slide-indicator/tabs-slide-indicator.html index d472843d4..b843abe40 100644 --- a/registry/components/tabs-slide-indicator/tabs-slide-indicator.html +++ b/registry/components/tabs-slide-indicator/tabs-slide-indicator.html @@ -26,8 +26,8 @@ commas. Two or more names rebuild the row, one name or none leaves the authored markup alone, since a single tab has nowhere to slide to. - On every default the result is identical to the original: three 86px tabs in - a light pill track, a near-black pill sliding from the first to the second. + With the defaults, this renders three 86px tabs in a light pill track. The + near-black pill and white active label move from the first tab to the second. -->
- +