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.).
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$attributes protected | mixed[] | HTML attributes array used by the implementing class. Default: []. | UIAwesome\ |
$content protected | string | Content string assigned to the element. Default: ''. | UIAwesome\ |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() final | Initializes a new tag instance. | UIAwesome\ |
__toString() | Returns the rendered tag string. | UIAwesome\ |
accesskey() | Sets the accesskey attribute. | UIAwesome\ |
addAriaAttribute() | Sets an aria-* attribute. | UIAwesome\ |
addAttribute() | Adds or updates a single HTML attribute for the element. | UIAwesome\ |
addDataAttribute() | Sets a data-* attribute. | UIAwesome\ |
addEvent() | Sets an on* event attribute. | UIAwesome\ |
ariaAttributes() | Sets multiple aria-* attributes. | UIAwesome\ |
attributes() | Adds or updates multiple HTML attributes for the element. | UIAwesome\ |
autofocus() | Sets the autofocus attribute. | UIAwesome\ |
begin() final | Starts begin/end rendering for this instance. | UIAwesome\ |
class() | Sets the class attribute. | UIAwesome\ |
clearContent() | Clears encoded and raw content without changing other component state. | UIAwesome\ |
config() | Applies application-scoped config recipes to this tag. | UIAwesome\ |
content() | Appends encoded content. | UIAwesome\ |
contentEditable() | Sets the contenteditable attribute. | UIAwesome\ |
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\ |
dir() | Sets the dir attribute. | UIAwesome\ |
draggable() | Sets the draggable attribute. | UIAwesome\ |
end() static final | Ends the most recent begin/end rendering block for the current class. | UIAwesome\ |
events() | Sets multiple on* event attributes. | UIAwesome\ |
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\ |
getAttributes() | Returns the array of HTML attributes for the element. | UIAwesome\ |
getContent() | Returns the content assigned to the element. | UIAwesome\ |
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\ |
href() | Sets the href attribute. | RadialGradient |
html() | Appends trusted raw HTML content without encoding or sanitizing it. | UIAwesome\ |
id() | Sets the id attribute. | UIAwesome\ |
itemId() | Sets the itemid attribute. | UIAwesome\ |
itemProp() | Sets the itemprop attribute. | UIAwesome\ |
itemRef() | Sets the itemref attribute. | UIAwesome\ |
itemScope() | Sets the itemscope attribute. | UIAwesome\ |
itemType() | Sets the itemtype attribute. | UIAwesome\ |
lang() | Sets the lang attribute. | UIAwesome\ |
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\ |
removeAttribute() | Removes a specific HTML attribute from the element. | UIAwesome\ |
removeDataAttribute() | Removes a data-* attribute. | UIAwesome\ |
removeEvent() | Removes an on* event attribute. | UIAwesome\ |
render() final | Renders the tag with lifecycle hooks. | UIAwesome\ |
replaceAttributes() | Replaces all HTML attributes for the element. | UIAwesome\ |
role() | Sets the role attribute. | UIAwesome\ |
spellcheck() | Sets the spellcheck attribute. | UIAwesome\ |
spreadMethod() | Sets the SVG spreadMethod attribute for the gradient element. | RadialGradient |
style() | Sets the style attribute. | UIAwesome\ |
tabIndex() | Sets the tabindex attribute. | UIAwesome\ |
tag() static | Creates and configures a new tag instance. | UIAwesome\ |
title() | Sets the title attribute. | UIAwesome\ |
translate() | Sets the translate attribute. | UIAwesome\ |
afterRun() protected | Post-processes rendered output. | UIAwesome\ |
beforeRun() protected | Validates state before rendering. | UIAwesome\ |
getTag() protected | Returns the tag enumeration for the <radialGradient> element. | RadialGradient |
isBeginExecuted() protected | Indicates whether this instance has an open or closing operation in the current context. | UIAwesome\ |
loadDefault() protected | Returns class-level default definitions. | UIAwesome\ |
run() protected | Renders the block element. | UIAwesome\ |
runBegin() protected | Returns the opening tag for begin/end rendering. | UIAwesome\ |
Method details
Section titled “Method details”public function cx(float|int|string|null $value): staticSets the SVG cx attribute for the element.
Creates a new instance with the specified center x-coordinate value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Center 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): staticSets the SVG cy attribute for the element.
Creates a new instance with the specified center y-coordinate value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Center 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): staticSets the SVG fr attribute for the element.
Creates a new instance with the specified start circle radius value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Start 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): staticSets the SVG fx attribute for the element.
Creates a new instance with the specified start circle x-coordinate value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Start 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): staticSets the SVG fy attribute for the element.
Creates a new instance with the specified start circle y-coordinate value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Start circle y-coordinate value (for example, ‘50’, ‘50%’, or null to unset). |
Returns
static: New instance with the updated fy attribute.
gradientTransform()
Section titled “gradientTransform() ”public function gradientTransform(string|null $value): staticSets the SVG gradientTransform attribute for the gradient element.
Creates a new instance with the specified gradient transform value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string| | Transform value (for example, ‘rotate(45)’, ‘scale(2)’, or null to unset). |
Returns
static: New instance with the updated gradientTransform attribute.
gradientUnits()
Section titled “gradientUnits() ”public function gradientUnits(UIAwesome\Html\Svg\Values\CoordinateUnits|string|null $value): staticSets the SVG gradientUnits attribute for the gradient element.
Creates a new instance with the specified gradient units value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | UIAwesome\| | Gradient units value (for example, ‘userSpaceOnUse’, CoordinateUnits enum, or null to unset). |
Returns
static: New instance with the updated gradientUnits attribute.
Throws
InvalidArgumentException: If the provided value is not a validCoordinateUnitsenum or string.
href()
Section titled “href() ”public function href(string|Stringable|UnitEnum|null $value): staticSets the href attribute.
Usage example:
$element->href('#gradient');$element->href(null);Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | URL, path, or fragment, or null to remove the attribute. |
Returns
static: New instance with the updated href attribute.
opacity()
Section titled “opacity() ”public function opacity(float|int|string|null $value): staticSets the SVG opacity attribute for the element.
Creates a new instance with the specified opacity value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Opacity value (for example, ‘0.5’ or null to unset). |
Returns
static: New instance with the updated opacity attribute.
Throws
InvalidArgumentException: If the value is outside the allowed range (‘0’-‘1’) and notnull.
public function r(float|int|string|null $value): staticSets the SVG r attribute for the element.
Creates a new instance with the specified radius value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Radius value (for example, ‘25’, ‘50%’, or null to unset). |
Returns
static: New instance with the updated r attribute.
spreadMethod()
Section titled “spreadMethod() ”public function spreadMethod(UIAwesome\Html\Svg\Values\SpreadMethod|string|null $value): staticSets the SVG spreadMethod attribute for the gradient element.
Creates a new instance with the specified spread method value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | UIAwesome\| | Spread method value (for example, ‘pad’, SpreadMethod enum, or null to unset). |
Returns
static: New instance with the updated spreadMethod attribute.
Throws
InvalidArgumentException: If the provided value is not a validSpreadMethodenum or string.
getTag()
Section titled “getTag() ”protected function getTag(): BackedEnumReturns the tag enumeration for the <radialGradient> element.
Returns
BackedEnum: Tag enumeration instance for <radialGradient>. SvgBlock for valid SVG block-level tags.