{"id":14962068,"url":"https://github.com/s00500/espui","last_synced_at":"2025-05-14T19:02:05.080Z","repository":{"id":38008652,"uuid":"107566911","full_name":"s00500/ESPUI","owner":"s00500","description":"A simple web user interface library for ESP32 and ESP8266","archived":false,"fork":false,"pushed_at":"2024-11-06T08:32:25.000Z","size":2687,"stargazers_count":977,"open_issues_count":65,"forks_count":181,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-04-06T09:02:39.418Z","etag":null,"topics":["arduino","arduino-ide","arduino-library","browser","callback","control-pad","easy","esp32","esp8266","iot","javascript","slide","spiffs","tablet","ui","user-interface","userinterface","webinterface","websockets"],"latest_commit_sha":null,"homepage":"https://valencia.lbsfilm.at/midterm-presentation/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s00500.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-19T15:46:45.000Z","updated_at":"2025-04-04T06:21:14.000Z","dependencies_parsed_at":"2023-11-09T22:34:32.460Z","dependency_job_id":"eaec04de-1ed2-4f40-9c75-f3fecda0e5e7","html_url":"https://github.com/s00500/ESPUI","commit_stats":{"total_commits":402,"total_committers":30,"mean_commits":13.4,"dds":0.5497512437810945,"last_synced_commit":"ceffe2b7b37882420fcb69bac10dddd130f59372"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00500%2FESPUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00500%2FESPUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00500%2FESPUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s00500%2FESPUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s00500","download_url":"https://codeload.github.com/s00500/ESPUI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717241,"owners_count":21150387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-ide","arduino-library","browser","callback","control-pad","easy","esp32","esp8266","iot","javascript","slide","spiffs","tablet","ui","user-interface","userinterface","webinterface","websockets"],"created_at":"2024-09-24T13:29:01.145Z","updated_at":"2025-04-13T12:45:31.147Z","avatar_url":"https://github.com/s00500.png","language":"C++","readme":"# ESPUI\n\n![ESPUI](docs/ui_complete.png)\n\nESPUI is a simple library to make a web-based user interface for your projects using\nthe **ESP8266** or the **ESP32** It uses web sockets and lets you create,\n\nol, and update elements on your GUI through multiple devices like phones\nand tablets.\n\nESPUI uses simple Arduino-style syntax for creating a solid, functioning user\ninterface without too much boilerplate code.\n\nSo if you either don't know how or just don't want to waste time: this is your\nsimple solution user interface without the need of internet connectivity or any\nadditional servers.\n\nThe Library runs on any kind of **ESP8266** and **ESP32** (NodeMCU, AI Thinker, etc.).\n\n- [Dependencies](#dependencies)\n- [How to Install](#how-to-install)\n- [Getting started](#getting-started)\n- [UI Elements](#documentation)\n  * [Button](#button)\n  * [Switch](#switch)\n  * [Buttonpad](#buttonpad)\n  * [Labels](#labels)\n  * [Slider](#slider)\n  * [Number Input](#number-input)\n  * [Text Input](#text-input)\n  * [File Display](#filedisplay)\n  * [Date, Time, Colour and Password Input](#date-time-colour-and-password-input)\n  * [Select control](#select-control)\n  * [Getting the Time](#getting-the-time)\n  * [Separators](#separators)\n- [Initialisation of the UI](#initialisation-of-the-ui)\n- [Tabs](#tabs)\n- [Log output](#log-output)\n- [Colours](#colours)\n- [Advanced Features](#advanced-features)\n  * [Dynamic Visibility](#dynamic-visibility)\n  * [Inline Styles](#inline-styles)\n  * [Disabling Controls](#disabling-controls)\n  * [Grouped controls](#grouped-controls)\n  * [Wide controls](#wide-controls)\n  * [Graph (Experimental)](#graph--experimental-)\n  * [Captive Portal](#captive-portal)\n- [Notes for Development](#notes-for-development)\n- [Contribute](#contribute)\n\n\n### Contributed features\n\n- Tabs by @eringerli\n- Generic API by @eringerli\n- Min Max on slider by @eringerli\n- OptionList by @eringerli\n- Public Access to ESPAsyncServer\n- Inline CSS styles by @iangray001\n- Separators by @iangray001\n- Grouped and wide controls by @iangray001\n- Transport layer rework by @iangray001\n- Time control by @iangray001\n- Vertical controls by @iangray001\n- Time/date/password/color input types by @pcbbc\n- Delayed response support @MartinMueller2003\n- Fragmented control transfer @MartinMueller2003\n- Extended Callback @MartinMueller2003\n- Added a file display element @MartinMueller2003\n\n## Roadmap\n\n- Fully implement graphs\n- Expand number input features (floats etc.)\n- Support for enabling and disabling controls\n\n## Dependencies\n\nThis library is dependent on the following libraries.\n\n- [ESPAsyncWebserver](https://github.com/me-no-dev/ESPAsyncWebServer)\n- [ArduinoJson](https://github.com/bblanchon/ArduinoJson) (Last tested with\n  version 6.10.0)\n\n- (_For ESP8266_) [ESPAsyncTCP](https://github.com/me-no-dev/ESPAsyncTCP)\n- (_For ESP32_) [AsyncTCP](https://github.com/me-no-dev/AsyncTCP)\n- (_For ESP32_) [lorol/LittleFS_esp32](https://github.com/lorol/LITTLEFS)\n\n## How to Install\n\nMake sure all the dependencies are installed, then install like so:\n\n#### Using PlatformIO (_recommended_)\n\nJust include this library as a dependency in `lib_deps` like so:\n\n```\nlib_deps =\n    ESPUI\n    ESP Async WebServer\n    ESPAsyncTCP # (or AsyncTCP on ESP32)\n    LittleFS_esp32 # (ESP32 only)\n```\n\n#### Using the Arduino IDE (_recommended_)\n\nYou can find this Library in the Arduino IDE library manager. Go to \n`Sketch \u003e Include Library \u003e Library Manager` search for `ESPUI` and install.\n\nIf you cannot use the Library Manager, you can download the [repository](https://github.com/s00500/ESPUI/archive/master.zip) and follow\nthe [instructions to manually install libraries](https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/how-to-install-a-library).\n\n## Getting started\n\nESPUI serves several files to the browser to build up its web interface. This\ncan be achieved in 2 ways: _PROGMEM_ or _LITTLEFS_\n\n_When `ESPUI.begin()` is called the default is serving files from Memory and\nESPUI should work out of the box!_\n\n**OPTIONAL:** But if this causes your program to _use too much memory_ you can\nburn the files into the LITTLEFS filesystem on the ESP. There are now two ways to\ndo this: you can either use the ESP file upload tool or you use the library\nfunction `ESPUI.prepareFileSystem()`\n\n#### Simple filesystem preparation (_recommended_)\n\nJust open the example sketch **prepareFileSystem** and run it on the ESP, (give\nit up to 30 seconds, you can see the status on the Serial Monitor), The library\nwill create all needed files. Congratulations, you are done, from now on you\njust need to do this again when there is a library update, or when you want to\nuse another chip :-) Now you can upload your normal sketch, when you do not call\nthe `ESPUI.prepareFileSystem()` function the compiler will strip out all the\nunnecessary strings that are already saved in the chip's filesystem and you have\nmore program memory to work with.\n\n## User interface Elements\n\n- Label\n- Button\n- Switch\n- Control pad\n- Slider\n- Text Input\n- Date, Time, Colour and Password Input\n- Numberinput\n- Option select\n- Separator\n- Time\n- Graph (partial implementation)\n- File Display\n\n\n## Documentation\n\nThe heart of ESPUI is [ESPAsyncWebserver](https://github.com/me-no-dev/ESPAsyncWebServer). ESPUI's frontend is based on [Skeleton CSS](http://getskeleton.com/) and jQuery-like lightweight [zepto.js](https://zeptojs.com/) for handling events. The communication between the ESP and the client browser works using web sockets. ESPUI does not need network access and can be used in standalone access point mode, all resources are loaded directly from the ESPs memory.\n\u003cbr\u003e\u003cbr\u003e\nThis section will explain in detail how the Library is to be used from the Arduino code side. In the arduino `setup()` routine the interface can be customised by adding UI Elements. This is done by calling the corresponding library methods on the Library object `ESPUI`. Eg: `ESPUI.button(\"button\", \u0026myCallback);` creates a button in the interface that calls the `myCallback(Control *sender, int eventname)` function when changed. All buttons and items call their callback whenever there is a state change from them. This means the button will call the callback when it is pressed and also again when it is released. To separate different events, an integer number with the event name is passed to the callback function that can be handled in a `switch(){}case{}` statement.\n\u003cbr\u003e\u003cbr\u003e\nAlternativly you may use the extended callback funtion which provides three parameters to the callback function `myCallback(Control *sender, int eventname, void * UserParameter)`. The `UserParameter` is provided as part of the `ESPUI.addControl` method set and allows the user to define contextual information that is to be presented to the callback function in an unmodified form. \n\u003cbr\u003e\u003cbr\u003e\nIt also possible to use a lambda function in the callback parameter. It also allows the user to define, in a more C++ way, contextual information in any form. This is shown by the [completeLambda](examples/completeLambda/completeLambda.ino) example.\n\u003cbr\u003e\u003cbr\u003e\nThe below example creates a button and defines a lambda function to invoke a more specialized button callback handler:\n```\nvoid YourClassName::setup()\n{\n  ButtonElementId = ESPUI.addControl(\n  ControlType::Button,\n  ButtonLabel.c_str(),\n  \" Button Face Text \",\n  ControlColor::None,\n  ParentElementId,\n  [\u0026](Control *sender, int eventname)\n  {\n    myButtonCallback(sender, eventname); // class method\n  });\n\n  // or\n  ButtonElementId = ESPUI.button(\n  \" Button Face Text \",\n  [\u0026](Control *sender, int eventname)\n  {\n    myButtonCallback(sender, eventname); // class method\n  });\n}\n```\n```\nvoid YourClassName::myButtonCallback(Control* sender, int eventname)\n{\n  if (eventname == B_DOWN)\n  {\n    // Handle the button down event\n  }\n  else if (eventname == B_UP)\n  {\n    // Handle the button up event\n  }\n}\n```\n\u003cbr\u003e\n\u003cbr\u003e\n#### Button\n\n![Buttons](docs/ui_button.png)\n\nButtons have a name and a callback value. Their text can be changed at runtime using `ESPUI.updateButton()`.\n\nEvents:\n- `B_DOWN` - Fired when button is pressed.\n- `B_UP` - Fired when button is released.\n\n#### Switch\n\n![Switches](docs/ui_switches.png)\n\nSwitches sync their state on all connected devices. This means when you change\ntheir value (either by pressing them, or programmatically using `ESPUI.updateSwitcher()`) they change visibly \non all tablets or computers that currently display the interface.\n\nEvents:\n- `S_ACTIVE` - Fired when turning on.\n- `S_INACTIVE` - Fired when turning off.\n\n#### Buttonpad\n\n![control pads](docs/ui_controlpad.png)\n\nButton pads come in two flavours: with or without a center button. They are\nuseful for controlling movements of vehicles/cameras etc. They use a single \ncallback per pad and have 8 or 10 different event types to differentiate the \nbutton actions.\n\n- `P_LEFT_DOWN`\n- `P_LEFT_UP`\n- `P_RIGHT_DOWN`\n- `P_RIGHT_UP`\n- `P_FOR_DOWN`\n- `P_FOR_UP`\n- `P_BACK_DOWN`\n- `P_BACK_UP`\n- `P_CENTER_DOWN`\n- `P_CENTER_UP`\n\n#### Labels\n\n![labels](docs/ui_labels.png)\n\nLabels are used to display textual information (i.e. states, values of sensors, \nconfiguration parameters etc.). To send data from the code use `ESP.updateLabel()` . \nLabels get a name on creation and a initial value.\n\nLabels automatically wrap your text. If you want them to have multiple lines use\nthe normal `\u003cbr\u003e` tag in the string you print to the label.\n\nIn fact, because HTML can be used in the label's value, you can make a label display\nimages by including an `\u003cimg\u003e` tag. \n\n```\n ESPUI.label(\"An Image Label\", ControlColor::Peterriver, \"\u003cimg src='path/to/image'\u003e\");\n```\n\nThis requires that the client has access to the image in question, either from the internet or a local web server.\n\n\n#### Slider\n\n![slider](docs/ui_slider.png)\n\nSliders can be used to select (or display) a numerical value. Sliders provide\nrealtime data and are touch compatible. Note that like all ESPUI functions, the callback does not return an `int` \nbut a `String` so should be converted with the `.toInt()` function. See the examples for more details. Sliders can\nbe updated from code using `ESP.updateSlider()`.\n\nA slider usually only sends a new value when it is released to save network bandwidth. \nThis behaviour can be changed globally by setting `sliderContinuous` before `begin()`:\n\n```\nESPUI.sliderContinuous = true;\nESPUI.begin(\"ESPUI Control\");\n```\n\nEvents:\n - `SL_VALUE` - Fired when a slider value changes.\n\n#### Number Input\n\n![number](docs/ui_number.png)\n\nThe number input can be used to receive numbers from the user. You can\nenter a value into it and when you are done with your change it is sent to the\nESP. A number box needs to have a min and a max value. To set it up just use:\n\n`ESPUI.number(\"Numbertest\", \u0026numberCall, ControlColor::Alizarin, 5, 0, 10);`\n\nNumber inputs can be updated from code using `ESP.updateNumber()`.\n\nNote that HTML number boxes will respect their min and max when the user\nclicks the up and down arrows, but it is possible on most clients to simply type \nany number in. As with all user input, numbers should be validated in callback code\nbecause all client side checks can be skipped. If any value from the UI might\ncause a problem, validate it.\n\nEvents:\n - `N_VALUE` - Fired when a number value changes.\n\n\n#### Text Input\n\n![text](docs/ui_text.png)\n\nThe text input works very similar like the number input but allows any string to be entered. \nIf you attach a Max control to the text input then a max length will be applied\nto the control. \n\n```\ntext = ESPUI.text(\"Label\", callback, ControlColor::Dark, \"Initial value\");\nESPUI.addControl(ControlType::Max, \"\", \"32\", ControlColor::None, text);\n```\n\nText inputs can be updated from code using `ESP.updateText()`.\n\nHowever even with a set maximum length, user input should still be validated \nbecause it is easy to bypass client-side checks. Never trust user input.\n\nEvents:\n - `T_VALUE` - Fired when a text value changes.\n\n\n#### Date, Time, Colour and Password Input\n\n![text](docs/ui_inputtypes.png)\n\nAs an extension to the text input control, you can also specify the type attribute to be used for the HTML input element.\nThis allows you to easily create input controls for Date, Time, Colour and Passwords, or indeed any other\n[HTML Input Types](https://www.w3schools.com/html/html_form_input_types.asp) supported by your browser. \n\n```\ntext_date = ESPUI.text(\"Date\", callback, ControlColor::Dark, \"2022-05-24\");\nESPUI.setInputType(text_date, \"date\");\n\ntext_time = ESPUI.text(\"Time\", callback, ControlColor::Dark, \"13:00\");\nESPUI.setInputType(text_time, \"time\");\n\ntext_colour = ESPUI.text(\"Colour\", callback, ControlColor::Dark, \"#FF0000\");\nESPUI.setInputType(text_colour, \"color\");\n\ntext_password = ESPUI.text(\"Password\", callback, ControlColor::Dark, \"tiddles123\");\nESPUI.setInputType(text_password, \"password\");\n```\n\n*Important!* This function should be called _before_ `ESPUI.begin` or results will be unreliable.\n\nNote that not all browsers support all input types, and that the control displayed to edit the input is browser dependent.\n\nHowever even with a type set, user input should still be validated \nbecause it is easy to bypass client-side checks. Never trust user input.\n\n\n#### File Display\n\n![filedisplay](docs/ui_fileDisplay.png)\n\nThe File Display control is used to upload a file from the ESP file system and display the contents on the UI. The content is Auto Scrolled \nto the last line in the file. Syntax:\n\n`fileDisplayId = ESPUI.fileDisplay(\"Filetest\", ControlColor::Turquoise, FullyQualified FilePath);`\n\nAfter updating the contents of the file, trigger a display update using: \n`ESPUI.updateControl(fileDisplayId);`\n\n\n#### Select control\n\n![option1](docs/ui_select1.png)\n![option2](docs/ui_select2.png)\n\nThe Select control lets the user select from a predefined list of options. First create a select widget like so\n\n```\nuint16_t select1 = ESPUI.addControl( ControlType::Select, \"Select Title\", \"Initial Value\", ControlColor::Alizarin, tab1, \u0026selectExample );\n```\n\nThen add Options to it, specifying the Select as the parent:\n\n```\nESPUI.addControl( ControlType::Option, \"Option1\", \"Opt1\", ControlColor::Alizarin, select1);\nESPUI.addControl( ControlType::Option, \"Option2\", \"Opt2\", ControlColor::Alizarin, select1);\nESPUI.addControl( ControlType::Option, \"Option3\", \"Opt3\", ControlColor::Alizarin, select1);\n```\n\nCheck the **tabbedGui** example for a working demo. Selectors can be updated from code using `ESP.updateSelect()`.\n\nEvents:\n - `S_VALUE` - Fired when a select value changes.\n\n#### Getting the Time\n\nESPUI can create an invisible control that can be used to fetch the current time from the client \nwhen they are connected to the UI. This could be used to intermittently provide an accurate time \nsource to your ESP. Remember that clients cannot be relied upon to be correct or truthful. \n\nCreate a Time control with the following:\n\n```\n//Add the invisible \"Time\" control\nauto timeId = ESPUI.addControl(Time, \"\", \"\", None, 0, timeCallback);\n```\n\nAfter creating the UI, sending an update to the Time control will cause it to fetch the current \ntime from the client and then fire its callback with the result.\n\n```\n//Request an update to the time\nESPUI.updateTime(timeId);\n//Will trigger timeCallback\n``` \n\nIn `timeCallback` you can then print the control's value as normal:\n\n```\nvoid timeCallback(Control *sender, int type) {\n  if(type == TM_VALUE) { \n    Serial.println(sender-\u003evalue);\n  }\n}\n```\n\nThe returned string will be an [ISO string](https://www.w3schools.com/jsref/jsref_toisostring.asp) as returned by the Javascript `new Date().toISOString()`. The format is `YYYY-MM-DDTHH:mm:ss.sssZ` so for example: `2022-01-20T21:44:22.913Z`.\n\nEvents:\n - `TM_VALUE` - Fires when the control is updated with `updateTime()`\n\n#### Separators\n\n![separators](docs/ui_separators.png)\n\nYou can use separators to break up the UI and better organise your controls. Adding a separator will force any following controls onto the subsequent line. Add separators as follows:\n\n```\nESPUI.separator(\"Separator name\");\n//or\nESPUI.addControl(ControlType::Separator, \"Separator name\", \"\", ControlColor::None, maintab);\n```\n\nSeparators fire no events.\n\n### Initialisation of the UI\n\nAfter all the elements are configured, call `ESPUI.begin(\"Some Title\");`\nto start the UI interface. (Or `ESPUI.beginLITTLEFS(\"Some Title\");` respectively)\nMake sure you setup a working network connection or AccessPoint **before** (see\nthe `gui.ino` example). The web interface can then be used from multiple devices at once and\nalso shows connection status in the top bar.\n\n\n\n### Tabs\n\n![tabs](docs/ui_tabs.png)\n\nTabs can be used to organize your controls into pages. Check the **tabbedGui** example to see \nhow this is done. Tabs can be created as follows:\n\n```\nESPUI.addControl(ControlType::Tab, \"Settings 1\", \"Settings 1\");\n```\n\nThen all widgets for the tab need to be added to it by specifying the tab as the parent. Widgets not \nadded to a tab will be shown above the tab selctor.\n\n```\nESPUI.addControl(ControlType::Text, \"Text Title\", \"a Text Field\", ControlColor::Alizarin, tab1, \u0026textCall);\n```\n\nNote that the basic functions to add controls like `ESPUI.button()` or `ESPUI.slider()` do not add to any tab, \nso they are good for building small UIs. However if you need to use tabs then you will have to add all your\ncontrols using the full `ESPUI.addControl()` function.\n\n\n\n### Log output\n\nESPUI has several different log levels. You can set them using the\n`ESPUI.setVerbosity(Verbosity::VerboseJSON)` function.\n\nLoglevels are:\n\n- `Verbosity::Quiet` (default)\n- `Verbosity::Verbose`\n- `Verbosity::VerboseJSON`\n\nVerboseJSON outputs the most debug information.\n\n### Colours\n\nA selection of basic colours are available to use:\n\n![Colours](docs/ui_colours.png)\n\nIf you want more control over the UI design, see the Inline Styles section below.\n\n\n## Advanced Features\n\nESPUI includes a range of advanced features that can customise your UIs.\n\n\n### Dynamic Visibility\n\nControls can be made visible or invisible at runtime with the `updateVisibility()` function.\n\n```\nESPUI.updateVisibility(controlId, false);\n```\n\nNote that you cannot hide individual controls from a [control group](#grouped-controls), you have to hide the entire group.\n\n\n### Inline Styles\n\nYou can add custom CSS styles to controls. This allows you to style the UI with custom colors, drop shadows, \nor other CSS effects. Add styles with the following functions:\n\n```\nsetPanelStyle(uint16_t id, String style);\nsetElementStyle(uint16_t id, String style)\n```\n\nA panel style is applied to the panel on which the UI element is placed, an element style is applied to the element itself. \nBecause CSS inline styles can only style one specific DOM element, for controls made up of multiple elements (like the pad) \nthis is limited. Element styles can be applied to all controls, but will only work correctly for the Button, Label, Slider, \nSwitcher, Number, Text, and Selector. \n\nDynamic update of styles is supported. When either of the above functions are called, the control is updated live. This could \nbe used to refect a warning state by changing the color of a button, or for similar effects.\n\nFor example, this code will set a control's panel to a random background color:\n\n```\nchar stylecol[30];\nsprintf(stylecol, \"background-color: #%06X;\", (unsigned int) random(0x0, 0xFFFFFF));\nESPUI.setPanelStyle(switch1, stylecol);\n```\n\nYou can get quite creative with this.\n\n![Inline Styles](docs/inlinestyles.gif)\n\nThe [completeExample](examples/completeExample/completeExample.cpp) example includes a range of things that you can do with inline styles.\n\n![More Inline Styles](docs/ui_inlinestyles2.png)\n\n\n### Disabling Controls\n\nIt is possible to dynamically enable and disable controls to, for example, provide feedback to the user that a particular feature is \ntemporarily unavailable. To do this use the following function call:\n\n```\nESPUI.setEnabled(controlId, enabled);\n```\n\nSetting `enabled` to false will make the control noninteractive and it will visually change to illustrate this to the user. The control\nwill stop firing any events. Note that whilst the widget will change appearance, the panel of the control will remain whatever colour \nit was set to. If you wish to also change the colour of the panel then you should use inline styles to show the noninteractive state. For example:\n\n```\nESPUI.setEnabled(mainButton, false);\nconst String disabledstyle = \"background-color: #bbb; border-bottom: #999 3px solid;\";\nESPUI.setPanelStyle(mainButton, disabledstyle);\n```\n\nThis CSS style sets the panel background and its border to grey. To put the control back to enabled use the following:\n\n```\nESPUI.setEnabled(mainButton, true);\nESPUI.setPanelStyle(mainButton, \";\");\n```\n\nNote that we have to set the inline style to `\";\"` (i.e. an empty CSS rule) because if we just try to set it to `\"\"` this will be \ninterpreted as \"do not change the style\".\n\nControls can also be set to disabled before the UI is started.\n\n### Grouped controls\n\nNormally, whenever a control is added to the UI, a new panel is generated with a title. However, you can instead \nset the \"parent\" of a new control to be an existing control. This allows you to add multiple widgets into the same \npanel. For example:\n\n```\npanel1 = ESPUI.addControl(ControlType::Button, \"Button Set\", \"Button A\", ControlColor::Turquoise, Control::noParent, btncallback);\nESPUI.addControl(ControlType::Button, \"\", \"Button B\", ControlColor::None, panel1, btncallback);\nESPUI.addControl(ControlType::Button, \"\", \"Button C\", ControlColor::None, panel1, btncallback);\n```\n\nThe first call to `addControl` has no parent (or it could be set to a tab if you are using a tabbed UI), so therefore a new panel is added containing one button\nwith the value `Button A`. The two subsequent calls have their parent set to the first control we added, so instead of creating\na new panel, the result is the following:\n\n![Grouped buttons](docs/ui_groupedbuttons.png)\n\nThe grouped controls operate entirely independently, and can be assigned different callbacks, or updated separately. The grouping \nis purely visual.\n\nMost controls can be grouped this way, but the result is not always visually pleasant. This works best with labels, sliders, switchers,\nand buttons.\n\n![Other grouped controls](docs/ui_groupedbuttons2.png)\n\nFor sliders and switchers, you can also set the controls to be displayed vertically.\n\n```\nauto vertswitcher = ESPUI.addControl(Switcher, \"Vertical Switcher\", \"0\", Dark, tab1);\nESPUI.setVertical(vertswitcher); \n```\n\nThis must be done before `ESPUI.begin()` is called. Vertical layouts are currently only supported for sliders and switchers, and it \nis a purely visual change. Behaviour is identical. Mixing horizontal and vertical controls can result in some unpredictable layouts.\n\nWhen you add multiple buttons to a single panel, the buttons have a title so they can be differentiated. For sliders and switchers this is\nnot the case. Therefore you might want to add additional labels so that the controls can be distinguished. There is not yet automatic \nsupport for doing this, so the approach is to add labels that have been styled using [inline styles](#inline-styles). By doing this \nyou can acheieve effects such as this:\n\n![Labelling grouped controls](docs/ui_groupedbuttons3.png)\n\nThe code to do this is in the [completeExample](examples/completeExample/completeExample.cpp) example.\n\n### Wide controls\n\nControls can be set to be displayed \"wide\" with the function:\n\n```\nESPUI.setPanelWide(controlid, true);\n```\n\n*Important!* This function should be called _before_ `ESPUI.begin` or results will be unreliable.\n\nSetting a control to wide tells ESPUI to lay out that control as if there was only a single column, even on wide displays. \nThis can be applied to every element to force a single column layout, or to individual elements to customise the display.\n\n![Wide controls](docs/ui_widecontrols.png)\n\nNote that this will have no effect on small screens.\n\n\n### Graph (Experimental)\n\n![graph](docs/ui_graph.png)\n\nThe graph widget can display graph points with timestamp at wich they arrive\n\nUse `ESPUI.addGraphPoint(graphId, random(1, 50));` to add a new value at the current time, use `ESPUI.clearGraph(graphId)` to clear the entire graph.\nGraph points are saved in the browser in **localstorage** to be persistant, clear local storageto remove the points or use clearGraph() from a bbutton callback to provide a clear button.\n\n_There are many issues with the graph component currently and work is ongoing. Consider helping us out with development!_\n\n### Captive Portal\n\nESPUI will redirect all unknown URLs it is asked for to the 'root' of the local HTTP server instead of responding with an HTTP code 404. This makes it act as a simple 'captive portal'. Note you must also set up the ESP to be a DNS server that responds to all DNS requests with the IP address of the ESP. This only effective when the ESP is acting as a WiFi hotspot in AP mode and assigning itself as the DNS server to connected clients. \n\nAll the example sketches include the DNS related code and will work as captive portals when used as a hotspot. In the event you wish to disable this feature you can do so by removing the DNS server code and adding the code below.\n\n```\nESPUI.captivePortal = false;\n```\n\n\n# Notes for Development\n\nIf you want to work on the HTML/CSS/JS files, do make changes in the _data_\ndirectory. When you need to transfer that code to the ESP, run\n`tools/prepare_static_ui_sources.py -a` (this script needs **python3** with the\nmodules **htmlmin**, **jsmin** and **csscompressor**). This will generate a) minified files\nnext to the original files and b) the C header files in `src` that contain the minified and\ngzipped HTML/CSS/JS data. Alternatively, you can specify the `--source` and `--target` arguments to the\n`prepare_static_ui_sources.py` script (run the script without arguments for\nhelp) if you want to use different locations.\n\nIf you don't have a python environment, you need to minify and gzip the\nHTML/CSS/JS files manually. I wrote a little useful jsfiddle for this,\n[see here](https://jsfiddle.net/s00500/yvLbhuuv/).\n\nIf you change something in HTML/CSS/JS and want to create a pull request, please\ndo include the minified versions and corresponding C header files in your\ncommits. (Do **NOT** commit all the minified versions for the non changed files)\n\n# Experimental debugging environment using emulation on host\n\nIt is possible to run or debug this library on a unix-like computer (Linux,\nmacOS, WSL) without flashing on hardware, and with your favourite debugging\ntools (gdb, valgrind, ...).  This is accomplished through the\nesp8266/Arduino \"emulation on host\" environment.\n\nA fake AsyncWebserver library is needed because lwIP is not yet ported to\nthe emulation environment.  Full instructions can be found in this project's\n[readme page](https://github.com/d-a-v/emuAsync).\n\n## Changelog for 2.1:\n\n - Adds the ability to have inline styles for widgets and panels\n - Adds LittleFS on the ESP32\n - Cleans up examples\n - Adds Button Animation\n - Adds chunking for the widgets so you can add even more of them\n - Fixes lots of bugs related to invisible UI elements and sliders\n - Adds the ability to change port\n\n## Changelog for 2.0:\n\n- ArduinoJSON 6.10.0 Support\n- Split pad into pad and padWithCenter\n- Cleaned order of parameters on switch and pad\n- Changes all numbers to actually be numbers (slider value, number value, min and max)\n\n# Contribute\n\nLiked this Library? You can **support** me by sending me a :coffee:\n[Coffee](https://paypal.me/lukasbachschwell/5).\n\nOtherwise I really welcome **Pull Requests**.\n","funding_links":["https://paypal.me/lukasbachschwell/5"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs00500%2Fespui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs00500%2Fespui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs00500%2Fespui/lists"}