1.6.7 • Published 4 years ago

@pwabuilder/pwainstall v1.6.7

Weekly downloads
461
License
ISC
Repository
-
Last release
4 years ago

pwa-install

CI

pwa-install is a web component from the PWABuilder team that brings an awesome "install" experience to your Progressive Web App!

Built with lit-element

What does it look like?

Supported Browsers

  • Edge
  • Chrome
  • Firefox
  • Safari

Using this component

Install

There are two ways to use this component. For simple projects or just to get started fast, we recommend using the component by script tag. If your project is using npm then we recommend using the npm package.

Script tag

  • Put this script tag in the head of your index.html:
<script
  type="module"
  src="https://cdn.jsdelivr.net/npm/@pwabuilder/pwainstall"
></script>

NPM

  • Run npm install @pwabuilder/pwainstall
  • import with import '@pwabuilder/pwainstall'

Then you can use the element <pwa-install></pwa-install> anywhere in your template, JSX, html etc. live demo: https://pwainstall.glitch.me

API

Properties

PropertyAttributeDescriptionTypeDefault
showopenshowopenWill always show the install buttonbooleanfalse
usecustomusecustomHides default buttonbooleanfalse
manifestpathmanifestpathpath to your web manifeststringmanifest.json
explainerexplainerControls the text of the explainer text just below the titlee of the app headerstringThis app can be installed on
featuresheaderfeaturesheaderControls the text of the features headerstringKey Features
descriptionheaderdescriptionheaderControls the text of the description headerstringDescription
installbuttontextinstallbuttontextControls the text of the install buttonstringInstall
cancelbuttontextcancelbuttontextControls the text of the cancel buttonstringCancel
iosinstallinfotextiosinstallinfotextControls the iOS installation info textstringTap the share button and then 'Add to Homescreen'

Methods

nameDescription
openPrompt()Opens the install modal
closePrompt()Closes the install modal
getInstalledStatus()Tell if the PWA is installed or not

Styling

CSS Variables

We recommend using our CSS variables to easliy tweak the style of this component to fit your project. Here are our current supported CSS variables.

nameDescription
--install-button-colorChanges the color of the install button
--modal-z-indexChanges the z-index of the install modal
--modal-background-indexChanges the z-index of the install modal background
--modal-background-colorChanges the background color of the install modal

Shadow Parts

If you need to style this component more comprehensively, you can use Shadow Parts to style both the install button and the install modal. To target these two elements you can use pwa-install::part(openButton) and pwa-install::part(installModal) respectively. For example, to make the background of the install button grey, I would need this CSS:

pwa-install::part(openButton) {
  background: grey;
}
1.6.7

4 years ago

1.6.6

4 years ago

1.6.5

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.11

4 years ago

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.10.0

4 years ago

0.9.10

5 years ago

0.9.9

5 years ago

0.9.8

5 years ago

0.9.7

5 years ago

0.9.5

5 years ago

0.9.4

5 years ago

0.9.3

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago