StackedIcon

new StackedIcon(options) → {Class}

A stackedIcon component .

Parameters:
NameTypeDescription
optionsobject

The options for the component.

Properties
NameTypeDescription
customAttributesobject

Any custom attributes for the component.

customClassesArray

An array of additional classes for the component.

idstring

Id for the component, auto generated if not passed.

renderedstring

Is the component already rendered in the dom, eg by php?

renderOnInitstring

Render the component on init of the class?

spacingstring

Spacing for the component.

targetstring

The target to render to. Any valid css selector string.

targetPositionstring

The insert position for the component relative to the target.

themestring

Theme for the component, primary or cosmos.

Since
  • 1.1.16
Returns:

The class instance.

Type: 
Class
Example
import StackedIcon from '@gravityforms/components/html/admin/elements/StackedIcon';

function Example() {
     const stackedIconInstance = new StackedIcon( {
         id: 'example-stackedIcon',
         renderOnInit: false,
         target: '#example-target',
         targetPosition: 'beforeend',
         theme: 'cosmos',
     } );

     // Some time later we can render it. This is only done if we set renderOnInit to false.
     // If true it will render on initialization.
     stackedIconInstance.init();
}

Methods

(static) init() → {void}

Initialize the component.

Since
  • 1.1.16
Returns:
Type: 
void

(static) render() → {void}

Renders the component into the dom.

Since
  • 1.1.16
Returns:
Type: 
void

(static) stackedIconTemplate(options) → {string}

Generates the markup for a stackedIcon in the admin.

Parameters:
NameTypeDescription
optionsobject

The options for the component template.

Properties
NameTypeDescription
customAttributesobject

Any custom attributes.

customClassesArray

An array of additional classes for the toggle.

idstring

Id for the stackedIcon, auto generated if not passed.

spacingstring | number | Array | object

The spacing for the component, string, number, object or array.

tagNamestring

Tag to use for the icon wrapper. Defaults to 'span',

themestring

Theme for the toggle, primary or cosmos.

typestring

The icon name string.

Since
  • 1.1.16
Returns:
Type: 
string
Example
import { stackedIconTemplate } from '@gravityforms/components/html/admin/elements/StackedIcon';

function Example() {
     const stackedIconTemplateHTML = stackedIconTemplateTemplate( options );
     document.body.insertAdjacentHTML( 'beforeend', stackedIconTemplateHTML );
}