Reusable React UI widgets - This is my widget library. There are many like it, but this one is mine...
Last updated 2 months ago by jmquigley .
LGPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gadgets 
SYNC missed versions from official npm registry.


Reusable React UI widgets - This is my widget library. There are many like it, but this one is mine...

build analysis code style: prettier testing NPM coverage

This library provides widgets and composite controls for building desktop apps using Electron. The widgets are listed below.



The CSS styles must be included within a project using CSS modules or via webpack configuration:

code snippet

const styles = require('gadgets/dist/styles.css');

import {
} from 'gadgets';


<Button />
<ButtonToggle />

webpack snippet

module.exports = {
	entry: [
		path.resolve(__dirname, 'node_modules', 'gadgets', 'dist', 'styles.css'),
	target: 'node',
	output: {
		path: path.resolve(__dirname, 'dist'),
		filename: 'bundle.js',
		publicPath: "dist/",
		libraryTarget: "commonjs"

This will give a webpack module an entry point to copy the gadgets CSS file into that build's distribution. Without this the built in styles for each control will be missing.

Note that React is NOT packaged with the app. An app that uses this library must supply the React library. The demo application shows an example of this.


This module uses yarn to manage dependencies and run scripts for development.

To install as an application dependency:

$ yarn add gadgets

To build the app and run all tests:

$ yarn run all

To build and run the demo application in electron use:

$ yarn run demo

This will check out all dependencies, build the code, test, and then try to run it within electron. This will take some time to complete.

To just attempt to run the application without building use (assuming the app was recently built):

$ yarn start



The build process happens in two steps:

  1. Typescript Compilation (first)
  2. Webpack vial babel-loader (second)

The Typescript build converts all of the .ts and .tsx files into their .js and .jsx counterparts, while also generating typing information (.d.ts). It uses the tsc compiler to generate this code. The second part uses webpack to take these converted files and generate a webpack bundle. During the bundle creation the generated typings are placed into the dist directory with the generated bundle. This process is followed instead of using a webpack loader to handle the typescript compilation (such as ts-loader. The webpack build can't generate typings via the loader and use the copy webpack plugin at the same time. This happens because the copy plugin tries to copy files in parallel while they are being generated. This leads to errors and warnings in the build for missing files that are not yet generated. In the future this may be changed to use a loader and the webpack-shell-plugin instead of the webpack copy plugin, but the current solution didn't require custom code to perform the copy. This two part solution works, but does lead to the following complication.

To change the code while electron is running and use CMD + R to refresh electron (in two terminals):

$ yarn watch:types.    # starts the typescript compiler in terminal 1
$ yarn watch:webpack   # starts the webpack watcher in terminal 2

This starts two separate watchers. It will watch for changes in the typescript files first. When detected the typescript compiler will build from .ts/.tsx to .js/.jsx. The webpack watcher will then see this and rebuild the bundle with the second watcher.

This library was created for use in the Electron UI and has been tested to work with the most recent version of Chromium in Electron. It contains a custom set of React widgets and composite components used to create a desktop application. The build uses Typescript and Wepback to create the package. Once built it contains a distribution bundle (bundle.js) and a CSS file (styles.css) that can be included within another project. The library also makes use of styled components.

Click on the each documented element below to see a picture of the component (where applicable). To see a live demo, build the application (listed above). It will run a demo electron application demonstrating each component. The demo application also contains samples that demonstrate how the components are used.


The library use the debug module to print information to log. To see debugging information set the environment variable DEBUG_GADGETS to true. Also, set a string qualifier to the DEBUG environment varaible to turn on messages for a component (this is needed by the debug module). All of the components have their own namespace that follows the convention:


Where component is the React name for the component, i.e. Accordion, List, etc... The :action is either empty, :create, or :render. e.g.


Will print debugging information when the render() method is called. This includes the props and state at the time the render operation started. Wildcards can also be used:


When the constructor is called to create each instance of a component, the create message will displayed in the console. It will contain references to the initial props and state. With the wildcard above this will display the create message for every component as it is created.


The module contains the following widgets (click on each header to see attribute/event details for each):


An accordion control contains N number of AccordionItems. These items will display/hide the contents of that item when the header of that item is clicked. The content of an AccordionItem can be any set of HTML tags. The demo application shows a List embedded within the accordion.


A counter widget that annotates (overlays) another widget.


This module represents the properties that are shared by every class in the project. This includes properties such as color, id, disabled, etc.


A navigation control used to keep track of previous locations visited. The rightmost item is the current location. This provides a "path" back to the start of some navigation.


A wrapper for the <br> tag. This respects the Sizing option for controls so that the height of the break matches the current line height.


Creates a web browser instance using a webview tag


A typical button control widget. This control only uses an icon and no text to represent the button. The icons are Font Awesome strings. That library is built into this module, so any font available in the current release of that library is available.


A circular button control. Works like a typical button... except it's a circle.


A button control that when pushed displays a local dialog box. The contents of the control make up the dialog window.


A button control that contains an icon and a text string. The text string can be to the left or right of the icon.


A button control that switches between the given icons when clicked. The state of the button is maintained until it is clicked again.


A generic control used to group other controls. It creates a section tag around the given child component.


A component that represents data in a 2D table format like excel. The underlying code is a wrapper around the react-data-grid component.


TODO: create the DateChooser control


A modal, dialog box popup window for yes/no user decisions.


A modal dialog window.


A dropdown list using the HTML select/option elements.


A specialized List control that can be manipulated by the user. They can add/remove/select items from it.


A multi-line text editor control. It uses a custom markup module under the Quill editor/api.


TODO: create a circular gauge control


Displays a graphical icon within the current container.


A text label string control that can be edited.


A container element that holds a list of other elements. The List resolves to a <ul> and the items within it resolve to <li>.


A checkbox/radio button control. This is just a specialized form of ButtonToggle.


A grouping of Option conmponents.


A pagination control. This takes an input size I and a page size P and breaks it up into N = I/P entries. The entries are displayed as a list of pages that can be chosen by the user.


Takes a string of a markup language (asciidoc, markdown, or restructuredtext), converts it to HTML, and presents it in a webview control.


TODO: create the ProgressBar control


TODO: create the Rating control


The Slider control creates a horizontal line overlapped by a chevron that can be moved along this horizontal line.


A button control that works like a toggle. Pressing the button will turn it on or off. The color of the slider shows the state.

TagList (Tag)

The tag list control is a basic list of strings that act as metadata for another control. They are used to categorize information.

TabContainer (Tab)

A typical tab control container. This manages Tab elements within it.


A multiline text editing component. It is a contenteditable div.

TextField (Validator)

The TextField is a wrapper component for the built in <input> tag. This control allows the user to add validation routines to the input control beyond the builtin routines.


TODO: create TimeChooser control


A reusable title block used to format two items: a title and a widget. The title is generally a text string and the widget can be a text string or another control.


A popup that contains a message on the top or bottom of that container. The message will disapper after N seconds. Contains an X button to remove sooner. It contains four basic modes: info, warning, error, custom.


A grouping of buttons and/or controls in a horizontal bar.


A text popup window on a control used to give help or feedback to the user of that control.


This component represents data in a hierarchical parent/child view. The underlying code is a wrapper around the react-sortable-tree component written by Chris Fritz.


Uses SVG to draw a triangle within the container.


TODO: Create a Voting control (up/down arrows to affect vote count like Reddit)


Each component uses the Wrapper component to catch potential errors within the control. These are error boundaries that are new to React 16. It also wraps the ThemeProvider used by the styled-components.


The library contains an external style sheet that must be included. It is located in node_modules/gadgets/dist/styles.css. This library also uses highlight.js. If the Editor control is used, then the highlight CSS files need to be included as well. They are located in node_modules/gadgets/dist/highlights/*.css. These should be copied to the root of the site/app (with something like the Copy Webpack Plugin).

Current Tags

  • 0.0.70                                ...           latest (2 months ago)

64 Versions

  • 0.0.70                                ...           2 months ago
  • 0.0.69                                ...           3 months ago
  • 0.0.68                                ...           5 months ago
  • 0.0.67                                ...           5 months ago
  • 0.0.66                                ...           5 months ago
  • 0.0.65                                ...           7 months ago
  • 0.0.64                                ...           7 months ago
  • 0.0.63                                ...           8 months ago
  • 0.0.62                                ...           9 months ago
  • 0.0.61                                ...           9 months ago
  • 0.0.60                                ...           9 months ago
  • 0.0.59                                ...           9 months ago
  • 0.0.58                                ...           9 months ago
  • 0.0.57                                ...           a year ago
  • 0.0.56                                ...           a year ago
  • 0.0.55                                ...           2 years ago
  • 0.0.54                                ...           2 years ago
  • 0.0.53                                ...           2 years ago
  • 0.0.52                                ...           2 years ago
  • 0.0.51                                ...           2 years ago
  • 0.0.50                                ...           2 years ago
  • 0.0.49                                ...           2 years ago
  • 0.0.48                                ...           2 years ago
  • 0.0.47                                ...           2 years ago
  • 0.0.46                                ...           2 years ago
  • 0.0.45                                ...           2 years ago
  • 0.0.44                                ...           2 years ago
  • 0.0.43                                ...           2 years ago
  • 0.0.42                                ...           2 years ago
  • 0.0.41                                ...           2 years ago
  • 0.0.40                                ...           2 years ago
  • 0.0.39                                ...           2 years ago
  • 0.0.38                                ...           2 years ago
  • 0.0.37                                ...           2 years ago
  • 0.0.36                                ...           2 years ago
  • 0.0.35                                ...           2 years ago
  • 0.0.34                                ...           2 years ago
  • 0.0.33                                ...           2 years ago
  • 0.0.32                                ...           2 years ago
  • 0.0.31                                ...           2 years ago
  • 0.0.30                                ...           2 years ago
  • 0.0.29                                ...           2 years ago
  • 0.0.28                                ...           2 years ago
  • 0.0.27                                ...           2 years ago
  • 0.0.26                                ...           2 years ago
  • 0.0.25                                ...           2 years ago
  • 0.0.24                                ...           2 years ago
  • 0.0.23                                ...           2 years ago
  • 0.0.22                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.19                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.16                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
Maintainers (1)
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 26
Dependencies (52)
Dependents (0)

Copyright 2014 - 2017 © |