Update Banner

Update banner web component: "Version X is available · Restart to update · Later", with download progress, ready and error states.

  • 5.7 KB gzipped
  • @lit-material/update-banner 1.8.0
  • Renders on the server

Example

Install

npm install @lit-material/update-banner @lit-material/tokens
import "@lit-material/update-banner";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-update-banner>

A quiet bar that offers a new version of an app: "Version 1.3.0 is available · Restart to update · Later". It never takes focus or blocks the page (role="status", not a dialog), and has nothing to do with how the update is fetched: the app sets state and progress and listens for update and later.

Properties

PropertyAttributeTypeDefaultDescription
versionversionstring""The version on offer, e.g. 1.3.0.
appNameapp-namestring""The app's name: "HITOP 1.3.0 is available". Default: "Version 1.3.0 is available".
statestateUpdateBannerState"available"
progressprogressnumber-1Download progress, 0 to 1, while downloading; leave unset (or negative) when the size isn't known.
errorerrorstring""What went wrong, for state="error".
floatingfloatingbooleanfalsePins the bar to the bottom end corner of the viewport.

Events

EventDescription
updateThe update button (Restart to update, Restart, Try again) was pressed.
laterLater was pressed: hide the bar (set hidden or remove it) and ask again another time.

Slots

SlotDescription
defaultReplaces the message (e.g. a link to the release notes).

CSS parts

PartDescription
bannerThe bar.
messageThe text.
progressThe progress bar.
actionsThe buttons' container.

CSS custom properties

PropertyDescription
--lit-material-update-banner-insetDistance from the viewport edges when floating (default 16px).

Source on GitHub npm