Skip to main content

Interface: UiToggleTouchButtonProps<S>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:15

Component props for UiToggleTouchButton.

Extends

  • Omit<ToggleTouchButtonProps<S>, "onTouched" | "onPressed" | "onHoldStarted" | "onHoldTick" | "onHoldEnded" | "focusOnDrag" | "class">

Type Parameters

Type Parameter
S extends Subscribable<boolean> | MutableSubscribable<boolean>

Properties

canBeFocused?

optional canBeFocused: boolean | Subscribable<boolean>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:124

Whether the button can be focused. Irrespective of this value, the button cannot be focused while it is disabled or not visible. Defaults to true.


children?

optional children: DisplayChildren[]

Defined in: src/sdk/components/FSComponent.ts:122

The children of the display component.

Inherited from

Omit.children


class?

optional class: string | ToggleableClassNameRecord | SubscribableSet<string>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:130

CSS class(es) to apply to the button's root element.


dragThresholdPx?

optional dragThresholdPx: number

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:156

The distance, in pixels, the mouse can click and drag before the pad begins to ignore mouse events. Ignored if inhibitOnDrag is false. Defaults to 40 pixels.

Inherited from

Omit.dragThresholdPx


focusController?

optional focusController: UiFocusController

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:118

A UI focus controller with which to automatically register the button after it is rendered. If not defined, then the button will not be automatically registered with any controller, but it may still be registered manually.


focusOnDrag?

optional focusOnDrag: boolean

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:94

Whether the pad should focus all mouse events when dragging, preventing them from bubbling up to any ancestors in the DOM tree. Defaults to true.


focusOptions?

optional focusOptions: Readonly<UiTouchButtonFocusModuleOptions>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:127

Options to configure the button's behavior related to UI focus.


gduFormat?

optional gduFormat: GduFormat

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:112

The format of the button's parent GDU display. Used to set the button's inhibit on drag threshold unless otherwise specified by the dragThresholdPx prop. Defaults to '460'.


inhibitOnDrag?

optional inhibitOnDrag: boolean

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:150

Whether the button should stop responding to mouse events and instead forward them to its parent after clicking and dragging for a certain distance defined by dragThresholdPx along the axis defined by inhibitOnDragAxis. When mouse events are inhibited, the button cannot be primed or held. Defaults to false.

Inherited from

Omit.inhibitOnDrag


inhibitOnDragAxis?

optional inhibitOnDragAxis: "both" | "x" | "y"

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:162

The axis along which dragging will trigger the inhibit function. Ignored if inhibitOnDrag is false. Defaults to 'both'.

Inherited from

Omit.inhibitOnDragAxis


isEnabled?

optional isEnabled: boolean | Subscribable<boolean>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:79

Whether the button is enabled, or a subscribable which provides it. Disabled buttons cannot be touched, primed, pressed, or held. Defaults to true.

Inherited from

Omit.isEnabled


isHighlighted?

optional isHighlighted: boolean | Subscribable<boolean>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:82

Whether the button is highlighted, or a subscribable which provides it. Defaults to false.

Inherited from

Omit.isHighlighted


isInList?

optional isInList: boolean

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:100

Whether the button is in a scrollable list. If true, will enable the inhibit on drag function unless otherwise specified by the inhibitOnDrag prop. Defaults to false.


isVisible?

optional isVisible: boolean | Subscribable<boolean>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:85

Whether the button is visible. Defaults to true.

Inherited from

Omit.isVisible


label?

optional label: string | VNode | Subscribable<string>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:94

The label for the button. Can be defined as either a static string, a subscribable which provides the label string, or a VNode. If not defined, the button will not have a label.

If the label is defined as a VNode, all first-level DisplayComponents in the VNode tree will be destroyed when the button is destroyed.

Inherited from

Omit.label


listScrollAxis?

optional listScrollAxis: "x" | "y"

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:106

The scroll axis of the button's parent list. Ignored if isInList is false. Sets the button's inhibit on drag axis unless otherwise specified by the inhibitOnDragAxis prop. Defaults to y.


onDestroy()?

optional onDestroy: () => void

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:165

A callback function which will be called when the button is destroyed.

Returns

void

Inherited from

Omit.onDestroy


onFocusGained()?

optional onFocusGained: <B>(button, direction) => void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:82

A function which is called when the button gains UI focus.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that gained UI focus.
directionUiFocusDirection-

Returns

void


onFocusLost()?

optional onFocusLost: <B>(button) => void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:88

A function which is called when the button loses UI focus.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that lost UI focus.

Returns

void


onHoldEnded()?

optional onHoldEnded: <B>(button, state, totalHoldDuration, endReason) => void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:71

A function which is called when the button exits the held state.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that was held.
stateSThe state that is bound to the button.
totalHoldDurationnumberThe total amount of time, in milliseconds, that the button was held.
endReasonTouchButtonHoldEndReasonThe reason that the button exited the held state.

Returns

void


onHoldStarted()?

optional onHoldStarted: <B>(button, state) => TouchButtonHoldAction

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:43

A function which is called when the button enters the held state. If not defined, then the button will default to taking no specific action when it enters the held state.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that is held.
stateSThe state that is bound to the button.

Returns

TouchButtonHoldAction

The action to take. Ignored if the value is equal to TouchButtonHoldAction.EndHold.


onHoldTick()?

optional onHoldTick: <B>(button, state, dt, totalTime, timeSinceLastPress) => TouchButtonHoldAction

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:56

A function which is called every frame when the button is held. If not defined, then the button will default to taking no specific action with each frame tick.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that is held.
stateSThe state that is bound to the button.
dtnumberThe elapsed time, in milliseconds, since the previous frame.
totalTimenumberThe total amount of time, in milliseconds, that the button has been held.
timeSinceLastPressnumberThe amount of time, in milliseconds, that the button has been held since the last time the button was pressed as a tick action.

Returns

TouchButtonHoldAction

The action to take.


onPressed()?

optional onPressed: <B>(button, state, isHeld) => void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:34

A callback function which will be called when the button is pressed. If not defined, pressing the button will toggle its bound state if the state is mutable.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that was pressed.
stateSThe state that is bound to the button.
isHeldbooleanWhether the button was held when it was pressed.

Returns

void


onTouched()?

optional onTouched: <B>(button, state) => TouchButtonOnTouchedAction

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/TouchButton/UiToggleTouchButton.tsx:25

A callback function which will be called every time the button is touched (i.e. a mouse down event on the button is detected). If not defined, then the button will default to entering the primed state when touched.

Type Parameters

Type ParameterDefault type
B extends UiToggleTouchButton<S>UiToggleTouchButton<S>

Parameters

ParameterTypeDescription
buttonBThe button that was touched.
stateSThe state that is bound to the button.

Returns

TouchButtonOnTouchedAction

The action to take as a result of the button being touched.


ref?

optional ref: NodeReference<any>

Defined in: src/sdk/components/FSComponent.ts:125

A reference to the display component.

Inherited from

Omit.ref


state

state: S

Defined in: src/garminsdk/components/touchbutton/ToggleTouchButton.tsx:13

A subscribable whose state will be bound to the button.

Inherited from

Omit.state