UX4G UI Snippets & IntelliSense
Note: This is not an official UX4G extension. I built it for my own use, to make working with UX4G easier.
Editor support for the UX4G Design System in VS Code, Cursor, Antigravity, and other VS Code-based editors.
🌟 Highlights
- Hover a design token to see its final value, without opening the stylesheet.
- Ctrl+Click (or F12) a token or class to jump directly to where it is defined.
- Your overrides win. If your project redefines a token, hover and Ctrl+Click show your value, not the package default.
- Dynamic Package Sync: It reads the
ux4g-web-components package installed in your project, so it always matches the version you use.
- 29+ Accessible Component Snippets: Scaffolds Government of India / GIGW & WCAG 2.1 AA compliant UI patterns instantly.
✨ Features
1. Token Values on Hover
Semantic tokens point to other tokens. The hover follows the references to the end and shows every step:
--ux4g-bg-neutral ➔ var(--ux4g-color-neutral-50) ➔ #fafafa
- Layer Context:
ux4g-web-components :root @layer ux4g-semantics
- Dark Mode Context:
ux4g-web-components .dark, :root[data-mode=dark] @layer ux4g-semantics: #171717
- Color Swatches: Hex and RGB colors display a visual color preview swatch.
- Composite Values:
calc() and other composite values have every var() evaluated and replaced.
2. Go to Definition (Ctrl+Click / F12)
| You Ctrl+Click |
You land on |
A class, ux4g-btn |
Its rule in the package/source stylesheet |
A token, --ux4g-btn-radius |
Your override if there is one, otherwise the package definition |
| Your own override |
The package definition it replaces |
The package ships one minified stylesheet, so the extension opens a formatted, read-only copy of it (ux4g-web-components@<version>/ux4g.css).
3. Accessible Government Snippets (Type prefix & hit Tab)
| Prefix |
Component / Description |
ux4g-starter-html |
Full HTML5 boilerplate with CDN, a11y bar, and national header |
ux4g-accessibility-bar |
Compliant toolbar (Skip link, text resize A-/A/A+, contrast) |
ux4g-header |
National header with State Emblem of India and ministry title |
ux4g-navbar |
Responsive top navigation bar with mobile toggle |
ux4g-card |
Contained card with header, body, title, and actions |
ux4g-alert |
Semantic alert banner (info, success, warning, danger) |
ux4g-modal |
Accessible modal dialog with backdrop and header/body/footer |
ux4g-table |
Responsive striped data table with accessible header scopes |
ux4g-tabs |
Accessible tab list and tabbed panels |
ux4g-row |
Responsive grid row with mobile-first columns (col-12, md-col-6) |
ux4g-input |
Text/email/password input with label and helper text |
ux4g-footer |
National portal footer with legal links, sitemap, and copyright |
🛠️ Works Where You Write UX4G
- HTML (
.html)
- CSS / SCSS / LESS (
.css, .scss, .less)
- React (
.jsx, .tsx)
- Vue (
.vue)
- Svelte (
.svelte)
- Astro (
.astro)
- PHP & Blade (
.php, .blade.php)
📋 Requirements
ux4g-web-components installed from npm in your project:
npm install ux4g-web-components
Note: Projects that load UX4G only from the CDN get hover and Ctrl+Click for their own overrides and bundled design system definitions.
📦 Install
In VS Code
- Open the Extensions view (Ctrl + Shift + X).
- Search for
UX4G Design System Extension.
- Click Install.
In Cursor, Antigravity, Windsurf, VSCodium
These editors use the Open VSX registry. Search for UX4G Design System Extension in their Extensions view.
From a File (.vsix)
- Download the
.vsix from the latest release.
- Open the Extensions view, click
... at the top, choose Install from VSIX... and pick the file.
- Or from a terminal:
code --install-extension ux4g-quick-snippets-3.4.0.vsix
🎯 How a Target is Chosen
Tokens
- Overrides are
--ux4g-* declarations in your .css, .scss, and .less files, and in <style> blocks of .html, .vue, .svelte, and .astro files. Unsaved edits count.
- If there are overrides, only they are offered: same file first, then the nearest folder. Several overrides open the peek list.
- With no override, the package definitions are offered, the plain
:root one first.
Classes
- Rules that style exactly that class are offered. If there are none, rules whose subject carries the class; failing that, every rule that mentions it.
Package
- The nearest
node_modules/ux4g-web-components above the file you are editing, the way Node resolves it. Monorepos with several versions get the right one per file.
⚠️ Limits
- Override order is by file distance, not the real CSS cascade, which depends on the page's DOM.
- Overrides set from JavaScript (
style.setProperty) or inline style attributes are not indexed.
node_modules, dist, build, out, coverage, .git, .next, .nuxt, and .svelte-kit are not searched for user overrides.
🔄 New Versions of ux4g-web-components
Nothing to do in the extension. Update the package in your project and the next hover or Ctrl+Click reads the new stylesheet automatically.
🧑💻 Author
Developed by Nitesh
Found a bug or a token that resolves wrongly? Open an issue!
📄 License
MIT © Nitesh
| |