Slider

A slider users can drag — or set by voice: “volume to seventy”.

Speak the command followed by a number and the slider claims the phrase, parses the number — digits or words, “70” or “seventy” — and clamps it to the range. Dragging works exactly like a native range input, speech or no speech.

Basic slider

Loading the React Native kit…

Hold anywhere and say:“volume to seventy”“volume 25”“volume zero”

Props

  • default 0
  • default 100
  • default 1
  • not set
React Native
Updates as you tick props
import { ListensSlider } from "@listenssoft/speechui-react-native";import { useState } from "react";
function Demo() {  const [volume, setVolume] = useState(40);  return (    <ListensSlider      label="Volume"      command="volume"      value={volume}      onValueChange={setVolume}    />  );}

What you can say

SayEffect
“volume seventy”Sets the value to 70 (spoken numbers are parsed: words, digits, or both).
“volume to seventy”Same — filler words before the number are ignored.
“volume 3.5”Decimal digits parse too; the result is clamped to [min, max].
“volume three hundred”Clamped to max. Compound numbers (“two hundred fifty”) are understood.

The phrase must start with the command (a starts-with match claims the transcript so nothing else acts on it). The number is whatever parseSpokenNumber finds in the remainder; if there is no number, nothing happens.

API reference

React Native props for @listenssoft/speechui-react-native.

Props

PropTypeDefaultDescription
minnumber0Lower bound; spoken values clamp to it.
maxnumber100Upper bound; spoken values clamp to it.
stepnumber1Drag increment. The RN slider is pure RN — no native slider dependency.
disabledboolean—Disables dragging.

Extra props

PropTypeDefaultDescription
labelstring—Label above the slider; also the command fallback.
commandstringlabelThe spoken command; “<command> <number>” sets the value.
valuenumber—Controlled value. Pair with onValueChange.
onValueChange(value: number) => void—Called when the value changes — by drag or by voice.
styleStyleProp<ViewStyle>—Style override for the outer container.
labelStyleStyleProp<TextStyle>—Style override for the label text.

Styling hooks

Style props and theme keys

HookTypeDefaultDescription
style / labelStyleStyleProp—Direct overrides on the container and label.
theme.interactivetoken—Track fill and thumb color, from the active ListensTheme. Override via <ListensProvider theme={{ interactive: "…" }}>.
theme.tracktoken—The unfilled track color.

Behavior notes

  • All frameworks: The value is set from speech only when the phrase starts with the command; a slider never reacts to a number spoken on its own.
  • React Native: Dragging is implemented in pure RN — no extra native dependency to install.

Was this page helpful?