Class ShareContent
java.lang.Object
com.vaadin.flow.component.webshare.ShareContent
- All Implemented Interfaces:
Serializable
Payload for
WebShareBinding.share(com.vaadin.flow.component.webshare.ShareContent). Any combination of title,
text, and url can be set; the Web Share API requires at least
one of them to be present.
Use the static factory:
WebShare.onClick(button).share(ShareContent.create().title("Hello")
.text("World").url("https://vaadin.com"));
- Since:
- 25.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ShareContentcreate()Creates a new empty content builder.<C extends Component & HasValue<?,String>>
ShareContenttext(C source) Sets the free-form text of the share payload, taken from thevalueproperty of the given component.Sets the free-form text of the share payload.<C extends Component & HasValue<?,String>>
ShareContenttitle(C source) Sets the title of the share payload, taken from thevalueproperty of the given component (typically an input field).Sets the title of the share payload.<C extends Component & HasValue<?,String>>
ShareContenturl(C source) Sets the URL of the share payload, taken from thevalueproperty of the given component.Sets the URL of the share payload.
-
Method Details
-
create
Creates a new empty content builder.- Returns:
- a new builder
-
title
Sets the title of the share payload.- Parameters:
literal- the value, notnull- Returns:
- this builder
-
title
Sets the title of the share payload, taken from thevalueproperty of the given component (typically an input field). The value is read on the client when the trigger fires.- Type Parameters:
C- component type implementingHasValue<?, String>- Parameters:
source- the component whosevalueproperty should be read, notnull- Returns:
- this builder
-
text
Sets the free-form text of the share payload.- Parameters:
literal- the value, notnull- Returns:
- this builder
-
text
Sets the free-form text of the share payload, taken from thevalueproperty of the given component. The value is read on the client when the trigger fires.- Type Parameters:
C- component type implementingHasValue<?, String>- Parameters:
source- the component whosevalueproperty should be read, notnull- Returns:
- this builder
-
url
Sets the URL of the share payload.- Parameters:
literal- the value, notnull- Returns:
- this builder
-
url
Sets the URL of the share payload, taken from thevalueproperty of the given component. The value is read on the client when the trigger fires.- Type Parameters:
C- component type implementingHasValue<?, String>- Parameters:
source- the component whosevalueproperty should be read, notnull- Returns:
- this builder
-