Share button
Share button using Web Share API.
Demo
Examples
<button type="button" is="x-share"
data-share-text="Message text"
data-share-title="Page title"
data-share-url="/path/to"
>Share</button>
Attributes
-
type
[optional] - This function automatically sets
type="button"
. However, it is recommended to manually addtype="button"
for JavaScript disabled environments and browsers that do not support Customized built-in elements (Safari 16, etc.). According to the description in the HTML specification,The missing value default and invalid value default are the Submit Button state
. -
data-share-text
[optional] - Arbitrary text that forms the body of the message being shared. If omitted, it will be an empty string.
-
data-share-title
[optional] - The title of the document being shared. May be ignored by the target. If omitted, the value of document.title will be set.
-
data-share-url
[optional] - A URL string referring to a resource being shared. The url can contain a relative-URL string. If omitted, the value of document.URL will be set.