Components / Inputs
Scrub field
A number you change by dragging sideways on it, as in design and 3D tools.
Functions: cui_scrub

Usage
static float opacity = 80;
cui_scrub(ui, "Opacity", &opacity, 0, 100, .suffix = "%");
Drag sideways anywhere on the field to change the value; hold Shift for steps ten times finer. A click without dragging lets you type a number. Arrow keys step when focused. A hairline along the bottom shows where the value sits in its range. Options: step (range / 100), format, suffix, icon (instead of the label), width.
Keyboard
- Drag sideways anywhere on the field to change the value; hold Shift for steps ten times finer.
Options of cui_scrub
| Option | Type | Default | Description |
|---|---|---|---|
.step | float | (max - min) / 100 | default (max - min) / 100 |
.format | const char * | "%.0f" | default "%.0f" |
.suffix | const char * | e.g. "px" or "%" | |
.icon | const char * | shown instead of the label | |
.width | cui_size | Width: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own. |
Related
- Money field: A field for an amount of money, with a currency symbol and grouped digits.
- Inline edit: Text that turns into a field when clicked, for renaming things in place.
- Prefix and suffix: Fixed text before or after a field's value, such as https:// or a unit.
- Password strength: A meter under a password field that scores the password from too short to strong.