Skip to content
PHP Ecosystem
Explore

Track

API reference › HTML › Embedded › Track

Renders the HTML <track> element for timed text tracks in media.

See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/track (BaseVoid for the base implementation.).

PropertyTypeDescriptionDefined by
$attributes protectedmixed[]HTML attributes array used by the implementing class. Default: [].UIAwesome\Html\Mixin\HasAttributes
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
class()Sets the class attribute.UIAwesome\Html\Attribute\Global\HasClass
config()Applies application-scoped config recipes to this tag.UIAwesome\Html\Core\Base\BaseTag
dataAttributes()Sets multiple data-* attributes.UIAwesome\Html\Attribute\Global\HasData
default()Sets the default attribute.Track
dir()Sets the dir attribute.UIAwesome\Html\Attribute\Global\HasDir
events()Sets multiple on* event attributes.UIAwesome\Html\Attribute\Global\HasEvents
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
hidden()Sets the hidden attribute.UIAwesome\Html\Attribute\Global\CanBeHidden
id()Sets the id attribute.UIAwesome\Html\Attribute\Global\HasId
kind()Sets the kind attribute.Track
label()Sets the label attribute.UIAwesome\Html\Attribute\HasLabel
lang()Sets the lang attribute.UIAwesome\Html\Attribute\Global\HasLang
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
src()Sets the src attribute.Track
srclang()Sets the srclang attribute.Track
style()Sets the style attribute.UIAwesome\Html\Attribute\Global\HasStyle
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 <track> element.Track
loadDefault() protectedReturns class-level default definitions.UIAwesome\Html\Core\Base\BaseTag
run() protectedRenders the void element.UIAwesome\Html\Core\Element\BaseVoid
public function default(bool|null $value): static

Sets the default attribute.

Parameters

ParameterTypeDescription
$valuebool|nullDefault state. Use true to enable, false to disable, or null to remove the attribute.

Returns

static: New instance with the updated default attribute.

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

Sets the kind attribute.

Parameters

ParameterTypeDescription
$valuestring|UnitEnum|nullTrack kind (‘subtitles’, ‘captions’, ‘descriptions’, ‘chapters’, or ‘metadata’), or null to remove the attribute.

Returns

static: New instance with the updated kind attribute. Kind for predefined enum values.

Throws

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

Sets the src attribute.

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullImage source URL or path, or null to remove the attribute.

Returns

static: New instance with the updated src attribute.

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

Sets the srclang attribute.

Parameters

ParameterTypeDescription
$valuestring|UnitEnum|nullBCP 47 language tag, or null to remove the attribute.

Returns

static: New instance with the updated srclang attribute.

protected function getTag(): UIAwesome\Html\Interop\Voids

Returns the tag enumeration for the <track> element.

Returns

Voids: Tag enumeration instance for <track>. Voids for valid void-level tags.