Set the selected variant (Beta)
Set the selected variant (Beta)
component.setSelectedVariant(variant)
Selects the specified variant of a selected component when the component canvas is open.
To use this method, ensure that the component canvas is open and a variant is currently selected. Then, to specify the variant to select, pass one of these parameters:
- The ID of the variant as a string, as in
component.setSelectedVariant('secondary-hero') - The ID of the variant as the
idfield in an object, as incomponent.setSelectedVariant({ id: 'secondary-hero' }) - The name of the variant as the
namefield in an object, as incomponent.setSelectedVariant({ name: 'Secondary Hero' })
Beta
These methods are in public beta and may change with future releases.
Syntax
Returns
Promise<void>
A promise that resolves when the specified variant is selected.
Example
Designer Ability
Checks for authorization only