Skip to main content

Module components

Module components 

Source
Expand description

Framework-agnostic component behavior — the handle_event logic for the interactive component types whose handlers touch only core types.

Rendering is backend-specific (ratatui paints a Frame, Slint builds a reactive tree), but the semantics of how a component reacts to a key press (fire an action, write a data-model value, toggle, …) are identical across backends. Extracting that logic here lets every backend reuse one implementation instead of duplicating it.

Each submodule exposes pub fn handle_event(ctx: &ComponentContext, event: &InputEvent) -> Option<EventResult>. dispatch_event routes by component-type name.

§Scope

Only handlers with no backend coupling are extracted here: button, checkbox, slider, text_field. The remaining interactive types stay backend-specific for now:

  • choice_picker / tabs — their handlers share locally-defined deserializable types (ChoiceOption, TabEntry) with the ratatui render path; extracting them would pull render types into core.
  • date_time_input — its handler shares chrono parsing helpers with render.
  • audio_player — drives real audio hardware (rodio), inherently backend-bound.

A Slint backend reuses the four shared handlers via dispatch_event and reimplements the rest locally until they are promoted here.

Modules§

button
Button component behavior — framework-agnostic handle_event.
checkbox
CheckBox component behavior — framework-agnostic handle_event.
slider
Slider component behavior — framework-agnostic handle_event.
text_field
TextField component behavior — framework-agnostic handle_event.

Functions§

dispatch_event
Route a key-press event to the named component type’s [handle_event].