Heading

new Heading(options) → {Class}

A heading component.

Parameters:
NameTypeDescription
optionsobject

The options for the heading component.

Properties
NameTypeDescription
contentstring

Content for the heading.

customClassesArray

An array of additional classes for the heading.

idstring

Id for the heading, auto generated if not passed.

renderedboolean

Is this heading already rendered in the dom, eg by php?

renderOnInitboolean

Render the heading on init of the class?

sizestring

Size string, check storybook for available ones.

spacingstring

The spacing classes to apply to the component.

tagNamestring

Tag for the heading, h1 if not passed.

targetstring

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

targetPositionstring

The insert position for the target.

weightstring

The font weight for the text.

Since
  • 2.2.0
Returns:

The Heading instance.

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

function Example() {
     const headingInstance = new Heading( {
         content: 'This is a heading',
         rendered: false,
         renderOnInit: true,
         tagName: 'h2',
         target: '#example-target',
     } );
}

Methods

(static) headingTemplate(options) → {string}

Generates the markup for a Heading Element in the admin.

Parameters:
NameTypeDescription
optionsobject

The options for the heading component.

Properties
NameTypeDescription
contentstring

Content for the heading.

customClassesArray

An array of additional classes for the heading.

idstring

Id for the heading, auto generated if not passed.

sizestring

Size string, check storybook for available ones.

spacingstring

Spacing for the component.

tagNamestring

Tag for the heading, h1 if not passed.

weightstring

The font weight for the heading, regular, semibold or bold.

Since
  • 2.2.0
Returns:
Type: 
string
Example
import { headingTemplate } from '@gravityforms/components/html/admin/elements/Heading';

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

Heading

new Heading(options) → {Class}

A text component.

Parameters:
NameTypeDescription
optionsobject

Component options.

Properties
NameTypeDescription
contentstring

The content for the text. Can contain html.

customClassesstring | Array | object

Custom classes to apply to the text.

idstring | Array | object

The id for the text div, auto genned if not supplied.

renderedstring

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

renderOnInitstring

Render the component on init of the class?

sizestring

Size string, check storybook for available ones.

spacingstring | number | Array | object

The spacing classes to apply.

tagNamestring

The tag used for the container element.

targetstring

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

targetPositionstring

The insert position for the component relative to the target.

weightstring

The font weight for the text.

Since
  • 2.2.0
Returns:

The text class instance.

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

function Example() {
     const labelInstance = new Text( {
         content: 'Text content',
         tagName: 'div',
         weight: 'regular',
         target: '#example-target',
     } );
}

Methods

(static) headingTemplate(options) → {string}

Generates the markup for a Heading Element in the admin.

Parameters:
NameTypeDescription
optionsobject

The options for the heading component.

Properties
NameTypeDescription
contentstring

Content for the heading.

customClassesArray

An array of additional classes for the heading.

idstring

Id for the heading, auto generated if not passed.

sizestring

Size string, check storybook for available ones.

spacingstring

Spacing for the component.

tagNamestring

Tag for the heading, h1 if not passed.

weightstring

The font weight for the heading, regular, semibold or bold.

Since
  • 2.2.0
Returns:
Type: 
string
Example
import { headingTemplate } from '@gravityforms/components/html/admin/elements/Heading';

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