src/skills/typography/SKILL.md
--- name: sgds-typography description: Teaches AI agents how to help developers use SGDS typography utilities (font-size, font-weight, line-height, letter-spacing) with the sgds: prefix. Use when users ask about text sizing, font weights, line spacing, or typography styling in SGDS designs. metadata: author: singapore-design-system version: "0.0.0" audience: external category: typography --- # SGDS Typography Utilities Skill Helps developers use SGDS typography utilities for consistent
npx skillsauth add govtechsg/sgds-web-component src/skills/typographyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Helps developers use SGDS typography utilities for consistent text sizing, weights, spacing, and formatting.
Required: Complete setup from sgds-utilities-setup skill first.
Typography utilities require the utility CSS import but do NOT require theme files.
All SGDS typography utilities use the sgds: prefix for font sizes, weights, line heights, and letter spacing.
Apply text sizes using sgds:text-{size} where the number matches the pixel value:
<p class="sgds:text-12">12px — captions, fine print</p>
<p class="sgds:text-14">14px — labels, helper text</p>
<p class="sgds:text-16">16px — default body text</p>
<p class="sgds:text-20">20px — lead paragraphs, intro text</p>
<h4 class="sgds:text-24">24px — H4 / card headings</h4>
<h3 class="sgds:text-28">28px — H3</h3>
<h2 class="sgds:text-32">32px — H2</h2>
<h1 class="sgds:text-40">40px — H1</h1>
<h1 class="sgds:text-48">48px — page titles</h1>
<h1 class="sgds:text-56">56px — hero display</h1>
12 = 12px14 = 14px16 = 16px (default)20 = 20px24 = 24px28 = 28px32 = 32px40 = 40px48 = 48px56 = 56pxSizes outside this base scale (18, 22, 26, 30, 36, 44, 52) are available for responsive use only.
Apply font weights using sgds:font-{weight}:
<p class="sgds:font-light">Light weight (300)</p>
<p class="sgds:font-regular">Regular weight (400) - default</p>
<p class="sgds:font-semibold">Semibold weight (600)</p>
<p class="sgds:font-bold">Bold weight (700)</p>
light = 300regular = 400 (default)semibold = 600bold = 700Apply line heights using sgds:leading-{scale}:
<!-- Body text (default) -->
<p class="sgds:leading-normal">Normal line height (1.5)</p>
<!-- Display, headings, and subheadings -->
<h1 class="sgds:leading-tight">Tight line height (1.2)</h1>
normal = 1.5 (default — body text)tight = 1.2 (display, headings, subheadings)Apply letter spacing using sgds:tracking-{size}:
<!-- Tighter spacing -->
<p class="sgds:tracking-tighter">Tighter letter spacing (-0.05em)</p>
<p class="sgds:tracking-tight">Tight letter spacing (-0.025em)</p>
<!-- Normal spacing -->
<p class="sgds:tracking-normal">Normal letter spacing (0em)</p>
<!-- Wider spacing -->
<p class="sgds:tracking-wide">Wide letter spacing (0.025em)</p>
<p class="sgds:tracking-wider">Wider letter spacing (0.05em)</p>
<p class="sgds:tracking-widest">Widest letter spacing (0.1em)</p>
tighter = -0.0625emtight = -0.025emnormal = 0em (default)wide = 0.0625emwider = 0.125emApply font families using sgds:font-{family}:
<!-- Sans-serif (default) -->
<p class="sgds:font-sans">
System sans-serif font stack
</p>
<!-- Monospace (code) -->
<code class="sgds:font-mono">
Monospace font for code
</code>
sans - System sans-serif stack (Inter, system-ui, etc.)mono - Monospace stack (jetbrainsmono, 'Courier New', etc.)<h1 class="sgds:text-display-default sgds:text-48 sgds:font-bold sgds:leading-tight sgds:tracking-tight">
Hero Display Heading
</h1>
<h1 class="sgds:text-display-default sgds:text-56 sgds:font-bold sgds:leading-tight">
Extra Large Hero
</h1>
<!-- H2 -->
<h2 class="sgds:text-heading-default sgds:text-32 sgds:font-semibold sgds:leading-tight sgds:mb-6">
Section Heading
</h2>
<!-- H3 -->
<h3 class="sgds:text-heading-default sgds:text-24 sgds:font-semibold sgds:leading-tight sgds:mb-4">
Subsection Heading
</h3>
<!-- H4 -->
<h4 class="sgds:text-heading-default sgds:text-20 sgds:font-semibold sgds:leading-tight sgds:mb-3">
Minor Heading
</h4>
<!-- Large body text (lead paragraph) -->
<p class="sgds:text-body-default sgds:text-20 sgds:leading-normal sgds:mb-4">
Lead paragraph with larger text for better readability.
</p>
<!-- Standard body text -->
<p class="sgds:text-body-default sgds:text-16 sgds:leading-normal sgds:mb-4">
Regular body text for main content.
</p>
<!-- Small body text (captions, metadata) -->
<p class="sgds:text-body-subtle sgds:text-14 sgds:leading-normal">
Caption or metadata text.
</p>
<!-- Extra small (fine print) -->
<p class="sgds:text-body-subtle sgds:text-12 sgds:leading-normal">
Fine print or legal text.
</p>
<label class="sgds:text-label-default sgds:text-14 sgds:font-semibold sgds:block sgds:mb-2">
Form Field Label
</label>
<label class="sgds:text-label-default sgds:text-16 sgds:font-semibold sgds:block sgds:mb-2">
Larger Form Label
</label>
<a href="#" class="sgds:text-link-default sgds:text-16 sgds:font-regular">
Standard link
</a>
<a href="#" class="sgds:text-link-default sgds:text-16 sgds:font-semibold">
Semibold weight link
</a>
<!-- Inline code -->
<p class="sgds:text-body-default">
Use the <code class="sgds:font-mono sgds:text-14 sgds:bg-surface-raised sgds:px-1">import</code> statement.
</p>
<!-- Code block -->
<pre class="sgds:font-mono sgds:text-14 sgds:leading-normal sgds:bg-surface-raised sgds:p-4 sgds:rounded">
function hello() {
console.log('Hello, world!');
}
</pre>
<p class="sgds:text-body-default sgds:text-16 sgds:leading-normal">
This is <strong class="sgds:font-semibold">important text</strong> that needs emphasis.
</p>
<p class="sgds:text-body-default sgds:text-16 sgds:leading-normal">
This is <em class="sgds:font-regular sgds:italic">emphasized text</em> with style.
</p>
<!-- Uppercase (e.g., labels, badges) -->
<span class="sgds:text-12 sgds:font-semibold sgds:uppercase sgds:tracking-wider">
Badge Label
</span>
<!-- Capitalize -->
<h3 class="sgds:text-20 sgds:font-semibold sgds:capitalize">
capitalize each word
</h3>
<!-- Lowercase -->
<p class="sgds:text-14 sgds:lowercase">
ALL LOWERCASE TEXT
</p>
<blockquote class="sgds:text-body-default sgds:text-20 sgds:font-regular sgds:leading-normal sgds:italic sgds:border-l-4 sgds:border-primary-default sgds:pl-6 sgds:my-6">
"This is an inspiring quote that stands out from the main content."
</blockquote>
<div class="sgds:text-center">
<p class="sgds:text-primary-default sgds:text-48 sgds:font-bold sgds:leading-tight sgds:mb-2">
1,234
</p>
<p class="sgds:text-body-subtle sgds:text-14 sgds:font-semibold sgds:uppercase sgds:tracking-wide">
Active Users
</p>
</div>
<!-- Standard button -->
<button class="sgds:bg-primary-default sgds:text-white sgds:text-16 sgds:font-semibold sgds:px-6 sgds:py-3 sgds:rounded">
Button Text
</button>
<!-- Small button -->
<button class="sgds:bg-primary-default sgds:text-white sgds:text-14 sgds:font-semibold sgds:px-4 sgds:py-2 sgds:rounded">
Small Button
</button>
<!-- Large button -->
<button class="sgds:bg-primary-default sgds:text-white sgds:text-20 sgds:font-semibold sgds:px-8 sgds:py-4 sgds:rounded">
Large Button
</button>
<div class="sgds:bg-surface-raised sgds:p-6 sgds:rounded-lg">
<h3 class="sgds:text-heading-default sgds:text-24 sgds:font-semibold sgds:leading-tight sgds:mb-2">
Card Title
</h3>
<p class="sgds:text-body-subtle sgds:text-14 sgds:leading-normal sgds:mb-4">
Updated 2 hours ago
</p>
<p class="sgds:text-body-default sgds:text-16 sgds:leading-normal sgds:mb-4">
Main card description with good readability.
</p>
<a href="#" class="sgds:text-link-default sgds:text-14 sgds:font-regular">
Read more →
</a>
</div>
Combine with responsive prefixes for adaptive sizing:
<!-- Mobile: 24px, Tablet: 32px, Desktop: 40px -->
<h1 class="sgds:text-24 md:sgds:text-32 lg:sgds:text-40 sgds:font-bold">
Responsive Heading
</h1>
<!-- Adjust line height at different breakpoints -->
<p class="sgds:text-16 sgds:leading-normal md:sgds:text-20">
Responsive body text
</p>
<!-- ✅ Good - appropriate size hierarchy -->
<h2 class="sgds:text-32 sgds:font-semibold sgds:mb-4">Section Title</h2>
<p class="sgds:text-16 sgds:leading-relaxed">Body content</p>
<!-- ❌ Avoid - poor hierarchy -->
<h2 class="sgds:text-16 sgds:font-regular">Section Title</h2>
<p class="sgds:text-32">Body content</p>
<!-- ✅ Good - headings with tight leading (1.2) -->
<h1 class="sgds:text-48 sgds:leading-tight">Display Heading</h1>
<!-- ✅ Good - body text with normal leading (1.5) -->
<p class="sgds:text-16 sgds:leading-normal">Body text</p>
<!-- ❌ Avoid - heading without tight leading -->
<h1 class="sgds:text-48 sgds:leading-normal">Poor heading spacing</h1>
<!-- ✅ Good - clear visual hierarchy -->
<h2 class="sgds:font-bold">Bold Heading</h2>
<p class="sgds:font-regular">Regular body text</p>
<!-- ❌ Avoid - everything too bold -->
<h2 class="sgds:font-bold">Bold Heading</h2>
<p class="sgds:font-bold">Bold body text (too heavy)</p>
<!-- ✅ Good - monospace for code -->
<code class="sgds:font-mono sgds:text-14">const foo = 'bar';</code>
<!-- ❌ Avoid - sans-serif for code -->
<code class="sgds:font-sans sgds:text-14">const foo = 'bar';</code>
<!-- ✅ Good - tighter tracking for display text -->
<h1 class="sgds:text-56 sgds:font-bold sgds:tracking-tight">
Hero Heading
</h1>
<!-- ✅ Good - wider tracking for small caps -->
<span class="sgds:text-12 sgds:font-semibold sgds:uppercase sgds:tracking-wider">
Label
</span>
Problem: A font size class has no effect
Solutions:
sgds: prefix is included!important rules overriding the utilityProblem: Line height appears incorrect
Solutions:
sgds:leading-* classes if neededProblem: Font weight utilities don't change weight
Solutions:
Problem: Letter spacing looks wrong
Solutions:
sgds:tracking-tight for large headingssgds:tracking-wider for small uppercase textsgds:text-12 /* 12px */
sgds:text-14 /* 14px */
sgds:text-16 /* 16px (default) */
sgds:text-20 /* 20px */
sgds:text-24 /* 24px */
sgds:text-28 /* 28px */
sgds:text-32 /* 32px */
sgds:text-40 /* 40px */
sgds:text-48 /* 48px */
sgds:text-56 /* 56px */
sgds:font-light /* 300 */
sgds:font-regular /* 400 (default) */
sgds:font-semibold /* 600 */
sgds:font-bold /* 700 */
sgds:leading-normal /* 1.5 (default — body text) */
sgds:leading-tight /* 1.2 (display, headings, subheadings) */
sgds:tracking-tighter /* -0.05em */
sgds:tracking-tight /* -0.025em */
sgds:tracking-normal /* 0em (default) */
sgds:tracking-wide /* 0.025em */
sgds:tracking-wider /* 0.05em */
sgds:tracking-widest /* 0.1em */
sgds:font-sans /* System sans-serif */
sgds:font-mono /* Monospace */
For AI Agents: Use only the 10 base font sizes — 12, 14, 16, 20, 24, 28, 32, 40, 48, 56. Use sgds:text-16 for body, sgds:text-32 for H2, sgds:text-40–sgds:text-48 for H1, sgds:text-56 for hero display. Use sgds:leading-tight (1.2) for display text and all headings; use sgds:leading-normal (1.5) for all body text. Use semibold (600) or bold (700) for headings, regular (400) for body text. Always use monospace font for code.
tools
Complete reference for all SGDS web components including installation and framework integration. Use when users ask about any <sgds-*> component — accordion, alert, badge, breadcrumb, button, card, checkbox, close-button, combo-box, datepicker, description-list, divider, drawer, dropdown, file-upload, footer, icon, icon-button, icon-card, icon-list, image-card, input, link, mainnav, masthead, modal, overflow-menu, pagination, progress-bar, quantity-toggle, radio, select, sidebar, sidenav, skeleton, spinner, stepper, subnav, switch, system-banner, tab, table, table-of-contents, textarea, thumbnail-card, toast, or tooltip. Also covers React 19+, React ≤18, Vue, Angular, and Next.js integration.
testing
Use this skill when users ask about form validation in SGDS, hasFeedback prop, constraint validation, custom validation, noValidate, setInvalid, form submission, or reading FormData from SGDS form components.
tools
Complete catalog of page layout patterns for SGDS applications. Use this skill whenever a user asks about page layouts, content arrangement, aside panels, split views, sidebar layouts, breadcrumb layouts, or viewport-height layouts — even if they just say 'how should I lay out my page' or 'I need a two-column layout'. Covers Full Width layouts (public-facing pages with sgds-container) and With Sidebar layouts (dashboards/internal tools with sgds-container-sidebar). Trigger on: layout, aside, split view, sidebar layout, two-column, three-column, content arrangement, page structure with aside.
tools
Complete ready-to-use page templates built with SGDS components and utilities. Use this skill whenever a user asks to build a page, dashboard, login page, form page, settings page, list page, or any full-page UI — even if they don't say 'template'. Apply when starting a new app, building internal tools, dashboards, admin portals, authentication flows, or data table views.