sg-crest
A Singapore Government Agency Website

Government officials will never ask you to transfer money or disclose bank log-in details over a phone call.

Call the 24/7 ScamShield Helpline at 1799 if you are unsure if something is a scam.

Back to UI Documentation

UI Components

Reusable UI components including banners, buttons, cards, forms, modals, and navigation elements with usage examples and implementation guidelines.

Overview

HSA Self Help Tools uses a collection of reusable components to maintain consistency across all applications. These components follow government website standards and accessibility guidelines.

Reusable

Components designed for use across multiple pages

Compliant

Meets government website standards

Accessible

WCAG AA compliant with proper ARIA attributes

Banner Components

Government-compliant banner components for official websites and scam awareness.

Government Website Banner

Required

Official Singapore government website identification banner with expandable content explaining how to identify trusted government sites.

ScamShield Banner

Required

Dismissible information banner alerting users about scam awareness with ScamShield helpline information and resources.

Government Website Compliance

The GovtWebsiteBanner is required for all Singapore government websites to help users identify official government websites and protect against phishing attempts.

The ScamshieldBanner is recommended to raise awareness about scams and provide users with resources to verify suspicious communications.

GovtWebsiteBanner

Purpose

Displays the official Singapore government crest and provides information to help users verify they are on a legitimate government website. The banner is expandable to show detailed guidance on identifying trusted government sites through .gov.sg domain verification and HTTPS security.

Features

  • Official Singapore government crest (inline SVG)
  • Expandable/collapsible content with smooth transitions
  • Links to go.gov.sg verification resources
  • Content managed via JSON configuration at /constants/hsa/common/banner.json
  • Client-side component with state management
  • ARIA attributes for accessibility

File Location

/components/common/banner/GovtWebsiteBanner.tsx

Dependencies

  • react - useState hook
  • /constants/hsa/common/banner.json - Content configuration

Usage Example

import GovtWebsiteBanner from '@/components/common/banner/GovtWebsiteBanner';

export default function Layout({ children }) {
  return (
    <>
      <GovtWebsiteBanner />
      {children}
    </>
  );
}

Configuration Structure (banner.json)

{
  "govtWebsiteBanner": {
    "mainText": "A Singapore Government Agency Website",
    "toggleButtonText": "How to identify",
    "expandedContent": {
      "section1": {
        "title": "Official website links end with .gov.sg",
        "description": "Government agencies communicate via .gov.sg websites...",
        "linkText": "go.gov.sg",
        "linkUrl": "https://go.gov.sg"
      },
      "section2": {
        "title": "Secure websites use HTTPS",
        "description": "Look for a lock icon in the browser's address bar..."
      }
    }
  }
}

Visual Styling

  • Background: Light gray (#F0F0F0)
  • Text color: Gray-700 for main text, Blue (#2F60CE) for links
  • Crest: Red (#C52F19) Singapore government emblem
  • Interactive: Hover effects on toggle button with rotation animation
  • Expanded content: White background with clean typography

ScamshieldBanner

Purpose

Alerts users about scam awareness and provides quick access to the ScamShield helpline (1799). The banner is dismissible, allowing users to close it after viewing. Helps protect users from phishing and fraud attempts by directing them to official ScamShield resources.

Features

  • Dismissible notification with X button
  • ScamShield helpline information (1799)
  • Link to official ScamShield website
  • Content managed via JSON configuration at /constants/hsa/common/banner.json
  • Client-side component with visibility state management
  • TypeScript typed for type safety
  • Accessible dismiss button with aria-label

File Location

/components/common/banner/ScamshieldBanner.tsx

Dependencies

  • react - useState hook, React.FC type
  • /constants/hsa/common/banner.json - Content configuration

Usage Example

import ScamshieldBanner from '@/components/common/banner/ScamshieldBanner';

export default function Layout({ children }) {
  return (
    <>
      <ScamshieldBanner />
      {children}
    </>
  );
}

Configuration Structure (banner.json)

{
  "scamshieldBanner": {
    "title": "Beware of Scams",
    "description": {
      "text": "Visit the ScamShield website or call the Anti-Scam Helpline...",
      "linkText": "ScamShield website",
      "linkUrl": "https://www.scamshield.gov.sg",
      "helplineNumber": "1799"
    }
  }
}

Visual Styling

  • Background: Light blue (blue-50)
  • Border: Blue-200 bottom border
  • Icon: Blue-600 info circle icon
  • Text: Gray-900 for title, Gray-700 for description
  • Link: Blue (#2F60CE) with hover underline
  • Dismiss button: Gray with hover effects and focus ring

Behavior Note

Once dismissed, the banner will not reappear until the page is refreshed. Consider implementing localStorage to persist the dismissed state across sessions if needed.

Implementation in Layout

Both banners should be placed at the top of your layout, typically in app/layout.tsx:

Complete Layout Example

import GovtWebsiteBanner from '@/components/common/banner/GovtWebsiteBanner';
import ScamshieldBanner from '@/components/common/banner/ScamshieldBanner';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        {/* Government compliance banners */}
        <GovtWebsiteBanner />
        <ScamshieldBanner />
        
        {/* Navigation */}
        <Header />
        
        {/* Main content */}
        <main>{children}</main>
        
        {/* Footer */}
        <Footer />
      </body>
    </html>
  );
}

Best Practices

  • Always include GovtWebsiteBanner: Required for all government websites
  • Place at the top: Banners should be the first elements users see
  • Don't modify styling: Use components as-is to maintain compliance
  • Update content via JSON: Manage banner content in /constants/hsa/common/banner.json

More Components Coming Soon

Additional component documentation for buttons, cards, forms, modals, and navigation elements will be added in future updates.

UI Components | HSA UI Documentation