Share Button for Vaadin
Adapter for navigator API
Vaadin Share Button
Vaadin Share Button is an add-on that integrates a share button into your Vaadin app using the native Web Share API. This allows users to easily share content to social media and messaging platforms.
Features
- Easy integration with Vaadin apps.
- Cross-platform: Works on mobile and desktop browsers.
- Customizable to fit your app's design.
Installation
Add the following to your pom.xml
:
<dependency>
<groupId>org.vaadin.addons.whosfritz</groupId>
<artifactId>vaadin-share-button</artifactId>
<version>0.0.3</version>
</dependency>
Usage
ShareButton shareButton = new ShareButton();
shareButton.setIcon(VaadinIcon.SHARE.create()); // Set the icon
shareButton.setText("Share this content"); // Set the button text
shareButton.setTitle("Share Button"); // Set the title
shareButton.setUrl("https://example.com"); // Set the URL to share
shareButton.addClickListener(event -> sharePage());
layout.add(shareButton);
Sample code
private static Button getShareButton() { ShareButton shareButton = new ShareButton(); shareButton.setShareIcon(VaadinIcon.SHARE); shareButton.setShareText("Teile den Speiseplan mit deinen Freunden"); shareButton.setShareTitle("MensaHub-Speiseplan"); shareButton.setTooltipText("Teile den Speiseplan mit deinen Freunden"); shareButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY); shareButton.addClickListener(buttonClickEvent -> { shareButton.sharePage(); }); return shareButton; }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Released
- 2024-09-13
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 20+
- Browser
- N/A
Share Button for Vaadin - Vaadin Add-on Directory
Adapter for navigator API## Vaadin Share Button
**Vaadin Share Button** is an add-on that integrates a share button into your Vaadin app using the native Web Share API. This allows users to easily share content to social media and messaging platforms.
### Features
- **Easy integration** with Vaadin apps.
- **Cross-platform**: Works on mobile and desktop browsers.
- **Customizable** to fit your app's design.
### Installation
Add the following to your `pom.xml`:
```xml
org.vaadin.addons.whosfritz
vaadin-share-button
0.0.3
```
### Usage
```java
ShareButton shareButton = new ShareButton();
shareButton.setIcon(VaadinIcon.SHARE.create()); // Set the icon
shareButton.setText("Share this content"); // Set the button text
shareButton.setTitle("Share Button"); // Set the title
shareButton.setUrl("https://example.com"); // Set the URL to share
shareButton.addClickListener(event -> sharePage());
layout.add(shareButton);
```