skills/sgds-data-visualisation/SKILL.md
Use this skill when users ask about data visualisation, charts, graphs, or dashboards in an SGDS application. Covers ECharts setup and applying the SGDS colour palette to charts.
npx skillsauth add govtechsg/sgds-web-component sgds-data-visualisationInstall 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.
SGDS does not bundle a charting library. For data visualisation, use Apache ECharts and apply the SGDS colour palette so charts remain visually consistent with your design system.
ECharts is not included in @govtechsg/sgds-web-component. Install it separately:
npm install echarts
Then import and initialise per the ECharts getting started guide:
import * as echarts from "echarts";
const chart = echarts.init(document.getElementById("chart"));
chart.setOption(option);
Apply the SGDS palette by setting the color array in your chart option. The values below are the raw hex values of the SGDS data-visualisation primitive tokens:
| Token | Hex |
|-------|-----|
| --sgds-purple-600 | #ac1cdb |
| --sgds-cyan-600 | #00758d |
| --sgds-green-600 | #0e7c3d |
| --sgds-blue-600 | #0269d0 |
| --sgds-yellow-600 | #7e6917 |
Set color directly in the chart option. ECharts cycles through the colours sequentially across series:
const option = {
color: ["#ac1cdb", "#00758d", "#0e7c3d", "#0269d0", "#7e6917"],
// ... rest of chart option
};
Register a named theme once at app startup, then pass the theme name when initialising each chart:
import * as echarts from "echarts";
echarts.registerTheme("sgds", {
color: ["#ac1cdb", "#00758d", "#0e7c3d", "#0269d0", "#7e6917"],
});
const chart = echarts.init(document.getElementById("chart"), "sgds");
color array — ECharts does not resolve CSS custom properties.color in the option object. For multiple charts sharing the same palette, use echarts.registerTheme() once at app startup.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.