Skip to content
PHP Ecosystem
Explore

RadialGradient

API reference › HTML SVG › RadialGradient

Represents the SVG <radialGradient> element for defining radial gradients.

Provides a concrete <radialGradient> element implementation that returns SvgBlock::RADIAL_GRADIENT and provides gradient and geometry attribute methods.

The <radialGradient> element defines a radial gradient that can be referenced by fill and stroke.

Usage example:

use UIAwesome\Html\Svg\{RadialGradient, Stop};
echo RadialGradient::tag()
->id('spot')
->cx('50%')
->cy('50%')
->r('50%')
->content(
Stop::tag()->offset('0%')->stopColor('#ffffff')->stopOpacity(1),
Stop::tag()->offset('100%')->stopColor('#000000')->stopOpacity(1),
)
->render();

See also: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/radialGradient (BaseBlock for the base block-level implementation.).

PropertyTypeDescriptionDefined by
$attributes protectedmixed[]HTML attributes array used by the implementing class. Default: [].UIAwesome\Html\Mixin\HasAttributes
$content protectedstringContent string assigned to the element. Default: ''.UIAwesome\Html\Mixin\HasContent
MethodDescriptionDefined by
__construct() finalInitializes a new tag instance.UIAwesome\Html\Core\Base\BaseTag
__toString()Returns the rendered tag string.UIAwesome\Html\Core\Base\BaseTag
accesskey()Sets the accesskey attribute.UIAwesome\Html\Attribute\Global\HasAccesskey
addAriaAttribute()Sets an aria-* attribute.UIAwesome\Html\Attribute\Global\HasAria
addAttribute()Adds or updates a single HTML attribute for the element.UIAwesome\Html\Mixin\HasAttributes
addDataAttribute()Sets a data-* attribute.UIAwesome\Html\Attribute\Global\HasData
addEvent()Sets an on* event attribute.UIAwesome\Html\Attribute\Global\HasEvents
ariaAttributes()Sets multiple aria-* attributes.UIAwesome\Html\Attribute\Global\HasAria
attributes()Adds or updates multiple HTML attributes for the element.UIAwesome\Html\Mixin\HasAttributes
autofocus()Sets the autofocus attribute.UIAwesome\Html\Attribute\Global\CanBeAutofocus
begin() finalStarts begin/end rendering for this instance.UIAwesome\Html\Core\Element\BaseBlock
class()Sets the class attribute.UIAwesome\Html\Attribute\Global\HasClass
clearContent()Clears encoded and raw content without changing other component state.UIAwesome\Html\Mixin\HasContent
config()Applies application-scoped config recipes to this tag.UIAwesome\Html\Core\Base\BaseTag
content()Appends encoded content.UIAwesome\Html\Mixin\HasContent
contentEditable()Sets the contenteditable attribute.UIAwesome\Html\Attribute\Global\HasContentEditable
cx()Sets the SVG cx attribute for the element.RadialGradient
cy()Sets the SVG cy attribute for the element.RadialGradient
dataAttributes()Sets multiple data-* attributes.UIAwesome\Html\Attribute\Global\HasData
dir()Sets the dir attribute.UIAwesome\Html\Attribute\Global\HasDir
draggable()Sets the draggable attribute.UIAwesome\Html\Attribute\Global\HasDraggable
end() static finalEnds the most recent begin/end rendering block for the current class.UIAwesome\Html\Core\Element\BaseBlock
events()Sets multiple on* event attributes.UIAwesome\Html\Attribute\Global\HasEvents
fr()Sets the SVG fr attribute for the element.RadialGradient
fx()Sets the SVG fx attribute for the element.RadialGradient
fy()Sets the SVG fy attribute for the element.RadialGradient
getAttribute()Returns the value of a single HTML attribute.UIAwesome\Html\Mixin\HasAttributes
getAttributes()Returns the array of HTML attributes for the element.UIAwesome\Html\Mixin\HasAttributes
getContent()Returns the content assigned to the element.UIAwesome\Html\Mixin\HasContent
gradientTransform()Sets the SVG gradientTransform attribute for the gradient element.RadialGradient
gradientUnits()Sets the SVG gradientUnits attribute for the gradient element.RadialGradient
hidden()Sets the hidden attribute.UIAwesome\Html\Attribute\Global\CanBeHidden
href()Sets the href attribute.RadialGradient
html()Appends trusted raw HTML content without encoding or sanitizing it.UIAwesome\Html\Mixin\HasContent
id()Sets the id attribute.UIAwesome\Html\Attribute\Global\HasId
itemId()Sets the itemid attribute.UIAwesome\Html\Attribute\Global\HasMicroData
itemProp()Sets the itemprop attribute.UIAwesome\Html\Attribute\Global\HasMicroData
itemRef()Sets the itemref attribute.UIAwesome\Html\Attribute\Global\HasMicroData
itemScope()Sets the itemscope attribute.UIAwesome\Html\Attribute\Global\HasMicroData
itemType()Sets the itemtype attribute.UIAwesome\Html\Attribute\Global\HasMicroData
lang()Sets the lang attribute.UIAwesome\Html\Attribute\Global\HasLang
opacity()Sets the SVG opacity attribute for the element.RadialGradient
r()Sets the SVG r attribute for the element.RadialGradient
removeAriaAttribute()Removes an aria-* attribute.UIAwesome\Html\Attribute\Global\HasAria
removeAttribute()Removes a specific HTML attribute from the element.UIAwesome\Html\Mixin\HasAttributes
removeDataAttribute()Removes a data-* attribute.UIAwesome\Html\Attribute\Global\HasData
removeEvent()Removes an on* event attribute.UIAwesome\Html\Attribute\Global\HasEvents
render() finalRenders the tag with lifecycle hooks.UIAwesome\Html\Core\Base\BaseTag
replaceAttributes()Replaces all HTML attributes for the element.UIAwesome\Html\Mixin\HasAttributes
role()Sets the role attribute.UIAwesome\Html\Attribute\Global\HasRole
spellcheck()Sets the spellcheck attribute.UIAwesome\Html\Attribute\Global\HasSpellcheck
spreadMethod()Sets the SVG spreadMethod attribute for the gradient element.RadialGradient
style()Sets the style attribute.UIAwesome\Html\Attribute\Global\HasStyle
tabIndex()Sets the tabindex attribute.UIAwesome\Html\Attribute\Global\HasTabindex
tag() staticCreates and configures a new tag instance.UIAwesome\Html\Core\Base\BaseTag
title()Sets the title attribute.UIAwesome\Html\Attribute\Global\HasTitle
translate()Sets the translate attribute.UIAwesome\Html\Attribute\Global\HasTranslate
afterRun() protectedPost-processes rendered output.UIAwesome\Html\Core\Event\HasAfterRun
beforeRun() protectedValidates state before rendering.UIAwesome\Html\Core\Event\HasBeforeRun
getTag() protectedReturns the tag enumeration for the <radialGradient> element.RadialGradient
isBeginExecuted() protectedIndicates whether this instance has an open or closing operation in the current context.UIAwesome\Html\Core\Element\BaseBlock
loadDefault() protectedReturns class-level default definitions.UIAwesome\Html\Core\Base\BaseTag
run() protectedRenders the block element.UIAwesome\Html\Core\Element\BaseBlock
runBegin() protectedReturns the opening tag for begin/end rendering.UIAwesome\Html\Core\Element\BaseBlock
public function cx(float|int|string|null $value): static

Sets the SVG cx attribute for the element.

Creates a new instance with the specified center x-coordinate value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullCenter x-coordinate value (for example, ‘50’, ‘50%’, or null to unset).

Returns

static: New instance with the updated cx attribute.

public function cy(float|int|string|null $value): static

Sets the SVG cy attribute for the element.

Creates a new instance with the specified center y-coordinate value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullCenter y-coordinate value (for example, ‘50’, ‘50%’, or null to unset).

Returns

static: New instance with the updated cy attribute.

public function fr(float|int|string|null $value): static

Sets the SVG fr attribute for the element.

Creates a new instance with the specified start circle radius value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullStart circle radius value (for example, ‘25’, ‘50%’, or null to unset).

Returns

static: New instance with the updated fr attribute.

public function fx(float|int|string|null $value): static

Sets the SVG fx attribute for the element.

Creates a new instance with the specified start circle x-coordinate value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullStart circle x-coordinate value (for example, ‘50’, ‘50%’, or null to unset).

Returns

static: New instance with the updated fx attribute.

public function fy(float|int|string|null $value): static

Sets the SVG fy attribute for the element.

Creates a new instance with the specified start circle y-coordinate value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullStart circle y-coordinate value (for example, ‘50’, ‘50%’, or null to unset).

Returns

static: New instance with the updated fy attribute.

public function gradientTransform(string|null $value): static

Sets the SVG gradientTransform attribute for the gradient element.

Creates a new instance with the specified gradient transform value for the rendered element.

Parameters

ParameterTypeDescription
$valuestring|nullTransform value (for example, ‘rotate(45)’, ‘scale(2)’, or null to unset).

Returns

static: New instance with the updated gradientTransform attribute.

public function gradientUnits(UIAwesome\Html\Svg\Values\CoordinateUnits|string|null $value): static

Sets the SVG gradientUnits attribute for the gradient element.

Creates a new instance with the specified gradient units value for the rendered element.

Parameters

ParameterTypeDescription
$valueUIAwesome\Html\Svg\Values\CoordinateUnits|string|nullGradient units value (for example, ‘userSpaceOnUse’, CoordinateUnits enum, or null to unset).

Returns

static: New instance with the updated gradientUnits attribute.

Throws

public function href(string|Stringable|UnitEnum|null $value): static

Sets the href attribute.

Usage example:

$element->href('#gradient');
$element->href(null);

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullURL, path, or fragment, or null to remove the attribute.

Returns

static: New instance with the updated href attribute.

public function opacity(float|int|string|null $value): static

Sets the SVG opacity attribute for the element.

Creates a new instance with the specified opacity value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullOpacity value (for example, ‘0.5’ or null to unset).

Returns

static: New instance with the updated opacity attribute.

Throws

public function r(float|int|string|null $value): static

Sets the SVG r attribute for the element.

Creates a new instance with the specified radius value for the rendered element.

Parameters

ParameterTypeDescription
$valuefloat|int|string|nullRadius value (for example, ‘25’, ‘50%’, or null to unset).

Returns

static: New instance with the updated r attribute.

public function spreadMethod(UIAwesome\Html\Svg\Values\SpreadMethod|string|null $value): static

Sets the SVG spreadMethod attribute for the gradient element.

Creates a new instance with the specified spread method value for the rendered element.

Parameters

ParameterTypeDescription
$valueUIAwesome\Html\Svg\Values\SpreadMethod|string|nullSpread method value (for example, ‘pad’, SpreadMethod enum, or null to unset).

Returns

static: New instance with the updated spreadMethod attribute.

Throws

protected function getTag(): BackedEnum

Returns the tag enumeration for the <radialGradient> element.

Returns

BackedEnum: Tag enumeration instance for <radialGradient>. SvgBlock for valid SVG block-level tags.