Skip to content

A declarative, event-driven graphical interface for monitoring and modifying JavaScript variables.

License

Notifications You must be signed in to change notification settings

sophia-ooo/knurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knurl

knurl demo

A declarative, event-driven graphical interface for monitoring and modifying JavaScript variables.

npm version

ExamplesAPIControls

import knurl from "knurl";

// Create a panel
const panel = knurl.create([
    { id: "speed", type: "range", min: 0, max: 10, value: 5 },
    { id: "color", type: "color", value: "#ff0055" },
    { id: "debug", type: "toggle", value: false },
]);

// Listen to changes
panel.subscribe((id, value) => {
    console.log(`${id} changed to:`, value);
});

// Update values
panel.set({ speed: 7 });

// Get current values
const { speed, color, debug } = panel.get();

Installation

npm install knurl

Why knurl?

knurl is built on three principles:

  • Predictable state flow — Changes emit events. You handle them.
  • Serializable configuration — Define UI as JSON. Save, version, generate.
  • Simple, extensible API — A 7-method API. Add custom controls and styles.

API

See the full API documentation.

Controls

See the full controls reference.

Theming

knurl uses CSS custom properties for easy theming. Apply themes with the classNames option:

const panel = knurl.create(controls, {
    classNames: ["dark-theme", "compact"],
});

See the theming reference for available CSS variables and examples.

Building

npm install        # Install dependencies
npm run build      # Build the library
npm run build:all  # Build library and examples

License

MIT

About

A declarative, event-driven graphical interface for monitoring and modifying JavaScript variables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published