You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a declarative <Slider> widget with a controlled numeric binding and range configuration. Support common UX options (label text, show value, vertical orientation, enable/disable, tooltip) and emit change events. Provide optional value quantization via step.
A core numeric control for settings/preferences and live tweaking.
Keeps templates concise while preserving a controlled-value model consistent with other EFx inputs.
Reduces imperative boilerplate around egui sliders.
Scope
Tag: <Slider>
Required:value={number_expr}, and either min/maxorrange="a..=b".
Optional attributes:
text="..." (label next to/inside the slider) or inline text children (mutually exclusive).
showValue=bool (display current value on the slider).
Add a declarative
<Slider>widget with a controlled numeric binding and range configuration. Support common UX options (label text, show value, vertical orientation, enable/disable, tooltip) and emit change events. Provide optional value quantization viastep.Scope
Tag:
<Slider>Required:
value={number_expr}, and eithermin/maxorrange="a..=b".Optional attributes:
text="..."(label next to/inside the slider) or inline text children (mutually exclusive).showValue=bool(display current value on the slider).orientation="horizontal|vertical"(default:horizontal).step=number(quantize the resulting value to multiples ofstepafter drag).enabled=bool,tooltip="...",id="...",width=f32,height=f32(best-effort).Events:
onChange={|v| ...}— called when value changes.onRelease={|v| ...}— optional; fires when the user releases the drag (based onResponse::drag_released()).Non-goals (here): custom value formatter, units/suffix, logarithmic scaling (can be proposed later if needed).
Proposed API (sketch)
Template
Conceptual mapping to egui
Tasks
AST & parsing
<Slider>node with attributes:value,min,max/range,text,showValue,orientation,step,enabled,tooltip,id,width,height.text=...(error if both).rangeformat (a..=b) and numeric types.Codegen
value={expr}by copying into a local, pass&muttoegui::Slider, then write back if changed.step(round to nearest multiple within[min, max]).onChange(v)when value changes; emitonRelease(v)when drag ends.Diagnostics
valueormin/max/range→ clear error with expected usage.value, mixed numeric types) → actionable message.min > maxor invalidrange→ compile error.text) → error; suggest picking one.<Slider>.Examples & docs
examples/slider_basic.rs(float with step, showValue).examples/slider_vertical.rs(integer, vertical, onRelease).docs/cookbook.md; entry indocs/tags.md.Tests
step) and orientation mapping.wasm32-unknown-unknown(no runtime).