Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Widget Gallery

Every widget in nano-ui is an ordinary Haskell function exported from NanoUI.

Buttons, a checkbox, text field, select, slider, switch, knob, spinner, progress bar, and sparkline in one nano-ui row.
Buttons, inputs, and canvas controls in one frame, rendered with nano-ui-svg.

Finding the right widget

What you needChapter
Buttons, menus, checkboxes, toggles, radio groups, selects, combo boxes, sliders, numeric fields, single-line text inputs, color pickersButtons, Menus & Inputs
Multi-line text editing, documents, undo history, IME compositionText Editing
Tabs, sortable tables, tree viewsTabs, Tables & Trees
Modals, floating windows, popups, tooltips, context menusOverlays & Windows
Drag-and-drop, list/tab reordering, dockable pane gridsDrag & Drop
Knobs, switches, progress bars, spinners, sparklines, custom 2D canvas drawingCustom Drawing & Controls
Colors, themes, interaction states, fontsStyling & Theming
Interactive previews of styling modifiersInteractive Styling Lab
Subtle styling rules and edge casesStyling Gotchas

Layout containers (row, column, grid, panel, card, layers, and so on) and sizing modifiers are covered in Layout & Scrolling.

Widget naming conventions

Most widgets follow the same four-function naming pattern:

FormWhat it does
button "Save"Base form. Returns Bool (when activated) or ().
button'Primed form. Returns a full Response.
buttonWith (fixedW 120)Takes a Layout -> Layout modifier as its first argument.
buttonConfigured cfgTakes a configuration record (every config has a matching default...Config).

A Response holds the widget’s identity, layout bounds, and interaction flags for the current frame:

Field or helperMeaning
respIdThe widget’s WidgetId (used for focus, menus, and scroll targets).
respRectThe widget’s bounding rectangle from the previous frame.
respHoveredTrue while the pointer is over the widget.
respPressedTrue while the mouse button is held down on the widget.
respClickedTrue on the frame the widget is activated (left click, Enter, or Space).
respChangedTrue on the frame the user edited the widget’s value.
respSubmittedTrue on the frame the user committed the field (for example, pressing Enter).
respHeldWith / respClickedWithCheck which specific MouseButton is held or clicked.
respRightPressed / respRightClickedShorthands for right-button interactions.

Any widget that returns a Response can be wired to tooltip, contextMenu, and the focus helpers.