Toggle button & group

ListensToggleButton · ListensToggleButtonGroup@listenssoft/speechui-react-native

Press-to-activate buttons; grouped, they form a mutually-exclusive segmented control you can address by voice.

Say a button's label and it activates. Inside a group, activating one deactivates the others — a segmented control (“Day / Week / Month”) whose segments are each addressable by voice.

Exclusive group (segmented control)

Loading the React Native kit…

Hold anywhere and say:“week”“month”“day”

React Native
import {  ListensToggleButton,  ListensToggleButtonGroup,} from "@listenssoft/speechui-react-native";import { View, Text } from "react-native";import { useState } from "react";
function Demo() {  const [view, setView] = useState("Day");  const button = (label) => (    <ListensToggleButton      label={label}      checked={view === label}      onChange={(checked) => checked && setView(label)}    />  );  return (    <View style={{ gap: 8, alignItems: "flex-start" }}>      <ListensToggleButtonGroup>        {button("Day")}        {button("Week")}        {button("Month")}      </ListensToggleButtonGroup>      <Text>Showing: {view}</Text>    </View>  );}

A single toggle button

Outside a group it's an independent pressed state — speaking the command toggles it on and off.

Loading the React Native kit…

Hold anywhere and say:“mute”

Props

  • not set
React Native
Updates as you tick props
import { ListensToggleButton } from "@listenssoft/speechui-react-native";import { useState } from "react";
function Demo() {  const [muted, setMuted] = useState(false);  return (    <ListensToggleButton      label="Mute"      command="mute"      checked={muted}      onChange={setMuted}    />  );}

What you can say

SayEffect
“week”Activates the “Week” button; in a group, the others deactivate.
“…switch to week view…”Also matches (contains), claims permitting.
“mute (on a lone button)”Toggles the pressed state each time it's heard (with the ~1s cooldown between fires).

In a group, a spoken command activates its button but never deactivates it — speech re-selecting the active segment is a no-op, matching how segmented controls behave by pointer.

API reference

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

ListensToggleButton props

PropTypeDefaultDescription
disabledboolean—Disables the button.

Inside a ListensToggleButtonGroup, checking one button unchecks the others — exclusivity comes from the group component on native.

ListensToggleButton extra props

PropTypeDefaultDescription
label*string—Button text; the command fallback.
commandstringlabelThe spoken command that activates the button.
checkedboolean—Controlled pressed state.
onChange(checked: boolean) => void—Called with the next pressed state.
style / textStyleStyleProp—Container and label overrides.

ListensToggleButtonGroup props

PropTypeDefaultDescription
children*ReactNode—The buttons, laid out as one segmented control (shared border, 1px dividers, no gaps — matching the web group).
styleStyleProp<ViewStyle>—Group container override.

Styling hooks

Style props and theme keys

HookTypeDefaultDescription
style / textStyleStyleProp—Direct overrides.
theme.segmentOn / theme.segmentOnBorder / theme.buttonBordertoken—Active fill, active border, and the shared group border.

Was this page helpful?