Label

new Label(options) → {Class}

A label component with optional header area to contain a group of html elements.

Parameters:
NameTypeDescription
optionsobject

Component options.

Properties
NameTypeDescription
customAttributesobject

Custom attributes for the component.

customClassesstring | Array | object

Custom classes for the component.

htmlForstring

The for attribute for the label.

isVisibleboolean

If label is visible (true) or hidden (false).

renderedboolean

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

renderOnInitboolean

Render the label on init of the class?

labelstring

Label text.

sizestring

The font size for the label.

spacingstring | number | Array | object

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

targetstring

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

targetPositionstring

The insert position for the target.

weightstring

The font weight for the label.

Since
  • 2.2.0
Returns:

The Label instance.

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

function Example() {
     const labelInstance = new Label( {
         label: 'Label text',
         htmlFor: 'input-id',
         target: '#example-target',
     } );
}