Skip to content

RangeInput

pywry.toolbar.RangeInput

Bases: ToolbarItem

A dual-handle range slider for selecting a value range.

Emits {start: ..., end: ..., componentId: ...} on range change.

This component provides a single slider track with two handles for selecting a minimum and maximum value. Unlike SliderInput which selects a single value, RangeInput allows users to define a range of values.

ATTRIBUTE DESCRIPTION
start

Initial start (lower) value (default: 0).

TYPE: float or int

end

Initial end (upper) value (default: 100).

TYPE: float or int

min

Minimum allowed value for the track (default: 0).

TYPE: float or int

max

Maximum allowed value for the track (default: 100).

TYPE: float or int

step

Step increment (default: 1).

TYPE: float or int

show_value

Display the current range values next to the slider (default: True).

TYPE: bool

debounce

Milliseconds to debounce input events (default: 50).

TYPE: int

Examples:

>>> RangeInput(
...     label="Price Range:",
...     event="filter:price",
...     start=100,
...     end=500,
...     min=0,
...     max=1000,
...     step=10,
... )

Functions

validate_range

validate_range() -> RangeInput

Validate min <= max and start <= end within range.

build_html

build_html() -> str

Build dual-handle range slider HTML with overlaid inputs.

auto_generate_component_id

auto_generate_component_id() -> ToolbarItem

Auto-generate component_id based on type if not provided.

validate_event_name classmethod

validate_event_name(v: str) -> str

Validate event follows namespace:event-name pattern.