Files
supabase/apps/docs/styles/code-block.css
T
Anthony Lio 12a1fd5427 fix(docs): codetabs file tabs (#50811)
## Problem

#50734 restyled single named code blocks as file tabs but code blocks
grouped with `<$CodeTabs>` render through a separate path and kept the
old pill style

## Solution

- add a `CodeTabs` component with the same file tab styling
- sets the `<$CodeTabs>` remark directive at it instead of `Tabs`
- remove the unused `NamedCodeBlock` copy in www (nothing in www outputs
it)

| state | preview |
| -------|------|
| before | <img width="781" height="352" alt="image"
src="https://github.com/user-attachments/assets/1e6261ae-30b7-4397-b2f4-c31bad5f9839"
/> |
| after | <img width="762" height="291" alt="image"
src="https://github.com/user-attachments/assets/851b25ed-98b7-4a5c-8d3e-fece385e3af2"
/> |

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. visit
[/docs/guides/getting-started/quickstarts/nextjs](https://docs-git-fix-docs-codetabs-file-tabs-supabase.vercel.app/docs/guides/getting-started/quickstarts/nextjs#7-query-supabase-data-from-nextjs)


## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which references
[WORD_LIST](https://github.com/supabase/supabase/blob/master/apps/docs/WORD_LIST.md)
and the docs
[CONTRIBUTING](https://github.com/supabase/supabase/blob/master/apps/docs/CONTRIBUTING.md)
guide


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Documentation code samples support labeled tabs, with the first tab
selected by default.
* Source menus show organization and repository paths, and source links
remain labeled “View source.”
* **Style**
* Updated code sample tabs with active-tab accents and flares, plus
clearer focus outlines and depth effects.
* Refined code-block spacing and presentation, including a styled source
footer and updated menu alignment.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-25 18:12:11 +03:00

141 lines
4.4 KiB
CSS

@utility code-line-number {
@apply select-none text-right text-muted/70 pl-3 pr-2 min-h-5 leading-5;
@apply bg-[var(--row-rest)] sticky left-0 z-10;
@apply group-hover/row:text-muted group-hover/row:bg-[var(--row-hover)];
@apply after:pointer-events-none after:absolute after:inset-y-0 after:left-full after:w-4;
@apply [--gutter-fade:var(--row-rest)] group-hover/row:[--gutter-fade:var(--row-hover)];
@apply after:bg-[image:linear-gradient(to_right,var(--gutter-fade)_0%,color-mix(in_srgb,var(--gutter-fade)_85%,transparent)_25%,color-mix(in_srgb,var(--gutter-fade)_50%,transparent)_50%,color-mix(in_srgb,var(--gutter-fade)_15%,transparent)_75%,transparent_100%)];
}
@utility code-line-content {
@apply min-h-5 leading-5 pl-3 pr-18 group-hover/row:bg-[var(--row-hover)];
}
/* Code blocks need margin applied when in content container */
.prose :where(.shiki, .shiki-wrapper):where(:not(.shiki-wrapper *)) {
margin-block: 2rem;
}
/* Code block theme colors for use with Supabase Theme */
[data-theme='dark'],
.dark {
--code-token-keyword: #bda4ff;
--code-foreground: #ffffff;
--code-token-constant: #3ecf8e;
--code-token-string: #ffcda1;
--code-token-comment: #949494;
--code-token-parameter: #ffffff;
--code-token-function: #3ecf8e;
--code-token-string-expression: #ffcda1;
--code-token-punctuation: #ffffff;
--code-token-link: #ffffff;
--code-token-number: #ffffff;
--code-token-property: #3ecf8e;
--code-token-variable: var(--code-foreground);
--code-highlight-color: #232323;
--shadow-codeblock:
0 0 0 0 var(--border-default), 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 0 rgba(0, 0, 0, 0.3);
--drop-shadow-codeblock: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}
[data-theme='light'],
.light {
--code-token-keyword: #5f2fc4;
--code-foreground: oklch(from var(--foreground-light) l c h / 1);
--code-token-constant: #15593b;
--code-token-string: #9a5200;
--code-token-comment: #6a6a6a;
--code-token-parameter: oklch(from var(--foreground-light) l c h / 1);
--code-token-function: #15593b;
--code-token-string-expression: #9a5200;
--code-token-punctuation: oklch(from var(--foreground-light) l c h / 1);
--code-token-link: oklch(from var(--foreground-light) l c h / 1);
--code-token-number: oklch(from var(--foreground-light) l c h / 1);
--code-token-property: #15593b;
--code-token-variable: var(--code-foreground);
--code-highlight-color: #1c1c1c;
}
/* Token classes emitted by CodeBlock.utils.ts */
.shiki .s-f {
color: var(--code-foreground);
}
.shiki .s-c {
color: var(--code-token-comment);
}
.shiki .s-n {
color: var(--code-token-constant);
}
.shiki .s-u {
color: var(--code-token-function);
}
.shiki .s-k {
color: var(--code-token-keyword);
}
.shiki .s-a {
color: var(--code-token-parameter);
}
.shiki .s-r {
color: var(--code-token-property);
}
.shiki .s-p {
color: var(--code-token-punctuation);
}
.shiki .s-s {
color: var(--code-token-string);
}
.shiki .s-e {
color: var(--code-token-string-expression);
}
.shiki .s-v {
color: var(--code-token-variable);
}
.shiki .s-i {
font-style: italic;
}
.shiki .s-b {
font-weight: bold;
}
.shiki .s-l {
text-decoration: underline;
}
/* Word wrap styles for code blocks */
.shiki[data-wrapped='true'] .code-scroll {
overflow-x: hidden !important;
}
.shiki[data-wrapped='true'] .code-content {
white-space: pre-wrap !important;
overflow-wrap: anywhere !important;
}
.shadow-codeblock {
box-shadow: var(--shadow-codeblock, none);
}
.shiki-wrapper {
--tab-flare-ring:
transparent 6.75px, var(--border-color-default) 7.25px, var(--border-color-default) 7.75px,
transparent 8.25px;
--tab-flare-fill: transparent 6.75px, var(--background-color-200) 7.25px;
--tab-flare-left:
radial-gradient(circle at 0 0, var(--tab-flare-ring)),
radial-gradient(circle at 0 0, var(--tab-flare-fill));
--tab-flare-right:
radial-gradient(circle at 100% 0, var(--tab-flare-ring)),
radial-gradient(circle at 100% 0, var(--tab-flare-fill));
}
.codeblock-drop-shadow {
filter: var(--drop-shadow-codeblock, none);
}
.code-sample-source .shiki {
mask:
linear-gradient(#000 0 0),
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='127' height='42'%3E%3Cpath d='M0 40A8 8 0 0 0 8 32V16A8 8 0 0 1 16 8H117A8 8 0 0 0 125 0H127V42H0Z'/%3E%3C/svg%3E")
right -2px bottom -2px / 127px 42px no-repeat;
mask-composite: exclude;
mask-clip: no-clip;
}