Typography Control

Elementor typography group control displays input fields to define the content typography including font size, font family, font weight, text transform, font style, line height and letter spacing.

The control is defined in Group_Control_Typography class which extends Group_Control_Base class.

Note that when using group controls, the type should be set using the Group_Control_Typography::get_type() method.

Arguments

Name Type Default Description
type string typography The type of the control.
label string The label that appears above of the field.
description string The description that appears below the field.
show_label bool true Whether to display the label.
label_block bool false Whether to display the label in a separate line.
separator string default Set the position of the control separator. Available values are defaultbeforeafter and nonedefault will position the separator depending on the control type. before / after will position the separator before/after the control. none will hide the separator.
scheme string The typography scheme to display in the control.

Return Value

(array) An array containing the typography values.

Usage

<?php
class Elementor_Test_Widget extends \Elementor\Widget_Base {

	protected function _register_controls() {

		$this->start_controls_section(
			'content_section',
			[
				'label' => __( 'Content', 'plugin-name' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'content_typography',
				'label' => __( 'Typography', 'plugin-domain' ),
				'scheme' => Scheme_Typography::TYPOGRAPHY_1,
				'selector' => '{{WRAPPER}} .text',
			]
		);

		$this->end_controls_section();

	}

	protected function render() {
		$settings = $this->get_settings_for_display();
		echo '<div class="text"> ... </div>';
	}

	protected function _content_template() {
		?>
		<div class="text"> ... </div>
		<?php
	}

}