Nodes/Elegant Nodes/Elegant Slider
ComfyUI Node

Elegant Slider

Finally, a Number Widget With a Range You Choose

By wipeer·Created 2 months ago·Updated 22 days ago· 2
Elegant Slider
  • min
  • max
  • step
  • int
  • float
◄value50►

Here's a small annoyance that turns into a big one: ComfyUI's number boxes have a fixed range baked into whatever node declared them. A denoise field might run 0–1, a CFG 0–100, a LoRA weight −100–100 whether you need that or not. That's fine when you're typing numbers. It's terrible when you're scrubbing them, because the slider's most useful two millimetres of travel are the ones where your actual values live, and everything else is dead space.

Elegant Slider fixes it by making the range part of the node. You set min and max yourself, drag the slider, and get the value out as both an int and a float. It's a value node in the plumbing sense - one number, one authoritative source, fanned out to wherever it's needed - but with a decent hand on it instead of a text field.

How the snapping actually works

Dragging is the frontend's job; the guarantee is in the backend, and it runs on every execution, not just when you move the slider. The value gets clamped into [min, max] first, then moved to the nearest step, counted from min. Three consequences fall out of that, and all three are things you'll hit:

  • step: 0 means any value. No snapping, just the range limit.
  • Steps count from min, not from zero. A range of 0–10 with step 3 gives you 0, 3, 6, 9 - it never reaches 10, because the last step would overshoot. If you want the top of the range to be reachable, pick a step that divides the span.
  • A reversed range is fine. Set min above max and they're swapped rather than erroring, so a slider dragged backwards still behaves.

There's one more nicety in the source: the result is rounded to 10 decimal places before output, which is what stops 0.30000000000000004 from appearing in your filename prefix.

The two outputs differ by rounding. float is the snapped value. int is that value rounded to the nearest whole number, with halves going up - deliberately, because Python's default round-half-to-even would disagree with the frontend's JavaScript and produce off-by-one previews. So a slider sitting at 0.5 hands you 1 on the int output.

Inputs and outputs you actually touch

value is the slider, and it's the only one visible by default. min, max and step are advanced inputs - click the cyan ⚙ in the node title to reveal them, and expect to be briefly confused the first time, because the range controls are hidden on a node whose entire purpose is the range. Defaults are 0, 100 and 1, so a freshly dropped slider is a clean 0–100 integer scrubber.

All three of them accept an INT as well as a FLOAT, which means they can be connected - drive max from elsewhere in the graph and the slider's range becomes dynamic.

Outputs: int and float. Which one you use depends on the socket you're feeding. Denoise, CFG, ControlNet strength and LoRA weight all want float; steps, batch size and seed want int.

Good ranges to steal: denoise 0→1 step 0.01, CFG 1→10 step 0.1, LoRA weight −1→2 step 0.05, ControlNet strength 0→2 step 0.05. Setting the step to something honest is most of the value here - a 0–1 slider at 0.01 stops you accidentally landing on 0.63 when you meant 0.65.

Installing

ComfyUI Manager: search Elegant Nodes, install, restart, refresh the browser.

Or:

cd ComfyUI/custom_nodes
git clone https://github.com/wipeer/comfyui-elegant-nodes.git
pip install -r comfyui-elegant-nodes/requirements.txt

No model files, nothing to download, no VRAM. simpleeval is the only external dependency and ComfyUI already installs it for its own expression node. The requirement that actually bites is ComfyUI 0.4.0 or newer, since the pack uses the V3 node API - on an older build the import fails outright.

If Manager claims it can't find the pack, that's the known Comfy Registry extraction hiccup the author documents in TODO.md. git clone the URL and move on.

Two gotchas

The range is enforced at run time, not just in the UI. Send a value through the API that's outside min–max and it gets clamped into range before the node outputs anything. That's usually what you want, and it's a nasty surprise if you assumed the slider was purely cosmetic while your script was doing the real work.

Promoted sliders keep the range they had when you promoted them. If you promote value onto a subgraph node to get a slider on the outside, the copy there is set at promotion time. Change min/max on the inner node afterwards and the subgraph's slider doesn't follow. Re-promote it, or set the range before you promote - the second one is less annoying.

Categoryelegant

Inputs (4)

NameTypeDefaultDescription
valueFLOAT50-1000000000000–1000000000000Drag to choose. The range comes from min and max below.
minFLOAT,INT0-1000000000000–1000000000000Smallest value on the slider.
maxFLOAT,INT100-1000000000000–1000000000000Largest value on the slider.
stepFLOAT,INT10–1000000000000Size of one step: 1 for whole numbers, 0.01 for hundredths. 0: any value.

Outputs (2)

NameTypeDescription
intINT—
floatFLOAT—