Skip to content

API Reference / @gtkx/components / StatefulActionProps

Type Alias: StatefulActionProps<T> ​

StatefulActionProps<T> = StatefulActionBaseProps & object

Defined in: packages/components/src/types.ts:359

Props of a StatefulAction whose state is a boolean or a string, with the GVariant type inferred from the value. T narrows a string state to the application's own union of choices.

Type Parameters ​

T ​

T extends boolean | string = boolean | string

Type Declaration ​

onStateChange? ​

optional onStateChange?: ((state) => void) | null

Called with the state a menu item, a button or an activation requests; render it as state to accept it.

state ​

state: T

State the action reports: a boolean for a toggle, a string for a choice among item targets.

stateType? ​

optional stateType?: undefined