Website pieces
Install prompt
<kui-install-prompt> offers to install the web app on the device, where the browser allows it. It stays hidden until the browser fires its install event, and “Not now” hides it for 30 days in that browser.
Examples
The element
Place it once, near the top of the main content. An element with data-install-text inside replaces the keyed sentence. On this page the browser does not offer an install, so the element stays hidden.
HTML
<kui-install-prompt>
<span data-install-text hidden>Install Faktura to write invoices from your home screen, also offline.</span>
</kui-install-prompt>
How it looks
The same markup the element makes, drawn statically with .kui-install. On a phone the buttons move under the text.
Install Faktura to write invoices from your home screen, also offline.
Instalirajte aplikaciju da biste je otvarali s početnog ekrana, i bez mreže.
HTML
<div class="kui-install">
<div class="kui-install__icon"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#smartphone"></use></svg></div>
<p class="kui-install__text">Install Faktura to write invoices from your home screen, also offline.</p>
<div class="kui-install__actions">
<button class="kui-button kui-button--ghost kui-button--sm" type="button">Not now</button>
<button class="kui-button kui-button--primary kui-button--sm" type="button"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#download"></use></svg><span>Install</span></button>
</div>
</div>
<div class="kui-install" lang="sr-Latn">
<div class="kui-install__icon"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#smartphone"></use></svg></div>
<p class="kui-install__text">Instalirajte aplikaciju da biste je otvarali s početnog ekrana, i bez mreže.</p>
<div class="kui-install__actions">
<button class="kui-button kui-button--ghost kui-button--sm" type="button">Ne sada</button>
<button class="kui-button kui-button--primary kui-button--sm" type="button"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#download"></use></svg><span>Instaliraj</span></button>
</div>
</div>
Classes and attributes
<kui-install-prompt>- Hidden until the browser’s beforeinstallprompt event. Shows nothing when the app already runs installed, or for 30 days after “Not now”.
[data-install-text]- An element inside whose text replaces the keyed sentence.
.kui-install, __icon, __text, __actions- The look, for a static version on a help page.
Keyboard
- Tab
- Reaches Not now and Install.
Accessibility
- The prompt is in the page flow, not a dialog: it never takes focus or blocks the work.
- Install is the browser’s own confirmation; the person always has a second chance to say no.
- The dismissal is kept in local storage only; no data leaves the device.
Do and do not
Do
- Show it in a calm place, after the person has used the app once.
- Tell on the help page how to install on browsers without the event (Safari on iPhone: Share, then Add to Home Screen).
Do not
- Do not show it on the first visit of a public website.
- Do not show your own prompt when the browser has not fired the event: the install would fail.