Toggle button & group

button[listensToggleButton] · listens-toggle-button-group@listenssoft/speechui-angular

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 Angular kit…

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

Angular
import { Component, signal } from "@angular/core";import {  ListensToggleButtonComponent,  ListensToggleButtonGroupComponent,} from "@listenssoft/speechui-angular";
@Component({  selector: "demo-toggle-buttons",  imports: [ListensToggleButtonComponent, ListensToggleButtonGroupComponent],  template: `    <div style="display: grid; gap: 8px; justify-items: start">      <listens-toggle-button-group>        <button          listensToggleButton          label="Day"          [checked]="view() === 'Day'"          (checkedChange)="$event && view.set('Day')"        ></button>        <button          listensToggleButton          label="Week"          [checked]="view() === 'Week'"          (checkedChange)="$event && view.set('Week')"        ></button>        <button          listensToggleButton          label="Month"          [checked]="view() === 'Month'"          (checkedChange)="$event && view.set('Month')"        ></button>      </listens-toggle-button-group>      <span>Showing: {{ view() }}</span>    </div>  `,})export class DemoToggleButtons {  view = signal("Day");}

A single toggle button

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

Loading the Angular kit…

Hold anywhere and say:“mute”

Props

  • default command
  • default false
Angular
Updates as you tick props
import { Component } from "@angular/core";import { ListensToggleButtonComponent } from "@listenssoft/speechui-angular";
@Component({  selector: "demo-toggle-button-single",  imports: [ListensToggleButtonComponent],  template: `    <button      listensToggleButton      label="Mute"      command="mute"      [(checked)]="muted"    ></button>  `,})export class DemoToggleButtonSingle {  muted = false;}

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

Angular inputs & outputs for @listenssoft/speechui-angular.

button[listensToggleButton] inputs

InputTypeDefaultDescription
listeningContentstringcommandText shown while the mic is open.
disabledbooleanfalseDisables the button.

The selector is an attribute on a native <button> so the group's adjacent-sibling CSS applies. Mutual exclusivity is coordinated by the parent listens-toggle-button-group (children inject it), not by a group id.

button[listensToggleButton] extra inputs

InputTypeDefaultDescription
checkedbooleanfalseTwo-way bindable — [(checked)].
labelstring""Button text; the command fallback.
commandstringlabelThe spoken command that activates the button.

Outputs

OutputTypeDefaultDescription
checkedChangeboolean—Emits the next pressed state — the [(checked)] channel.

Styling hooks

CSS hooks

HookTypeDefaultDescription
.listens-toggle-button / .listens-toggle-button-groupclass—Same classes as React; the attribute selector keeps the native button element.
data-checked / data-listeningattribute—State attributes for styling.

Was this page helpful?