Marker
API reference › HTML SVG › Marker
Represents the SVG <marker> element for defining arrowheads and other markers.
Provides a concrete <marker> element implementation that returns SvgBlock::MARKER and provides marker, view,
and presentation attribute methods.
The <marker> element defines a marker that can be attached to lines, polylines, and polygons.
Usage example:
use UIAwesome\Html\Svg\{Marker, Path};
echo Marker::tag() ->id('arrow') ->viewBox('0 0 10 10') ->refX(10)->refY(5) ->markerWidth(6)->markerHeight(6) ->orient('auto') ->content(Path::tag()->d('M0 0 L10 5 L0 10 z')->fill('currentColor')) ->render();See also: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker (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 details
Section titled “Method details”markerHeight()
Section titled “markerHeight() ”public function markerHeight(float|int|string|null $value): staticSets the SVG markerHeight attribute for the marker element.
Creates a new instance with the specified marker height value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Marker height value (for example, ‘3’, ‘10%’, or null to unset). |
Returns
static: New instance with the updated markerHeight attribute.
markerUnits()
Section titled “markerUnits() ”public function markerUnits(UIAwesome\Html\Svg\Values\MarkerUnits|string|null $value): staticSets the SVG markerUnits attribute for the marker element.
Creates a new instance with the specified marker units value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | UIAwesome\| | Marker units value (for example, ‘strokeWidth’, MarkerUnits enum, or null to unset). |
Returns
static: New instance with the updated markerUnits attribute.
Throws
InvalidArgumentException: If the provided value is not a validMarkerUnitsenum or string.
markerWidth()
Section titled “markerWidth() ”public function markerWidth(float|int|string|null $value): staticSets the SVG markerWidth attribute for the marker element.
Creates a new instance with the specified marker width value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Marker width value (for example, ‘3’, ‘10%’, or null to unset). |
Returns
static: New instance with the updated markerWidth 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.
orient()
Section titled “orient() ”public function orient(float|int|UIAwesome\Html\Svg\Values\Orient|string|null $value): staticSets the SVG orient attribute for the marker element.
Creates a new instance with the specified orientation value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float|UIAwesome\| | Orient value (for example, ‘auto’, Orient enum, ‘45’, or null to unset). |
Returns
static: New instance with the updated orient attribute.
preserveAspectRatio()
Section titled “preserveAspectRatio() ”public function preserveAspectRatio(UIAwesome\Html\Svg\Values\PreserveAspectRatio|string|null $value): staticSets the SVG preserveAspectRatio attribute for the element.
Creates a new instance with the specified preserve aspect ratio value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | UIAwesome\| | Preserve aspect ratio value (for example, ‘xMidYMid meet’, PreserveAspectRatio enum, or null to unset). |
Returns
static: New instance with the updated preserveAspectRatio attribute.
Throws
InvalidArgumentException: If the provided value is not a validPreserveAspectRatioenum or string.
refX()
Section titled “refX() ”public function refX(float|int|string|null $value): staticSets the SVG refX attribute for the marker element.
Creates a new instance with the specified reference x coordinate value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Reference x coordinate value (for example, ‘0’, ‘50%’, or null to unset). |
Returns
static: New instance with the updated refX attribute.
refY()
Section titled “refY() ”public function refY(float|int|string|null $value): staticSets the SVG refY attribute for the marker element.
Creates a new instance with the specified reference y coordinate value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | float| | Reference y coordinate value (for example, ‘0’, ‘50%’, or null to unset). |
Returns
static: New instance with the updated refY attribute.
transform()
Section titled “transform() ”public function transform(string|null $value): staticSets the SVG transform attribute for the element.
Creates a new instance with the specified 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 transform attribute.
viewBox()
Section titled “viewBox() ”public function viewBox(string|null $value): staticSets the SVG viewBox attribute for the element.
Creates a new instance with the specified view box value for the rendered element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string| | ViewBox value (for example, ‘0 0 100 100’, or null to unset). |
Returns
static: New instance with the updated viewBox attribute.
getTag()
Section titled “getTag() ”protected function getTag(): BackedEnumReturns the tag enumeration for the <marker> element.
Returns
BackedEnum: Tag enumeration instance for <marker>. SvgBlock for valid SVG block-level tags.