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
Update banner
A quiet bar offering a new version: it never takes focus or blocks the page (role="status"). The app
sets state (available, downloading with progress,
ready, error) and listens for update and later; how the update is
fetched is up to it. floating pins it to the bottom end corner of the window.
Try it
Acme 2.4.0 is available
Restart to update
Later
Every state
Version 2.4.0 is available
Restart to update
Later
Downloading version 2.4.0…42%
Downloading version 2.4.0…
Version 2.4.0 is ready to install
Restart
Later
The update didn't install: the signature didn't match.
Try again
Later
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
Property
Attribute
Type
Default
Description
version
version
string
""
The version on offer, e.g. 1.3.0.
appName
app-name
string
""
The app's name: "HITOP 1.3.0 is available". Default: "Version 1.3.0 is available".
state
state
UpdateBannerState
"available"
>
progress
progress
number
-1
Download progress, 0 to 1, while downloading; leave unset (or negative) when the size isn't known.
error
error
string
""
What went wrong, for state="error".
floating
floating
boolean
false
Pins the bar to the bottom end corner of the viewport.
Events
Event
Description
update
The update button (Restart to update, Restart, Try again) was pressed.
later
Later was pressed: hide the bar (set hidden or remove it) and ask again another time.
Slots
Slot
Description
default
Replaces the message (e.g. a link to the release notes).
CSS parts
Part
Description
banner
The bar.
message
The text.
progress
The progress bar.
actions
The buttons' container.
CSS custom properties
Property
Description
--lit-material-update-banner-inset
Distance from the viewport edges when floating (default 16px).