# Quick Start Guide Step-by-step quick start guide for consuming UX4G in HTML via CDN, React via npm, and Angular via angular.json configuration. Includes code snippets for each framework and copy-ready installation commands. **Category:** Getting Started **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/getting-started-quick-start-guide--quick-start-guide ## Variants documented in Storybook - Quick Start Guide: https://doc.ux4g.gov.in/web/?path=/story/getting-started-quick-start-guide--quick-start-guide ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Quick Start Guide. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Quick Start — Quick Start HTML: ```html
Developer quick start UX4G 3.0.18

Start building with UX4G Design System

Add production-ready components using familiar HTML classes. Select your environment and follow a focused setup path.

Class-based markup Auto-bootstrap runtime Accessible defaults

Add UX4G directly to a page with no build tools or package manager. Place the stylesheet in the document head and the scripts before the closing body tag.

1

Add the CDN files

index.html
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>My UX4G Page</title>

  <!-- UX4G CSS -->
  <link rel="stylesheet" href="https://cdn.ux4g.gov.in/UX4G@3.0.18/index.css" />
</head>
<body>
  <!-- UX4G JS (theme toggle, accessibility bar, etc.) -->
  <script src="https://cdn.ux4g.gov.in/UX4G@3.0.18/ux4g.js"></script>
  <script src="https://cdn.ux4g.gov.in/UX4G@3.0.18/ux4g-custom.js"></script>

  <button class="ux4g-btn-primary ux4g-btn-md" type="button">
    Get Started
  </button>
</body>
</html>

Use the core web package in React and apply UX4G classes directly to JSX elements.

1

Install the package

Terminal
npm install ux4g-web-components
2

Load styles and runtime

src/main.jsx or src/index.jsx
TypeScript
import 'ux4g-web-components/styles.css';
import 'ux4g-web-components/design-system';
3

Use UX4G classes

src/App.jsx
TSX
function App() {
  return (
    <button
      className="ux4g-btn ux4g-btn-primary ux4g-btn-md"
      type="button"
      onClick={() => console.log('Saved!')}
    >
      Save
    </button>
  );
}

Install the core web package, then choose either Angular configuration or direct imports to load UX4G.

1

Install the package

Terminal
npm install ux4g-web-components
2

Method A: Configure angular.json

Recommended. Add the stylesheet and auto-bootstrap runtime to the project options. No TypeScript runtime import is needed.

angular.json
{
  "styles": [
    "node_modules/ux4g-web-components/styles/ux4g.css",
    "src/styles.css"
  ],
  "scripts": [
    "node_modules/ux4g-web-components/dist/runtime/design-system.js"
  ]
}
3

Method B: Import styles and runtime

src/styles.css
CSS
@import 'ux4g-web-components/styles.css';
src/main.ts
TypeScript
import 'ux4g-web-components/design-system';
4

Increase the bundle budget

The stylesheet includes design tokens, components, fonts, and assets. Increase the production initial bundle budget to prevent warnings or build blocks.

angular.json
{
  "type": "initial",
  "maximumWarning": "10MB",
  "maximumError": "12MB"
}
``` React: ```jsx import React from 'react'; const QuickStartGuideExample1Demo = () => ( <> '; position: absolute; right: 44px; bottom: -26px; color: rgba(91, 67, 214, .08); font: 800 132px/1 Consolas, monospace; } .qs-header-content { position: relative; z-index: 1; max-width: 760px; } .qs-header-topline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .qs-eyebrow { color: var(--qs-accent); font-size: 13px; font-weight: 800; text-transform: uppercase; } .qs-version { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #d4cef8; border-radius: 999px; background: #fff; color: #4634a8; font-size: 12px; font-weight: 700; } .qs-version::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #16845b; } .qs-header h1, .qs-header h2 { margin: 14px 0 14px; max-width: 690px; color: #1b1b20; font-size: 44px; line-height: 1.12; letter-spacing: 0; } .qs-header p, .qs-intro, .qs-step > p, .qs-note { color: var(--ux4g-text-neutral-secondary, #5f6368); line-height: 1.65; } .qs-header p { max-width: 660px; margin: 0; font-size: 17px; } .qs-hero-metrics { position: relative; z-index: 1; display: flex; gap: 28px; flex-wrap: wrap; margin-top: 28px; padding-top: 22px; border-top: 1px solid rgba(91, 67, 214, .15); } .qs-metric { display: flex; align-items: center; gap: 9px; color: #34343a; font-size: 13px; font-weight: 650; } .qs-metric i { color: var(--qs-accent); font-size: 19px; } .qs-tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px; border: 1px solid var(--qs-line); border-radius: 8px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 24px rgba(29, 28, 36, .07); backdrop-filter: blur(10px); } .qs-tab { min-height: 74px; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ux4g-text-neutral-secondary, #5f6368); cursor: pointer; text-align: left; font: inherit; transition: background .18s, border-color .18s, box-shadow .18s, transform .18s; } .qs-tab:hover { background: #f7f7f9; color: var(--ux4g-text-neutral-primary, #171717); transform: translateY(-1px); } .qs-tab:focus-visible, .qs-copy-button:focus-visible { outline: 3px solid var(--ux4g-border-color-primary, #765de8); outline-offset: 2px; } .qs-tab[aria-defaultSelected] { border-color: #d5cff8; background: #f3f0ff; color: var(--qs-accent); box-shadow: 0 2px 8px rgba(91, 67, 214, .10); } .qs-tab-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 6px; background: #efedf5; } .qs-tab-icon img { width: 24px; height: 24px; object-fit: contain; } .qs-tab[aria-defaultSelected] .qs-tab-icon { background: #fff; box-shadow: 0 1px 5px rgba(54, 44, 105, .12); } .qs-tab-copy { min-width: 0; display: grid; gap: 3px; } .qs-tab-title { color: inherit; font-size: 15px; font-weight: 800; } .qs-tab-description { overflow: hidden; color: var(--ux4g-text-neutral-secondary, #6a6a72); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; } .qs-panel { display: none; padding-top: 40px; animation: qs-panel-in .24s ease-out; } .qs-panel[data-active="true"] { display: block; } .qs-panel-layout { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 52px; align-items: start; } .qs-panel-content { min-width: 0; max-width: 820px; } .qs-intro { max-width: 760px; margin: 0 0 30px; font-size: 16px; } .qs-step-nav { order: 2; position: sticky; top: 112px; display: grid; gap: 5px; padding-left: 16px; border-left: 2px solid #e5e3ed; } .qs-step-nav-label { margin-bottom: 8px; color: #77747f; font-size: 11px; font-weight: 800; text-transform: uppercase; } .qs-step-nav a { display: flex; align-items: center; gap: 9px; min-height: 34px; color: #55515d; font-size: 13px; font-weight: 650; text-decoration: none; } .qs-step-nav a:hover { color: var(--qs-accent); } .qs-step-nav a span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #f0eef4; color: #615d68; font-size: 11px; } .qs-step { scroll-margin-top: 120px; padding: 30px 0; border-top: 1px solid var(--qs-line); } .qs-step:first-of-type { border-top: 0; padding-top: 0; } .qs-step-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; } .qs-step-heading h3 { margin: 0; font-size: 21px; } .qs-step-number { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #d7d1fb; border-radius: 50%; background: #f3f0ff; color: var(--qs-accent); font-weight: 800; flex: 0 0 auto; } .qs-code-shell { margin-top: 14px; overflow: hidden; border: 1px solid #2c2f37; border-radius: 8px; background: #15171c; box-shadow: 0 12px 28px rgba(18, 20, 25, .12); } .qs-code-header { min-height: 48px; padding: 0 10px 0 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #343740; background: #1d2026; color: #bfc4ce; font: 12px Consolas, monospace; } .qs-code-block { margin: 0; padding: 24px; overflow-x: auto; color: #f3f5f8; font: 13px/1.68 Consolas, 'Liberation Mono', monospace; white-space: pre; } .qs-copy-button { min-width: 76px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid currentColor; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; font: 600 13px/1 sans-serif; } .qs-copy-button:hover { background: rgba(127, 127, 127, .14); } .qs-code-header .qs-copy-button { color: #f4f6fa; background: #252830; border-color: #8e95a3; } .qs-code-header .qs-copy-button:hover { background: #30343d; } .qs-copy-icon { position: relative; display: inline-block; width: 15px; height: 15px; color: currentColor; } .qs-copy-icon::before, .qs-copy-icon::after { content: ''; position: absolute; width: 9px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; background: inherit; } .qs-copy-icon::before { left: 1px; top: 1px; } .qs-copy-icon::after { right: 1px; bottom: 1px; background: #252830; } .qs-link-row .qs-copy-icon::after { background: #fff; } .qs-links { margin-top: 18px; border: 1px solid var(--qs-line); border-radius: 8px; overflow: hidden; } .qs-link-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--qs-line); background: #fff; } .qs-link-row:last-child { border-bottom: 0; } .qs-link-row > div { min-width: 0; display: grid; gap: 4px; } .qs-link-row a { color: var(--ux4g-text-primary, #5b43d6); overflow-wrap: anywhere; } .qs-link-row .qs-copy-button { color: var(--ux4g-text-primary, #5b43d6); flex: 0 0 auto; } .qs-link-label, .qs-file { font-size: 12px; font-weight: 700; color: var(--ux4g-text-neutral-secondary, #5f6368); } .qs-file { display: inline-block; margin-top: 8px; font-family: Consolas, monospace; } .qs-note { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 12px; padding: 15px 17px; border: 1px solid #d8d1fb; border-radius: 6px; background: #f8f6ff; } .qs-note-icon { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; background: var(--qs-accent); color: #fff; font: 800 13px/1 Georgia, serif; } .qs-status { position: fixed; right: 24px; bottom: 24px; z-index: 10; padding: 10px 14px; border-radius: 6px; background: #171717; color: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.24); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s, transform .15s; } .qs-status[data-visible="true"] { opacity: 1; transform: translateY(0); } [data-theme="dark"] .qs-page { --qs-accent: #a99cff; --qs-line: #3b3e49; color: #f3f4f7; } [data-theme="dark"] .qs-header { border-color: #44405e; background: linear-gradient(120deg, #211f2d 0%, #202532 58%, #1d2928 100%); } [data-theme="dark"] .qs-header h1, [data-theme="dark"] .qs-header h2 { color: #ffffff; } [data-theme="dark"] .qs-header p, [data-theme="dark"] .qs-intro, [data-theme="dark"] .qs-step > p { color: #c7cad3; } [data-theme="dark"] .qs-header::after { color: rgba(169, 156, 255, .09); } [data-theme="dark"] .qs-version { border-color: #595273; background: #2b2838; color: #d9d3ff; } [data-theme="dark"] .qs-hero-metrics { border-top-color: #454258; } [data-theme="dark"] .qs-metric { color: #e5e6eb; } [data-theme="dark"] .qs-tabs { border-color: #3d404a; background: rgba(24, 26, 32, .96); box-shadow: 0 8px 26px rgba(0, 0, 0, .3); } [data-theme="dark"] .qs-tab { color: #d1d3db; } [data-theme="dark"] .qs-tab:hover { background: #272a32; color: #ffffff; } [data-theme="dark"] .qs-tab[aria-defaultSelected] { border-color: #625a8f; background: #302b4a; color: #c7beff; box-shadow: none; } [data-theme="dark"] .qs-tab-title { color: inherit; } [data-theme="dark"] .qs-tab-description { color: #aeb1bc; } [data-theme="dark"] .qs-tab-icon { background: #30333d; } [data-theme="dark"] .qs-tab[aria-defaultSelected] .qs-tab-icon { background: #f5f3ff; } [data-theme="dark"] .qs-step-heading h3 { color: #f5f6f8; } [data-theme="dark"] .qs-step-nav { border-left-color: #454852; } [data-theme="dark"] .qs-step-nav-label, [data-theme="dark"] .qs-step-nav a { color: #b9bbc4; } [data-theme="dark"] .qs-step-nav a:hover { color: #c7beff; } [data-theme="dark"] .qs-step-nav a span { background: #30333d; color: #d7d9df; } [data-theme="dark"] .qs-step-number { border-color: #625a8f; background: #302b4a; color: #c7beff; } [data-theme="dark"] .qs-link-row { background: #1d2026; } [data-theme="dark"] .qs-link-row .qs-copy-icon::after { background: #1d2026; } [data-theme="dark"] .qs-link-label, [data-theme="dark"] .qs-file { color: #b8bbc5; } [data-theme="dark"] .qs-link-row a, [data-theme="dark"] .qs-link-row .qs-copy-button { color: #b8adff; } [data-theme="dark"] .qs-note { border-color: #514b70; background: #28243a; color: #d9dbe2; } @keyframes qs-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } } @media (max-width: 820px) { .qs-panel-layout { grid-template-columns: 1fr; gap: 28px; } .qs-step-nav { order: -1; position: static; display: flex; gap: 12px; overflow-x: auto; padding: 0 0 14px; border-left: 0; border-bottom: 1px solid var(--qs-line); } .qs-step-nav-label { display: none; } .qs-step-nav a { flex: 0 0 auto; } } @media (max-width: 640px) { .qs-page { padding: 22px 16px 60px; } .qs-header { padding: 32px 24px; } .qs-header::after { display: none; } .qs-header h1, .qs-header h2 { font-size: 34px; } .qs-hero-metrics { gap: 14px 22px; } .qs-tabs { grid-template-columns: repeat(3, minmax(92px, 1fr)); overflow-x: auto; } .qs-tab { min-width: 112px; grid-template-columns: 32px 1fr; padding: 10px; } .qs-tab-icon { width: 32px; height: 32px; } .qs-tab-description { display: none; } .qs-link-row { align-items: flex-start; } } @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .qs-panel { animation: none; } .qs-tab, .qs-status { transition: none; } }
Developer quick start UX4G 3.0.18

Start building with UX4G Design System

Add production-ready components using familiar HTML classes. Select your environment and follow a focused setup path.

code Class-based markup bolt Auto-bootstrap runtime verified_user Accessible defaults

Add UX4G directly to a page with no build tools or package manager. Place the stylesheet in the document head and the scripts before the closing body tag.

1

Add the CDN files

index.html
                  <!DOCTYPE html> <html lang="en" data-theme="light"> <head> <meta charSet="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>My UX4G Page</title> <!-- UX4G CSS --> <link rel="stylesheet" href="https://cdn.ux4g.gov.in/UX4G@3.0.18/index.css" /> </head> <body> <!-- UX4G JS (theme toggle, accessibility bar, etc.) --> <script src="https://cdn.ux4g.gov.in/UX4G@3.0.18/ux4g.js"></script> <script src="https://cdn.ux4g.gov.in/UX4G@3.0.18/ux4g-custom.js"></script> <button className="ux4g-btn-primary ux4g-btn-md" type="button"> Get Started </button> </body> </html>
                

Use the core web package in React and apply UX4G classes directly to JSX elements.

1

Install the package

Terminal
                  npm install ux4g-web-components
                
2

Load styles and runtime

src/main.jsx or src/index.jsx
TypeScript
                  import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system';
                
3

Use UX4G classes

src/App.jsx
TSX
                  function App() { return ( <button className="ux4g-btn ux4g-btn-primary ux4g-btn-md" type="button" onClick={() => console.log('Saved!')} > Save </button> ); }
                

Install the core web package, then choose either Angular configuration or direct imports to load UX4G.

1

Install the package

Terminal
                  npm install ux4g-web-components
                
2

Method A: Configure angular.json

i Recommended. Add the stylesheet and auto-bootstrap runtime to the project options. No TypeScript runtime import is needed.

angular.json
                  { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] }
                
3

Method B: Import styles and runtime

src/styles.css
CSS
                  @import 'ux4g-web-components/styles.css';
                
src/main.ts
TypeScript
                  import 'ux4g-web-components/design-system';
                
4

Increase the bundle budget

i The stylesheet includes design tokens, components, fonts, and assets. Increase the production initial bundle budget to prevent warnings or build blocks.

angular.json
                  { "type": "initial", "maximumWarning": "10MB", "maximumError": "12MB" }
                
); export default QuickStartGuideExample1Demo; ``` Angular: ```html
Developer quick start UX4G 3.0.18

Start building with UX4G Design System

Add production-ready components using familiar HTML classes. Select your environment and follow a focused setup path.

Class-based markup Auto-bootstrap runtime Accessible defaults

Add UX4G directly to a page with no build tools or package manager. Place the stylesheet in the document head and the scripts before the closing body tag.

1

Add the CDN files

index.html
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>My UX4G Page</title>

  <!-- UX4G CSS -->
  <link rel="stylesheet" href="https://cdn.ux4g.gov.in/UX4G@3.0.18/index.css" />
</head>
<body>
  <!-- UX4G JS (theme toggle, accessibility bar, etc.) -->
  <script src="https://cdn.ux4g.gov.in/UX4G@3.0.18/ux4g.js"></script>
  <script src="https://cdn.ux4g.gov.in/UX4G@3.0.18/ux4g-custom.js"></script>

  <button class="ux4g-btn-primary ux4g-btn-md" type="button">
    Get Started
  </button>
</body>
</html>

Use the core web package in React and apply UX4G classes directly to JSX elements.

1

Install the package

Terminal
npm install ux4g-web-components
2

Load styles and runtime

src/main.jsx or src/index.jsx
TypeScript
import 'ux4g-web-components/styles.css';
import 'ux4g-web-components/design-system';
3

Use UX4G classes

src/App.jsx
TSX
function App() {
  return (
    <button
      className="ux4g-btn ux4g-btn-primary ux4g-btn-md"
      type="button"
      onClick={() => console.log('Saved!')}
    >
      Save
    </button>
  );
}

Install the core web package, then choose either Angular configuration or direct imports to load UX4G.

1

Install the package

Terminal
npm install ux4g-web-components
2

Method A: Configure angular.json

Recommended. Add the stylesheet and auto-bootstrap runtime to the project options. No TypeScript runtime import is needed.

angular.json
{
  "styles": [
    "node_modules/ux4g-web-components/styles/ux4g.css",
    "src/styles.css"
  ],
  "scripts": [
    "node_modules/ux4g-web-components/dist/runtime/design-system.js"
  ]
}
3

Method B: Import styles and runtime

src/styles.css
CSS
@import 'ux4g-web-components/styles.css';
src/main.ts
TypeScript
import 'ux4g-web-components/design-system';
4

Increase the bundle budget

The stylesheet includes design tokens, components, fonts, and assets. Increase the production initial bundle budget to prevent warnings or build blocks.

angular.json
{
  "type": "initial",
  "maximumWarning": "10MB",
  "maximumError": "12MB"
}
``` ## Accessibility notes - Use the classes/tokens exactly as documented. Changing token values without a design review can break accessibility. - Ensure color contrast meets WCAG 2.1 AA. - Test responsive and RTL behavior where utility classes rely on logical properties.