Files
supabase/apps/design-system/content/docs/typography.mdx
Danny White 9bd86bee93 feat(design-system): document shared inline code defaults (#51984)
## Problem

The design system repeats inline-code styles and does not document the
new shared defaults.

## Solution

Import the shared styles from #51980 and document how sizing, colour,
weight and wrapping work. Add examples of bare and linked code, tables,
long values, Tailwind overrides and `data-code-style="plain"`. Remove
repeated styles from existing examples.

Highlighted code blocks keep an explicit `text-sm` size so removing
inline-code classes does not enlarge them.

## Review instructions

This PR changes the design-system app only.

1. Open the [Layout
page](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/layout).
Check the inline-code examples at narrow and desktop widths in both
themes.
2. Check code in headings, long values, explicit size overrides and the
plain display example. Code should use the default foreground colour and
follow the surrounding weight unless a class overrides it.
3. Check the [chart palette
example](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/charts).
CSS variable names should remain `<code>` elements with their own
display styles.

| Before | After |
| --- | --- |
| <img width="1666" height="770" alt="CleanShot 2026-10-20 at 16 37
20@2x"
src="https://github.com/user-attachments/assets/2ac87442-12a9-49ab-8e4f-f82436308567"
/> | <img width="1680" height="782" alt="CleanShot 2026-10-20 at 16 36
12@2x"
src="https://github.com/user-attachments/assets/b0074844-3431-4fb9-827b-c6fd0de889fe"
/> |
| _Layout
([live](https://supabase.com/design-system/docs/ui-patterns/layout))_ |
_Layout
([preview](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/layout))_
|
| <img width="1072" height="476" alt="CleanShot 2026-10-20 at 16 35
14@2x"
src="https://github.com/user-attachments/assets/242bf850-58fa-4b29-a978-bd0e296c2e8b"
/> | <img width="1072" height="484" alt="CleanShot 2026-10-20 at 16 34
47@2x"
src="https://github.com/user-attachments/assets/962adef0-05b7-47ed-8fdc-5229a3a332e1"
/> |
| _Charts
([live](https://supabase.com/design-system/docs/ui-patterns/charts))_ |
_Charts
([preview](https://design-system-git-dnywh-depr-707-code-design-system-supabase.vercel.app/design-system/docs/ui-patterns/charts)):
no visual changes as `data-code-style="plain"` has been used_ |
2026-10-22 00:48:57 +00:00

51 lines
2.0 KiB
Plaintext

---
title: Typography
description: An overview of all available typography CSS variables.
---
Use shared typography styles to keep text consistent across apps. You can find the
heading, text, and link utilities in [`typography.css`](https://github.com/supabase/supabase/blob/master/packages/config/typography.css).
## Primary text
Use `text-primary` for readable text in Supabase green.
`text-primary` meets WCAG AA for normal text on app surfaces: darkened in light mode,
bright in dark mode. Focus rings and selected controls derive their brighter fill from
the same primary hue. See [Primary and brand colors](../docs/color-usage#primary-and-brand-colors) for when
to use each green.
## Inline code
Apps that import `config/inline-code.css` get shared styles for inline `<code>`, including
a border, background, and default foreground color. Code inherits the surrounding font weight
and line height. Sizing keeps code readable beside small text, then stays 2px below the
surrounding text from 16px upward, with a minimum of `0.75rem` (normally 12px).
| Surrounding text | Inline code |
| ---------------- | ----------- |
| 13px | 12px |
| 14px | 12.5px |
| 15px | 13.25px |
| 16px | 14px |
| 20px | 18px |
These sizes assume the standard 16px root font size.
Long identifiers stay intact when they fit on the next line, but can break to avoid overflow.
Tailwind utilities can override the defaults. A size class on `<code>` sets its size directly;
put the class on a parent to keep the automatic sizing:
```tsx
<span className="text-sm">
<code>project_id</code>
</span>
```
Code blocks and syntax-highlighting containers keep their own styles. For other custom
displays, such as a command strip, add `data-code-style="plain"` to the `<code>` element
or a parent. This removes all shared inline-code styles from that element and its descendants,
so the display can control its own appearance.
<ComponentPreview name="typography-inline-code" />