# elementor/4.3.0-beta3/modules/components/variants/component-variant.php

Elementor Website Builder – more than just a page builder, version 4.3.0-beta3. 47 lines.

- Page: https://pluginprobe.com/plugins/elementor/4.3.0-beta3/code/modules/components/variants/component-variant.php
- Raw: https://pluginprobe.com/plugins/elementor/4.3.0-beta3/raw/modules/components/variants/component-variant.php
- Modified: 2026-09-01T11:47:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elementor/4.3.0-beta3/code/modules/components/variants/component-variant.php#L10-L20`.

```php
<?php

namespace Elementor\Modules\Components\Variants;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Component_Variant {
	/** @var string */
	public $id;

	/** @var string */
	public $label;

	/**
	 * Widget entries keyed by element id. Each entry may include:
	 * - `settings.classes.add`: string[] of class ids to add on top of the base
	 * - `variant`: string id of a nested component variant to apply
	 *
	 * @var array<string, array>
	 */
	public $widgets;

	public function __construct( string $id, string $label, array $widgets ) {
		$this->id = $id;
		$this->label = $label;
		$this->widgets = $widgets;
	}

	public static function make( array $variant ): self {
		return new self(
			$variant['id'],
			$variant['label'],
			$variant['widgets'] ?? []
		);
	}

	public function to_associative_array(): array {
		return [
			'id' => $this->id,
			'label' => $this->label,
			'widgets' => $this->widgets,
		];
	}
}

```
