Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(web): type scale carries line-height, whole-pixel sizes (#17658)

Trang Nguyen0f1e912bc704
diff --git a/web/.storybook/docs/ThemeTokens/Typography.tsx b/web/.storybook/docs/ThemeTokens/Typography.tsx
index 627acb7298..4345c900db 100644
--- a/web/.storybook/docs/ThemeTokens/Typography.tsx
+++ b/web/.storybook/docs/ThemeTokens/Typography.tsx
@@ -45,6 +45,18 @@ const sizeTokens = parsed.inlineTokens
const weightTokenFor = (sizeName: string) =>
parsed.inlineTokens.find((t) => t.name === `${sizeName}--font-weight`);
+const lineHeightTokenFor = (sizeName: string) =>
+ parsed.inlineTokens.find((t) => t.name === `${sizeName}--line-height`);
+
+/** `calc(20 / 13)` or `1.4` → px at the given size. */
+const lineHeightPx = (value: string, sizePx: number) => {
+ const ratio = value.match(/calc\(\s*([\d.]+)\s*\/\s*([\d.]+)\s*\)/);
+ const factor = ratio
+ ? Number(ratio[1]) / Number(ratio[2])
+ : parseFloat(value);
+ return Number.isFinite(factor) ? factor * sizePx : undefined;
+};
+
/** First family in the (var-resolved) stack, e.g. `Inter` or `ui-monospace`. */
const familyName = (token: TokenDeclaration) =>
resolveStatic(token.value).split(",")[0].trim().replace(/^"|"$/g, "");
@@ -74,6 +86,10 @@ function TypeScaleRow({ token }: { token: TokenDeclaration }) {
? resolveStatic(weightToken.value)
: undefined;
const declaredPx = parseFloat(token.value) * 16;
+ const lineHeightToken = lineHeightTokenFor(token.name);
+ const leadingPx = lineHeightToken
+ ? lineHeightPx(lineHeightToken.value, declaredPx)
+ : undefined;
const usage = SIZE_USAGE[token.name];
return (
@@ -84,6 +100,7 @@ function TypeScaleRow({ token }: { token: TokenDeclaration }) {
className="text-foreground block truncate"
style={{
fontSize: token.value,
+ lineHeight: lineHeightToken?.value,
fontWeight: weightValue ? Number(weightValue) : undefined,
}}
>
@@ -95,6 +112,7 @@ function TypeScaleRow({ token }: { token: TokenDeclaration }) {
</div>
<div className="text-muted-foreground font-mono text-[11px] leading-4">
{token.value} / {formatPx(declaredPx)}
+ {leadingPx !== undefined && ` · line ${formatPx(leadingPx)}`}
</div>
<div className="min-w-0 font-mono text-[11px] leading-4">
{usage ? (
@@ -275,7 +293,7 @@ export function Typography() {
<PageSection
title="Type scale"
- blurb="Each size carries its canonical weight. No line-height; opt in with leading-*."
+ blurb="Each size carries its weight and its line-height: the three text sizes share 1.5, display sizes tighten to 1.35 and below. leading-* is for single-line chrome only."
aside={<InlineCode>{sizeTokens.length} sizes</InlineCode>}
>
<div className="flex flex-col">
diff --git a/web/src/components/CrashModal/CrashModal.tsx b/web/src/components/CrashModal/CrashModal.tsx
index 9c57bc5e45..50243dda55 100644
--- a/web/src/components/CrashModal/CrashModal.tsx
+++ b/web/src/components/CrashModal/CrashModal.tsx
@@ -25,7 +25,7 @@ export const CrashModal = ({
<h1 className="text-2xl font-bold tracking-tight">
Something went wrong
</h1>
- <p className="text-muted-foreground mt-2 text-sm leading-5">
+ <p className="text-muted-foreground mt-2 text-sm">
{statusCode ? (
<span className="text-foreground mr-2 font-bold whitespace-nowrap">
Error {statusCode}
diff --git a/web/src/components/MediaTag/MediaTag.stories.tsx b/web/src/components/MediaTag/MediaTag.stories.tsx
index a51f33ad3d..ef17b392eb 100644
--- a/web/src/components/MediaTag/MediaTag.stories.tsx
+++ b/web/src/components/MediaTag/MediaTag.stories.tsx
@@ -147,7 +147,7 @@ export const TruncatedMimeTypePreview = meta.story({
export const InlineWithText = meta.story({
render: () => (
- <pre className="font-sans text-sm leading-5">
+ <pre className="font-sans text-sm">
{'"media": "'}
<span className="inline-flex">
<MediaTag contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
diff --git a/web/src/components/layouts/header.tsx b/web/src/components/layouts/header.tsx
index ea8ce019ac..96c20be11d 100644
--- a/web/src/components/layouts/header.tsx
+++ b/web/src/components/layouts/header.tsx
@@ -58,9 +58,9 @@ function HeaderTitle({
</h3>
);
case "h4":
- return <h4 className={cn("text-lg leading-6", className)}>{title}</h4>;
+ return <h4 className={cn("text-lg", className)}>{title}</h4>;
case "h5":
- return <h5 className={cn("text-base leading-6", className)}>{title}</h5>;
+ return <h5 className={cn("text-base", className)}>{title}</h5>;
}
}
diff --git a/web/src/components/ui/action-button-count-badge.tsx b/web/src/components/ui/action-button-count-badge.tsx
index afd902c2c2..6560a3aacc 100644
--- a/web/src/components/ui/action-button-count-badge.tsx
+++ b/web/src/components/ui/action-button-count-badge.tsx
@@ -14,7 +14,7 @@ export function ActionButtonCountBadge({
"flex h-3.5 w-fit items-center justify-center rounded-sm px-1 text-xs",
variant === "muted"
? "bg-muted text-muted-foreground"
- : "bg-primary/50 text-primary-foreground shadow-xs",
+ : "bg-primary/65 text-primary-foreground shadow-xs",
)}
>
{count > 99 ? "99+" : count}
diff --git a/web/src/components/ui/splash-screen.tsx b/web/src/components/ui/splash-screen.tsx
index 106405cb3e..b396411b47 100644
--- a/web/src/components/ui/splash-screen.tsx
+++ b/web/src/components/ui/splash-screen.tsx
@@ -197,7 +197,7 @@ export function SplashScreen({
{step.badge}
</div>
{step.description && (
- <p className="text-muted-foreground text-sm leading-6">
+ <p className="text-muted-foreground text-sm">
{step.description}
</p>
)}
diff --git a/web/src/ee/features/billing/components/BillingScheduleNotification.tsx b/web/src/ee/features/billing/components/BillingScheduleNotification.tsx
index fd76179a35..7dc00a5edc 100644
--- a/web/src/ee/features/billing/components/BillingScheduleNotification.tsx
+++ b/web/src/ee/features/billing/components/BillingScheduleNotification.tsx
@@ -36,9 +36,9 @@ export const BillingScheduleNotification = (
<div className="flex gap-2 pl-3">
<InfoIcon className="mt-1 h-4 w-4 shrink-0" />
<div>
- <div className="leading-5">{`Your organization is scheduled to switch from ${props.planLabel} to ${props.scheduledPlanSwitch.newPlanLabel} on ${props.scheduledPlanSwitch.formatted}.`}</div>
+ <div>{`Your organization is scheduled to switch from ${props.planLabel} to ${props.scheduledPlanSwitch.newPlanLabel} on ${props.scheduledPlanSwitch.formatted}.`}</div>
{props.scheduledPlanSwitch.message && (
- <div className="mt-2 leading-5 text-blue-800 dark:text-blue-300">
+ <div className="mt-2 text-blue-800 dark:text-blue-300">
{props.scheduledPlanSwitch.message}
</div>
)}
diff --git a/web/src/features/ai-gateway/components/GatewayConfigurationPage/components/GatewayConfigurationView/GatewayConfigurationView.tsx b/web/src/features/ai-gateway/components/GatewayConfigurationPage/components/GatewayConfigurationView/GatewayConfigurationView.tsx
index 0f4028843c..e268f2c119 100644
--- a/web/src/features/ai-gateway/components/GatewayConfigurationPage/components/GatewayConfigurationView/GatewayConfigurationView.tsx
+++ b/web/src/features/ai-gateway/components/GatewayConfigurationPage/components/GatewayConfigurationView/GatewayConfigurationView.tsx
@@ -196,7 +196,7 @@ export function GatewayConfigurationView({
</div>
<div>
<p className="text-sm font-bold">{option.title}</p>
- <p className="text-muted-foreground mt-0.5 text-xs leading-4">
+ <p className="text-muted-foreground mt-0.5 text-xs">
{option.description}
</p>
</div>
diff --git a/web/src/features/auth/EnterpriseSsoRequiredPage.tsx b/web/src/features/auth/EnterpriseSsoRequiredPage.tsx
index c36a686325..fa96491a50 100644
--- a/web/src/features/auth/EnterpriseSsoRequiredPage.tsx
+++ b/web/src/features/auth/EnterpriseSsoRequiredPage.tsx
@@ -155,7 +155,7 @@ export default function EnterpriseSsoRequiredPage() {
<h1 className="text-primary mt-6 text-center text-2xl font-bold">
Use your Enterprise SSO
</h1>
- <p className="text-muted-foreground mt-2 text-center text-sm leading-6">
+ <p className="text-muted-foreground mt-2 text-center text-sm">
{description} Enter your company email so we can send you to the
correct identity provider.
</p>
diff --git a/web/src/features/auth/SignInPage.tsx b/web/src/features/auth/SignInPage.tsx
index 72df89e696..7df804fc44 100644
--- a/web/src/features/auth/SignInPage.tsx
+++ b/web/src/features/auth/SignInPage.tsx
@@ -929,7 +929,7 @@ export default function SignInPage({
No account yet?{" "}
<Link
href={`/auth/sign-up${router.asPath.includes("?") ? router.asPath.substring(router.asPath.indexOf("?")) : ""}`}
- className="text-link hover:text-link-hover leading-6 font-bold"
+ className="text-link hover:text-link-hover font-bold"
>
Sign up
</Link>
diff --git a/web/src/features/auth/SignUpPage.tsx b/web/src/features/auth/SignUpPage.tsx
index e296e79b71..457c9e9fd2 100644
--- a/web/src/features/auth/SignUpPage.tsx
+++ b/web/src/features/auth/SignUpPage.tsx
@@ -509,7 +509,7 @@ function SignupFooter() {
Already have an account?{" "}
<Link
href={`/auth/sign-in${router.asPath.includes("?") ? router.asPath.substring(router.asPath.indexOf("?")) : ""}`}
- className="text-link hover:text-link-hover leading-6 font-bold"
+ className="text-link hover:text-link-hover font-bold"
>
Sign in
</Link>
diff --git a/web/src/features/evals/components/evaluator-paused-callout.tsx b/web/src/features/evals/components/evaluator-paused-callout.tsx
index 4011f6bd7e..b79a78d67a 100644
--- a/web/src/features/evals/components/evaluator-paused-callout.tsx
+++ b/web/src/features/evals/components/evaluator-paused-callout.tsx
@@ -97,11 +97,11 @@ export function EvaluatorPausedCallout({
<AlertTriangle className="text-dark-yellow mt-0.5 h-4 w-4 shrink-0" />
<div className="min-w-0 flex-1">
- <h3 className="text-foreground text-base leading-5 font-bold">
+ <h3 className="text-foreground text-base font-bold">
Evaluator paused
</h3>
- <div className="text-muted-foreground mt-1 flex flex-wrap items-center gap-2 text-sm leading-5">
+ <div className="text-muted-foreground mt-1 flex flex-wrap items-center gap-2 text-sm">
<span className="text-muted-foreground font-bold">
{blockMetadata.shortLabel}
</span>
@@ -115,7 +115,7 @@ export function EvaluatorPausedCallout({
) : null}
</div>
- <p className="text-muted-foreground mt-2 max-w-3xl text-sm leading-5">
+ <p className="text-muted-foreground mt-2 max-w-3xl text-sm">
{blockMessage}
</p>
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx
index feede29547..ad101d84c0 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx
@@ -20,13 +20,13 @@ export function EvaluatorTemplateRow({
>
<span className="grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1 @3xl:grid-cols-[minmax(10rem,18rem)_minmax(0,1fr)_max-content_max-content]">
<span
- className="col-start-1 row-start-1 min-w-0 truncate text-sm leading-5 font-bold"
+ className="col-start-1 row-start-1 min-w-0 truncate text-sm font-bold"
title={template.name}
>
{template.name}
</span>
<span
- className="text-muted-foreground col-span-2 col-start-1 row-start-2 min-w-0 truncate text-sm leading-5 @3xl:col-span-1 @3xl:col-start-2 @3xl:row-start-1"
+ className="text-muted-foreground col-span-2 col-start-1 row-start-2 min-w-0 truncate text-sm @3xl:col-span-1 @3xl:col-start-2 @3xl:row-start-1"
title={description}
>
{description}
diff --git a/web/src/features/evals/v2/components/Evaluators/EvaluatorBlockedBanner/EvaluatorBlockedBanner.tsx b/web/src/features/evals/v2/components/Evaluators/EvaluatorBlockedBanner/EvaluatorBlockedBanner.tsx
index 648077bfbe..dbe75e9156 100644
--- a/web/src/features/evals/v2/components/Evaluators/EvaluatorBlockedBanner/EvaluatorBlockedBanner.tsx
+++ b/web/src/features/evals/v2/components/Evaluators/EvaluatorBlockedBanner/EvaluatorBlockedBanner.tsx
@@ -73,11 +73,11 @@ export function EvaluatorBlockedBanner({
<AlertTriangle className="text-dark-yellow mt-0.5 h-4 w-4 shrink-0" />
<div className="min-w-0 flex-1">
- <h2 className="text-foreground text-base leading-5 font-bold">
+ <h2 className="text-foreground text-base font-bold">
Evaluator paused
</h2>
- <div className="text-muted-foreground mt-1 flex flex-wrap items-center gap-2 text-sm leading-5">
+ <div className="text-muted-foreground mt-1 flex flex-wrap items-center gap-2 text-sm">
<span className="text-muted-foreground font-bold">
{blockMetadata.shortLabel}
</span>
@@ -89,7 +89,7 @@ export function EvaluatorBlockedBanner({
</Fragment>
</div>
- <p className="text-muted-foreground mt-2 max-w-3xl text-sm leading-5">
+ <p className="text-muted-foreground mt-2 max-w-3xl text-sm">
{blockMessage ?? DEFAULT_BLOCK_MESSAGE}
</p>
diff --git a/web/src/features/feature-previews/components/FeaturePreviewModal.tsx b/web/src/features/feature-previews/components/FeaturePreviewModal.tsx
index b18b6a67d4..d62936b7e0 100644
--- a/web/src/features/feature-previews/components/FeaturePreviewModal.tsx
+++ b/web/src/features/feature-previews/components/FeaturePreviewModal.tsx
@@ -159,7 +159,7 @@ export function FeaturePreviewModal({
<h2 className="text-foreground text-xl font-bold">
{featurePreviewLabels[selected.flag]}
</h2>
- <p className="text-muted-foreground mt-2 max-w-2xl text-sm leading-5">
+ <p className="text-muted-foreground mt-2 max-w-2xl text-sm">
{selected.description}
</p>
<Button asChild className="mt-4">
@@ -191,7 +191,7 @@ export function FeaturePreviewModal({
<h3 className="text-foreground text-sm font-bold">
{featurePreviewLabels.sessionTimeline}
</h3>
- <p className="text-muted-foreground mt-1 max-w-2xl text-sm leading-5">
+ <p className="text-muted-foreground mt-1 max-w-2xl text-sm">
Use the redesigned timeline to navigate session events
in chronological order.
</p>
@@ -215,7 +215,7 @@ export function FeaturePreviewModal({
<PreviewMockupPanel illustration={selected.illustration} />
- <p className="text-muted-foreground mt-5 text-sm leading-5">
+ <p className="text-muted-foreground mt-5 text-sm">
{selected.details}
</p>
</>
diff --git a/web/src/features/in-app-agent/components/InAppAgentMessage.tsx b/web/src/features/in-app-agent/components/InAppAgentMessage.tsx
index ed4ce639fd..23ecfd83c0 100644
--- a/web/src/features/in-app-agent/components/InAppAgentMessage.tsx
+++ b/web/src/features/in-app-agent/components/InAppAgentMessage.tsx
@@ -444,7 +444,7 @@ function InAppAgentReasoningBlock({
className={cn(
// Vertical spacing is margin, not padding, so the left border
// hugs the text instead of extending past it.
- "border-border/70 mt-2 mb-1 border-l px-3 leading-5 wrap-break-word whitespace-pre-wrap",
+ "border-border/70 mt-2 mb-1 border-l px-3 wrap-break-word whitespace-pre-wrap",
isCompact && "px-2.5 leading-4",
)}
>
@@ -804,7 +804,7 @@ function ToolCallDisclosure({
<summary
aria-label={`${toolName}: ${status}`}
className={cn(
- "hover:text-foreground focus-visible:ring-ring flex cursor-pointer list-none items-center gap-1.5 rounded-md px-1 py-0.5 text-xs leading-4 font-bold outline-none focus-visible:ring-2 focus-visible:ring-offset-2 [&::-webkit-details-marker]:hidden",
+ "hover:text-foreground focus-visible:ring-ring flex cursor-pointer list-none items-center gap-1.5 rounded-md px-1 py-0.5 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-offset-2 [&::-webkit-details-marker]:hidden",
isCompact && "px-0.5",
)}
>
diff --git a/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineContentMessage/SessionTimelineContentMessage.tsx b/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineContentMessage/SessionTimelineContentMessage.tsx
index 3f7f46c36c..a4fc8fece9 100644
--- a/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineContentMessage/SessionTimelineContentMessage.tsx
+++ b/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineContentMessage/SessionTimelineContentMessage.tsx
@@ -153,7 +153,7 @@ export function SessionTimelineContentMessage({
{!isJsonOnly || isJsonExpanded ? (
<div
className={cn(
- "flex flex-col gap-2 text-sm leading-6",
+ "flex flex-col gap-2 text-sm",
isJsonOnly && "mt-2",
)}
>
diff --git a/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineSystemMessage/SessionTimelineSystemMessage.tsx b/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineSystemMessage/SessionTimelineSystemMessage.tsx
index d03f4641b1..cbbaa507fb 100644
--- a/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineSystemMessage/SessionTimelineSystemMessage.tsx
+++ b/web/src/features/sessions/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTimelineSystemMessage/SessionTimelineSystemMessage.tsx
@@ -16,7 +16,7 @@ export function SessionTimelineSystemMessage({
variant="plain"
alignment="row"
>
- <div className="text-muted-foreground flex flex-col gap-2 text-sm leading-6">
+ <div className="text-muted-foreground flex flex-col gap-2 text-sm">
{parts.map((part, index) => (
<SessionTimelinePart key={`${part.type}-${index}`} part={part} />
))}
diff --git a/web/src/features/v4-migration/V4MigrationLoadingState.tsx b/web/src/features/v4-migration/V4MigrationLoadingState.tsx
index 16a99e6ca1..630bbd960c 100644
--- a/web/src/features/v4-migration/V4MigrationLoadingState.tsx
+++ b/web/src/features/v4-migration/V4MigrationLoadingState.tsx
@@ -1,7 +1,7 @@
export function V4MigrationLoadingState() {
return (
<div className="flex min-h-full flex-1 items-center justify-center px-6 py-12">
- <p className="text-primary text-center text-base leading-6" role="status">
+ <p className="text-primary text-center text-base" role="status">
Checking project status ...
</p>
</div>
diff --git a/web/src/features/v4-migration/V4MigrationStatusPage.clienttest.tsx b/web/src/features/v4-migration/V4MigrationStatusPage.clienttest.tsx
index a181157675..1d1818df43 100644
--- a/web/src/features/v4-migration/V4MigrationStatusPage.clienttest.tsx
+++ b/web/src/features/v4-migration/V4MigrationStatusPage.clienttest.tsx
@@ -215,7 +215,7 @@ describe("V4MigrationStatusPage", () => {
expect(screen.queryByRole("table")).not.toBeInTheDocument();
expect(screen.queryByText("What's new in v4")).not.toBeInTheDocument();
expect(screen.getByText(/Checking project status/)).toBeInTheDocument();
- expect(screen.getByRole("status")).toHaveClass("text-base", "leading-6");
+ expect(screen.getByRole("status")).toHaveClass("text-base");
expect(screen.getByRole("status")).not.toHaveClass("text-2xl", "font-bold");
expect(
screen.queryByRole("img", { name: "Langfuse" }),
diff --git a/web/src/styles/globals.css b/web/src/styles/globals.css
index 6d28f3d2b0..d424003912 100644
--- a/web/src/styles/globals.css
+++ b/web/src/styles/globals.css
@@ -166,25 +166,29 @@
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
- /* Text styles: each size token carries its canonical weight, so `text-*`
- alone yields a complete style (one weight per token — the design-system
- rule). Weights reference the font-relative weight roles above; heavier
- text opts in via `font-bold` (the bold role) — never a raw number.
- Any other weight utility is drift (the theme-lab tool samples drift
- per token). */
- --text-xs: 0.725rem;
+ /* Text styles: each size token carries its size (whole pixels at a 16px
+ root), line-height and canonical weight, so `text-*` alone yields a
+ complete style. Heavier text opts in via `font-bold`, never a raw number. */
+ --text-xs: 0.75rem;
+ --text-xs--line-height: calc(18 / 12);
--text-xs--font-weight: var(--font-weight-regular);
- --text-sm: 0.825rem;
+ --text-sm: 0.8125rem;
+ --text-sm--line-height: calc(20 / 13);
--text-sm--font-weight: var(--font-weight-regular);
- --text-base: 0.9rem;
+ --text-base: 0.875rem;
+ --text-base--line-height: 1.5;
--text-base--font-weight: var(--font-weight-regular);
- --text-lg: 1.1rem;
+ --text-lg: 1rem;
+ --text-lg--line-height: 1.35;
--text-lg--font-weight: var(--font-weight-regular);
- --text-xl: 1.2rem;
+ --text-xl: 1.25rem;
+ --text-xl--line-height: 1.3;
--text-xl--font-weight: var(--font-weight-regular);
- --text-2xl: 1.3rem;
+ --text-2xl: 1.375rem;
+ --text-2xl--line-height: 1.25;
--text-2xl--font-weight: var(--font-weight-regular);
--text-3xl: 1.5rem;
+ --text-3xl--line-height: 1.25;
--text-3xl--font-weight: var(--font-weight-regular);
--animate-rainbow: rainbow var(--speed, 2s) infinite linear;