You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

rad-gui

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rad-gui

A simple, feature-rich, and easy-to-use GUI library for better visibility into data intensive applications.

0.11.1
latest
Source
npmnpm
Version published
Weekly downloads
15
-93.24%
Maintainers
0
Weekly downloads
 
Created
Source

RAD-GUI 🎮

TypeScript Ready License Version Build Status Test Coverage

Lightweight, flexible GUI controls for your JavaScript applications
Create beautiful control panels with minimal code

✨ Features

  • Lightweight & Fast: Designed for performance with minimal dependencies
  • Modern API: Clean, chainable interface for building controls
  • Responsive: Works across desktop and mobile devices
  • Highly Customizable: Easily themed with CSS variables
  • Compatible: Inspired by and compatible with lil-gui and dat-gui as a drop-in replacement
  • Fully Typed: Written in TypeScript with complete type definitions
  • AI-Ready: Includes LLM-optimized codebase reference for AI assistants and agents

📦 Installation

# Using npm
npm install rad-gui

# Using yarn
yarn add rad-gui

🚀 Quick Start

JavaScript

import { GUI } from 'rad-gui';
import 'rad-gui/lib/rad-gui.css';

// Create a GUI instance
const gui = new GUI();
const params = { x: 0, y: 0, color: '#ff0000' };

gui.add(params, 'x', 0, 100);
gui.addColor(params, 'color');

TypeScript

import { GUI, ControlEventData } from 'rad-gui';
import 'rad-gui/lib/rad-gui.css';

interface DemoParams {
  x: number;
  y: number;
  color: string;
  enabled: boolean;
}

const gui = new GUI({ title: 'Controls', width: 300 });
const params: DemoParams = { x: 0, y: 0, color: '#ff0000', enabled: true };

// Full type safety and IntelliSense support
gui.add(params, 'x', 0, 100)
  .onChange((data: ControlEventData<number>) => {
    console.log(`X changed to ${data.value}`);
  });

gui.addColor(params, 'color');
gui.add(params, 'enabled');

For a complete example, see our TypeScript Example which demonstrates all features with proper typing.

📚 Documentation

RAD-GUI provides comprehensive type definitions and IntelliSense support for TypeScript projects. The library includes:

  • Complete type definitions for all controls and options
  • Proper event callback typing with structured data
  • Generic overloads for type-safe parameter handling
  • Interface definitions for configuration objects

📋 API Reference

Creating a GUI

// Basic GUI creation
const gui = new GUI();

// With options
const gui = new GUI({
  title: 'My Controls',
  width: 300,
  autoPlace: false,
  closeFolders: true
});

Adding Controls

// Auto-detected control types
gui.add(object, 'numberProperty');     // → NumberControl
gui.add(object, 'booleanProperty');    // → ToggleControl  
gui.add(object, 'stringProperty');     // → TextControl
gui.add(object, 'functionProperty');   // → FunctionControl

// Explicit control types
gui.add(object, 'number', 0, 100, 1);           // NumberControl with range
gui.add(object, 'option', ['A', 'B', 'C']);     // OptionControl
gui.addColor(object, 'color');                  // ColorControl

Event Handling

// Individual control events
gui.add(params, 'value')
  .onChange((data: ControlEventData) => {
    console.log(`${data.property} changed to ${data.value}`);
  })
  .onFinishChange((data: ControlEventData) => {
    console.log('Finished changing:', data);
  });

// Global GUI events  
gui.onChange((data: ControlEventData) => {
  // Called for any control change
});

gui.onOpenClose((gui: GUI) => {
  // Called when folders open/close
});
  doSomething() { 
    console.log('Button clicked!');
  }
};

// Add controls
gui.addColor(params, 'color').name('Color');
gui.add(params, 'x', 0, 100).name('X Position');
gui.add(params, 'y', 0, 100).name('Y Position');
gui.add(params, 'enabled').name('Enabled');
gui.add(params, 'option', ['A', 'B', 'C']).name('Option');
gui.add(params, 'doSomething').name('Run Action');

// Create a folder for grouped controls
const folder = gui.addFolder('Advanced Settings');
folder.add(params, 'x').step(5).name('X (Step 5)');

Previews

📚 Documentation

📖 Complete Usage Guide

Step-by-step tutorials, best practices, and advanced usage examples

For API details and reference information, visit the API Reference.

🤖 For AI Assistants and Tools

This project includes a .llm.reference.md file specifically designed for AI assistants, agents, and tools to better understand and work with the codebase. This file contains:

  • Comprehensive architecture overview
  • Key component descriptions
  • Usage patterns and code examples
  • Core utility functions

AI tools can reference this file to provide more accurate and helpful suggestions when working with rad-gui.

📋 Available Controls

RAD-GUI supports various control types based on the parameter's value and provided options:

TypeDescriptionExample
NumberSlider or text input for numbersgui.add(params, 'x', 0, 100)
BooleanCheckbox for true/false valuesgui.add(params, 'visible')
StringText input fieldgui.add(params, 'name')
FunctionButton that calls a functiongui.add(params, 'save')
ColorColor pickergui.addColor(params, 'color')
OptionsDropdown for selecting from optionsgui.add(params, 'size', ['S', 'M', 'L'])

🎨 Customization

RAD-GUI is easily styled using CSS variables:

// Create and apply a custom theme
const darkTheme = {
  '--background-color': '#1a1a1a',
  '--text-color': '#e0e0e0',
  '--title-background-color': '#272727',
  '--title-text-color': '#ffffff',
  '--widget-color': '#2c2c2c',
  '--hover-color': '#3c3c3c',
  '--focus-color': '#444444',
  '--number-color': '#2cc9ff',
  '--string-color': '#a2db3c'
};

// Apply theme to a specific GUI instance
Object.entries(darkTheme).forEach(([key, value]) => {
  gui.domElement.style.setProperty(key, value);
});

📝 Examples

Explore more examples in the examples directory:

🧪 Development

# Install dependencies
npm install

# Build development version
npm run build:dev

# Run tests
npm run test

# View demo
npm run local:kitchen-sink

Keywords

gui

FAQs

Package last updated on 26 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts