skills/sgds-pattern-block-templates/SKILL.md
Reusable UI blocks built with SGDS components and utilities that can be mixed and matched inside any page template. Use this skill whenever a user asks about app layout, application shell, page structure, sticky header, masthead placement, mainnav placement, footer placement, sgds-container, sgds-container-sidebar, simple app layout, sidebar app layout, dashboard layout, filter panel, sidebar filter, category filter, checkbox filter, or any self-contained UI section — even if they don't name it a 'block'. These are drop-in sections and shell structures, not full pages. Compose them with sgds-pattern-page-templates to build complete pages.
npx skillsauth add govtechsg/sgds-web-component sgds-pattern-block-templatesInstall 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.
Reusable UI blocks that slot into any page layout. Each block is a self-contained section — drop it into a page template from sgds-pattern-page-templates to assemble complete pages without writing layout code from scratch.
A block is a chunk of UI that:
The Application Shell is a special mandatory block — it is the page chrome (<sgds-masthead>, <sgds-mainnav>, <sgds-footer>) that every SGDS page must include. All other blocks are content blocks that slot inside the shell.
Blocks are the ingredients. Page templates are the recipes.
import "@govtechsg/sgds-web-component/themes/day.css";
import "@govtechsg/sgds-web-component/css/sgds.css";
import "@govtechsg/sgds-web-component/css/utility.css";
See sgds-components for full installation details.
| What you need | Block to use | |---|---| | Mandatory page chrome (masthead, mainnav, footer, container) for any SGDS page | Application Shell | | Page-level header with breadcrumb, icon + title, description, and primary CTA | Page Header | | Read-only entity summary card with key-value fields and an edit action | Basic Details Card | | Sidebar panel that filters content by category using checkboxes | Filter Sidebar — Checkbox | | Full detail view of a single event session: time, title, speaker, badges, description, profile | Session Detail | | Search input + filter button + results count + data table for list and admin pages | Table Filter | | Multi-field form with proper component sizing, grouping, and layout rules | Form Patterns |
Required for every page. The application shell wraps all page content with the mandatory Singapore Government chrome: <sgds-masthead>, <sgds-mainnav>, and <sgds-footer>. Provides two layout variants — Simple App (.sgds-container, public-facing) and Sidebar App (.sgds-container-sidebar, dashboards and internal tools) — with full breakpoint tables and sticky-header patterns.
Breadcrumb trail + icon-tinted container + h1 heading + description + primary CTA button. Use at the top of any content page to orient the user and surface the primary action.
Bordered card with a subtitle heading, stacked key-value field pairs, and an optional edit button. Use to display read-only entity metadata (IDs, names, descriptions, contact info) on detail or profile pages.
Vertical filter panel with grouped sgds-checkbox-group sections and a "Clear all" link. Use when content (cards, table rows, event listings) needs to be narrowed by one or more categorical dimensions.
Full session detail block for event and conference websites. Shows time slot, session title with expand/collapse, speaker attribution, outlined classification badges, description, circular speaker photo with name and role, and a divider. Repeat for each session in a programme listing.
Page header + search input + outline filter button + results count + data table. Use on list and admin pages where users search or filter tabular records. Table cells support sgds-link, sgds-badge, and sgds-button for rich row content.
Form layout rules: grid math, component pairing, validation feedback, and canonical patterns. All forms use .sgds-grid with 12 columns. Form containers are 8 columns wide (left/center-aligned). Paired fields take 6 columns each (max 2 per row). Full-width fields (textarea, checkbox-group, radio-group, file-upload) always span 12 columns. Includes 5 reusable patterns: full-width only, paired fields, mixed layout, multiple sections, and sidebar navigation.
Blocks live inside the content area of a page template. The typical pattern:
<!-- Page template provides the chrome -->
<sgds-masthead></sgds-masthead>
<sgds-mainnav>...</sgds-mainnav>
<div class="sgds:bg-surface-default sgds:min-h-screen">
<div class="sgds:w-container sgds:mx-auto sgds:py-layout-md">
<!-- Two-column layout: block on the left, content on the right -->
<div class="sgds:flex sgds:gap-layout-md sgds:items-start">
<!-- Drop the block here -->
<aside class="sgds:shrink-0 sgds:w-64">
<!-- Filter Sidebar block -->
</aside>
<!-- Content area -->
<div class="sgds:flex-1">
<!-- Cards, table, results, etc. -->
</div>
</div>
</div>
</div>
<sgds-footer></sgds-footer>
Forms are complex because SGDS components have specific constraints. Read reference/form-patterns.md FIRST — it contains all grid math, component pairing rules, 5 canonical patterns, and positioning variants.
Read the component reference for every <sgds-*> element you use:
<sgds-select> uses <sgds-select-option> (not <sgds-option>). <sgds-combo-box> uses <sgds-combobox-option>. Always verify in the sgds-components skill reference.<sgds-file-upload> slots require text labels (not just icons). Check if the component expects child elements, slot content, or JS properties.<sgds-stepper> uses a JS property (steps array), not HTML child elements like <sgds-stepper-item>. Verify which components accept attributes vs. JS properties.From reference/form-patterns.md:
.sgds-containersidebar_cols + form_cols + toc_cols ≤ 12Always cross-check against reference/form-patterns.md before coding.
Users are free to design their own blocks with full creative latitude — layout, composition, and visual hierarchy are all open. The only constraint is that every block must stay within the SGDS system rails:
| Requirement | How |
|---|---|
| UI components | Use <sgds-*> web components. Do not reach for plain HTML equivalents when an SGDS component exists (e.g. use <sgds-badge>, not a hand-rolled <span> chip). |
| Styling | Use sgds: Tailwind utilities exclusively for colours, spacing, typography, and layout. Do not write arbitrary CSS values that duplicate what the design token system already expresses. |
| Typography | Use semantic role tokens (sgds:text-heading-md, sgds:text-body-md, sgds:text-overline-md, etc.) paired with matching weight, line-height, and tracking tokens. Do not use raw scale tokens (sgds:text-base, sgds:text-sm) which are not part of the public API. |
| Icons | Use <sgds-icon name="..."> exclusively. Do not embed raw SVG or third-party icon libraries. |
| External inspiration | Fine to reference sites like shadcnblocks.com, Tailwind UI, or any other design gallery for layout ideas — but always re-implement using SGDS components and tokens, not the source site's CSS or component library. |
→ Read reference/custom-block-rules.md for the full token reference, anti-patterns, and annotated examples.
Before you write ANY block code:
sgds-utilities skill — You need the complete utility class referencesgds-components skill — You need component APIs and child element namesreference/custom-block-rules.md in this skillSTYLING RULE (applies to ALL blocks):
sgds: Tailwind utilities EXCLUSIVELY for spacing, colors, typography, layout<sgds-*> components EXCLUSIVELY for UI elements<style> blocks to replicate design tokens (e.g., margin: 24px, var(--sgds-*))If you skip loading utilities/components first, you will default to inline styles and break the design system. This is the #1 mistake agents make with blocks.
sgds-utilities skillsgds-components skillreference/custom-block-rules.md<sgds-masthead>, <sgds-mainnav>, and <sgds-footer> are mandatory on every SGDS page. Read reference/application-shell.md for layout patterns and container classes.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.