Browse Get started

Get started

About us Design Develop Content

Develop

Install SGDS, use the component library, and build interfaces with shared foundations.

Install SGDS

Add the SGDS web component package to your project.

npmpnpmyarnbun
Bash Copy
npm install @govtechsg/sgds-web-component
Bash Copy
pnpm add @govtechsg/sgds-web-component
Bash Copy
yarn add @govtechsg/sgds-web-component
Bash Copy
bun add @govtechsg/sgds-web-component

Set up Tailwind CSS

SGDS utility classes require Tailwind CSS v4. Follow the official Tailwind installation guide for your framework.

Import styles

Import the theme tokens, foundation styles, and utility classes in your main CSS file. The order matters — theme tokens must come first.

globals.css Copy
@import "@govtechsg/sgds-web-component/themes/day.css";
@import "@govtechsg/sgds-web-component/themes/night.css";
@import "@govtechsg/sgds-web-component/css/sgds.css";
@import "@govtechsg/sgds-web-component/css/utility.css"; /* SGDS Tailwind v4 config file */

Set up font

SGDS foundation styles use Inter by default. Add the Google Fonts link in your HTML head before any SGDS CSS. This loads only the four weights defined by the SGDS design tokens (300, 400, 600, 700) in both normal and italic styles.

index.html Copy
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,600;0,14..32,700;1,14..32,300;1,14..32,400;1,14..32,600;1,14..32,700&display=swap"
rel="stylesheet"
/>
</head>

Import the component library

Import the library once at your app entry point. This registers all <sgds-*> custom elements globally.

ReactVueAngularNext.jsOthers

React 19 and above

Step 1: Import the library once at your app entry point.

src/main.tsx Copy
import "@govtechsg/sgds-web-component";

Step 2: Use web component tags directly in any component.

src/App.tsx Copy
const App = () => {
return (
<form>
<sgds-input label="Full name" name="fullName"></sgds-input>
<sgds-button type="submit" ariaLabel="Submit">Submit</sgds-button>
</form>
);
};
export default App;

React 18 and below

Step 1: Use the React wrapper components for proper event handling.

src/App.tsx Copy
import { SgdsButton, SgdsInput } from "@govtechsg/sgds-web-component/react";

Step 2: Use the wrapper components in JSX.

src/App.tsx Copy
import { SgdsButton, SgdsInput } from "@govtechsg/sgds-web-component/react";
const App = () => {
return (
<form>
<SgdsInput label="Full name" name="fullName" />
<SgdsButton type="submit">Submit</SgdsButton>
</form>
);
};
export default App;

TypeScript support

Step 1: Add a type declaration file at your project root to enable IntelliSense for all component props and typed event handlers.

types.d.ts Copy
import "@govtechsg/sgds-web-component/types/react";

Step 2: Ensure the file is included by your tsconfig.json.

tsconfig.json Copy
{
"include": ["types.d.ts", "**/*.ts", "**/*.tsx"]
}

Step 1: Tell Vue to treat sgds-* tags as custom elements.

vite.config.ts Copy
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith("sgds-"),
},
},
}),
],
});

Step 2: Import the library in your app entry.

src/main.ts Copy
import "@govtechsg/sgds-web-component";

Step 1: Add CUSTOM_ELEMENTS_SCHEMA to your standalone component.

app.component.ts Copy
import { Component, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
schemas: [CUSTOM_ELEMENTS_SCHEMA] // Step 1
})
export class AppComponent {}

Step 2: Import the library in your root component to register all custom elements globally.

app.component.ts Copy
import { Component, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import "@govtechsg/sgds-web-component"; // Step 2
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppComponent {}

Setup

Step 1: Create a client-side library loader.

src/app/sgds.tsx Copy
"use client";
import { useEffect } from "react";
export default function SgdsLoader() {
useEffect(() => {
import("@govtechsg/sgds-web-component");
}, []);
return null;
}

Step 2: Import the loader in your root layout.

src/app/layout.tsx Copy
import SgdsLoader from "./sgds";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<SgdsLoader />
</head>
<body>{children}</body>
</html>
);
}

TypeScript support

Step 1: Add a type declaration file at your project root to enable IntelliSense for all component props and typed event handlers.

types.d.ts Copy
import "@govtechsg/sgds-web-component/types/react";

Step 2: Ensure the file is included by your tsconfig.json.

tsconfig.json Copy
{
"include": ["types.d.ts", "**/*.ts", "**/*.tsx"]
}

Cannot find your frontend framework integration?

Raise an issue to propose for more integration guides

Start from shared building blocks

Use templates, blocks, and components when you need to move from product intent to working UI quickly.

Templates

Use full-page layouts for common service journeys and admin workflows.

Explore templates

Blocks

Compose reusable sections such as headers, forms, filters, and stats.

Browse blocks

Components

Use SGDS components for interaction patterns such as buttons, tabs, forms, cards, and tables.

View components

Use SGDS utilities

Apply SGDS utility classes for spacing, layout, typography, colour, and responsive behaviour instead of custom CSS.

Use SGDS AI

Accelerate development with AI-assisted workflows and agent skills that understand SGDS components, utilities, and patterns.

Singapore Government Design System

The Singapore Government Design System was developed to empower teams in creating fast, accessible and mobile-friendly digital services.

Past VersionsSGDS v1SGDS v2