Add overlays to your page, with a simple clean overlay component, or something a bit more specific like a modal, picker, loader or notification. Choose from many overlays already configured, or create your own using the base overlay.
<cwc-overlay-authentication>
Custom Web Component, authentication overlay, helps with login, logout, authorisation, registration. password reset.
Adds an overlay system to the page handling all authentication requirements, requires compatible API (GenericLAPI).
change
The user data has changed, send user data as event detail.
login()
Open the login overlay and wait for login.
authenticate()
Open the authenticate overlay and wait fo rauthentication to happen.
terminate()
Log the user out and terminate authentication.
Object route
The route object form cwc-resource-router.
reset-route
string
The route/path to the reset endpoint on the api.
register-route
string
The route/path to the register endpoint on the api.
activate-route
string
The route/path to the activate endpoint on the api.
system-key
string
The key to use for prefixing the local storage data, such as 'my-app' or the DNS name.
system-version
string
The version to output in the overlays as a footer.
api-url
string
The URL of the API used before the routes above, such as http://my-app.com.
--cwc-overlay-authentication--transition-duration
The transition duration of the authentication overlay as 1s or 500ms.--cwc-overlay-authentication--z-index
The z-index of the authentication overlay.--cwc-overlay-authentication--backdrop--background
The backdrop background colour.--cwc-overlay-authentication--backdrop--opacity
The backdrop opacity.--cwc-overlay-authentication--backdrop--z-index
The backdrop z-index (higher than authentication).--cwc-overlay-authentication--box--background
The login/reset/registration box background.--cwc-overlay-authentication--box--border-radius
The login/reset/registration box border-radius.--cwc-overlay-authentication--box--box-shadow
The login/reset/registration box box-shadow.--cwc-overlay-authentication--box--color
The login/reset/registration box text colour.--cwc-overlay-authentication--box--left
The login/reset/registration box left position.--cwc-overlay-authentication--box--max-width
The login/reset/registration box max-width.--cwc-overlay-authentication--box--top
The login/reset/registration box top position.--cwc-overlay-authentication--box--transform
The login/reset/registration box transform (for positioning).--cwc-overlay-authentication--box--width
The login/reset/registration box width.--cwc-overlay-authentication--box--z-index
The login/reset/registration box z-index.--cwc-overlay-authentication--box-header--background
The box header background.--cwc-overlay-authentication--box-header--border-radius
The box header border-radius.--cwc-overlay-authentication--box-header--color
The box header text colour.--cwc-overlay-authentication--box-header--font-weight
The box header font-weight.--cwc-overlay-authentication--box-header--font-size
The box header font-size.--cwc-overlay-authentication--box-header--height
The box header height.--cwc-overlay-authentication--box-header--line-height
The box header line-height.--cwc-overlay-authentication--box-header--margin
The box header margin.--cwc-overlay-authentication--box-header--padding
The box header padding.--cwc-overlay-authentication--box-header--text-transform
The box header text-transform.--cwc-overlay-authentication--box-header--text-align
The box header text align.--cwc-overlay-authentication--box-main--background
The box main background.--cwc-overlay-authentication--box-main--color
The box main text colour.--cwc-overlay-authentication--box-main--margin
The box main margin.--cwc-overlay-authentication--box-main--padding
The box main padding.--cwc-overlay-authentication--box-main--input--border
The box main input border.--cwc-overlay-authentication--box-main--input--border-radius
The box main input border-radius.--cwc-overlay-authentication--box-main--input--font-size
The box main input font-size.--cwc-overlay-authentication--box-main--input--margin
The box main input margin.--cwc-overlay-authentication--box-main--input--padding
The box main input padding.--cwc-overlay-authentication--box-main--input--invalid--background
The box main input invalid background.--cwc-overlay-authentication--box-main--input--invalid--border
The box main input invalid border.--cwc-overlay-authentication--box-main--button--background
The box main button.--cwc-overlay-authentication--box-main--button--border
The box main button border.--cwc-overlay-authentication--box-main--button--bottom
The box main button bottom position.--cwc-overlay-authentication--box-main--button--color
The box main button text colour.--cwc-overlay-authentication--box-main--button--height
The box main button height.--cwc-overlay-authentication--box-main--button--padding
The box main button padding.--cwc-overlay-authentication--box-main--button--position
The box main button position.--cwc-overlay-authentication--box-main--button--right
The box main button right position.--cwc-overlay-authentication--box-message--font-size
The box message font-size.--cwc-overlay-authentication--box-message--margin
The box message margin.--cwc-overlay-authentication--box-message--padding
The box message padding.--cwc-overlay-authentication--box-message--text-align
The box message text align.--cwc-overlay-authentication--box-message-icon--height
The box message icon height.--cwc-overlay-authentication--box-message-icon--margin
The box message icon margin.--cwc-overlay-authentication--box-message-icon--padding
The box message icon padding.--cwc-overlay-authentication--box-message-icon--width
The box message icon width.--cwc-overlay-authentication--box-message-danger--background
The box message danger context background.--cwc-overlay-authentication--box-message-danger--fill
The box message danger context fill colour.--cwc-overlay-authentication--box-message-danger--padding
The box message danger context padding.--cwc-overlay-authentication--box-message-success--background
The box message success context background.--cwc-overlay-authentication--box-message-success--fill
The box message success context fill colour.--cwc-overlay-authentication--box-message-success--padding
The box message success context padding.--cwc-overlay-authentication--box-footer--background
The box footer background.--cwc-overlay-authentication--box-footer--height
The box footer height.--cwc-overlay-authentication--box-footer--color
The box footer font colour.--cwc-overlay-authentication--box-footer--color--hover
The box footer font colour on hover.--cwc-overlay-authentication--box-footer--cursor
The box footer cursor.--cwc-overlay-authentication--box-footer--font-size
The box footer font-size.--cwc-overlay-authentication--box-footer--line-height
The box footer line-height.--cwc-overlay-authentication--box-footer--padding
The box footer padding.--cwc-overlay-authentication--box-footer--text-decoration
The box footer text decoration.--cwc-overlay-authentication--bumpf--bottom
The bumpf/text under the box, bottom position.--cwc-overlay-authentication--bumpf--color
The bumpf/text under the box, text colour.--cwc-overlay-authentication--bumpf--font-size
The bumpf/text under the box, font-size.--cwc-overlay-authentication--bumpf--left
The bumpf/text under the box, left position.--cwc-overlay-authentication--bumpf-version--float
The bumpf/text version under the box, float.--cwc-overlay-authentication--auth--background
The authenticating overlay background.--cwc-overlay-authentication--auth--border-radius
The authenticating overlay border-radius.--cwc-overlay-authentication--auth--color
The authenticating overlay text colour.--cwc-overlay-authentication--auth-title--color
The authenticating overlay title text colour.--cwc-overlay-authentication--auth-title--font-size
The authenticating overlay title text font-size.--cwc-overlay-authentication--auth-title--padding
The authenticating overlay title text padding.--cwc-overlay-authentication--auth-title--weight
The authenticating overlay title font weight.--cwc-overlay-authentication--auth-icon--background
The authenticating overlay icon background.--cwc-overlay-authentication--auth-icon--border-radius
The authenticating overlay icon border-radius.--cwc-overlay-authentication--auth-icon--fill
The authenticating overlay icon fill colour.--cwc-overlay-authentication--auth-icon--height
The authenticating overlay icon height.--cwc-overlay-authentication--auth-icon--width
The authenticating overlay icon width.
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
[hideme] { display: none; }
#authentication-overlay {
--cwc-overlay-authentication--box--border-radius: 10px;
--cwc-overlay-authentication--box-header--border-radius: 10px 10px 0px 0px;
--cwc-overlay-authentication--box-footer--border-radius: 0px 0px 10px 10px;
}
.remove-button {
display: inline-block;
position: fixed;
top: 10px;
left: 50%;
transform: translate(-50%, 0%);
z-index: 100000;
}
</style>
<cwc-overlay-authentication
id="authentication-overlay"
reset-route="reset"
register-route="register"
activate-route="activate"
system-key="custom-web-components"
system-version="1.2.3"
api-url="http://custom-web-components.net"
></cwc-overlay-authentication>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
remove()
Remove the message and store in local storage to stop it showing again.
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
#custom-compatible {
padding: 20px;
}
</style>
<script>
// simulate IE11
window.MSInputMethodContext = true;
document.documentMode = true;
// clear message each time, no persistence in example
window.localStorage.clear();
</script>
<cwc-overlay-browser-compatible id="default-compatible"></cwc-overlay-browser-compatible>
<cwc-overlay-browser-compatible id="custom-compatible">
<h1>A Message to Unsupported Users (IE)</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<button onclick="document.querySelector('#custom-compatible-overlay').remove()">Remove This Message</button>
</cwc-overlay-browser-compatible>
show
The help tip has been shown.
hide
The help tip has been hidden.
show()
Show the help tip manually.
hide()
Hide the help tip manually.
flip
flag
Swap help tip message to other side.
--cwc-overlay-help--icon--color
The help icon colour.--cwc-overlay-help--icon--width
The help icon width.--cwc-overlay-help--icon--height
The help icon height.--cwc-overlay-help--helptip--background-color
The help tooltip background colour.--cwc-overlay-help--helptip--border
The help tooltip border.--cwc-overlay-help--helptip--border-radius
The help tooltip border-radius.--cwc-overlay-help--helptip--box-shadow
The help tooltip box-shadow.--cwc-overlay-help--helptip--color
The help tooltip text colour.--cwc-overlay-help--helptip--font-size
The help tooltip font-size.--cwc-overlay-help--helptip--max-width
The help tooltip max width of box.--cwc-overlay-help--helptip--padding
The help tooltip padding of box.--cwc-overlay-help--helptip--width
The help tooltip width of box.--cwc-overlay-help--helptip-pointer--background-color
The help tooltip pointer colour (defaults to box background colour).
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
.tip2 {
--cwc-overlay-help--helptip--width: 100px;
}
.tip3 {
vertical-align: middle;
--cwc-overlay-help--icon--width: 40px;
--cwc-overlay-help--icon--height: 40px;
--cwc-overlay-help--icon--color: red;
--cwc-overlay-help--helptip--background-color: green;
--cwc-overlay-help--helptip--border-radius: 6px;
}
</style>
<cwc-overlay-help>This is a help message...</cwc-overlay-help>
<cwc-overlay-help class="tip2">This is a help message, should be shorter...</cwc-overlay-help>
<cwc-overlay-help class="tip3" flip>This is a help message, flipped to other side, styled...</cwc-overlay-help>
show
The loading overlay has been shown.
hide
The loading overlay has been hidden.
show()
Show the loading overlay manually.
hide()
Hide the loading overlay manually.
static
flag
The loading overlay is statically placed inline with other content.
visible
flag
The loading overlay is visible.
show-on-load
flag
The loading overlay is shown when loaded.
--cwc-overlay-loading--height
The height of the loader.--cwc-overlay-loading--width
The width of the loader.--cwc-overlay-loading--z-index
The z-index of the loader.--cwc-overlay-loading--box-shadow
The box shadow of the loader.--cwc-overlay-loading--border
The border of the loader.--cwc-overlay-loading--padding
The padding of the loader.--cwc-overlay-loading--background
The background of hte loader.--cwc-overlay-loading--speed
The speed to spin loader at.--cwc-overlay-loading--icon--fill
The icon colour of the default loader icon.
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
#loading-overlay2 {
--cwc-overlay-loading--background: red;
--cwc-overlay-loading--padding: 0;
--cwc-overlay-loading--width: 260px;
--cwc-overlay-loading--height: 260px;
--cwc-overlay-loading--icon--fill: white;
}
#loading-overlay3 {
--cwc-overlay-loading--background: transparent;
--cwc-overlay-loading--border: none;
--cwc-overlay-loading--box-shadow: none;
}
</style>
<cwc-overlay-loading id="loading-overlay1"></cwc-overlay-loading>
<cwc-overlay-loading id="loading-overlay2"></cwc-overlay-loading>
<cwc-overlay-loading id="loading-overlay3">
<img src="/assets/shield.png" width="100%">
</cwc-overlay-loading>
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys. What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
show
The modal has been shown.
hide
The modal has been hidden.
show()
Show the modal manually.
hide()
Hide the modal manually.
toggle()
Toggle the modal manually from hide / show or show / hide.
visible
flag
The loading overlay is visible.
--cwc-overlay-modal--background
The overlay modal background.--cwc-overlay-modal--border
The overlay modal border.--cwc-overlay-modal--border-radius
The overlay modal border radius.--cwc-overlay-modal--box-shadow
The overlay modal box shadow.--cwc-overlay-modal--height
The overlay modal height.--cwc-overlay-modal--max-height
The overlay modal max height.--cwc-overlay-modal--max-width
The overlay modal max width.--cwc-overlay-modal--overflow
The overlay modal overflow.--cwc-overlay-modal--padding
The overlay modal padding.--cwc-overlay-modal--width
The overlay modal width.--cwc-overlay-modal--transition-time
The overlay modal transition time as 200ms or 0.2s.--cwc-overlay-modal--z-index
The overlay modal z index.--cwc-overlay-modal--backdrop--background
The overlay modal backdrop background.--cwc-overlay-modal--backdrop--opacity
The overlay modal backdrop opacity.--cwc-overlay-modal--header--background
The overlay modal header background.--cwc-overlay-modal--header--border
The overlay modal header border.--cwc-overlay-modal--header--border-radius
The overlay modal header border radius.--cwc-overlay-modal--header--color
The overlay modal header text colour.--cwc-overlay-modal--header--padding
The overlay modal padding.--cwc-overlay-modal--header--icon--fill
The overlay modal header icon fill colour.--cwc-overlay-modal--header--icon--height
The overlay modal header icon height.--cwc-overlay-modal--header--icon--padding
The overlay modal header icon padding.--cwc-overlay-modal--header--icon--right
The overlay modal header icon right position.--cwc-overlay-modal--header--icon--width
The overlay modal header icon width.--cwc-overlay-modal--body--background
The overlay modal body background.--cwc-overlay-modal--body--border
The overlay modal body border.--cwc-overlay-modal--body--border-radius
The overlay modal body border radius.--cwc-overlay-modal--body--color
The overlay modal body text colour.--cwc-overlay-modal--body--padding
The overlay modal body padding.--cwc-overlay-modal--footer--background
The overlay modal footer background.--cwc-overlay-modal--footer--border
The overlay modal footer border.--cwc-overlay-modal--footer--border-radius
The overlay modal footer border radius.--cwc-overlay-modal--footer--color
The overlay modal footer text colour.--cwc-overlay-modal--footer--padding
The overlay modal footer padding.--cwc-overlay-modal--tablet--height
The overlay modal height for tablet (<980px wide).--cwc-overlay-modal--tablet--max-height
The overlay modal max height for tablet (<980px wide).--cwc-overlay-modal--tablet--max-width
The overlay modal max width for tablet (<980px wide).--cwc-overlay-modal--tablet--overflow
The overlay modal overflow for tablet (<980px wide).--cwc-overlay-modal--tablet--width
The overlay modal width for tablet (<980px wide).--cwc-overlay-modal--mobile--height
The overlay modal height for mobile (<600px wide).--cwc-overlay-modal--mobile--max-height
The overlay modal max height for mobile (<600px wide).--cwc-overlay-modal--mobile--max-width
The overlay modal max width for mobile (<600px wide).--cwc-overlay-modal--mobile--overflow
The overlay modal overflow for mobile (<600px wide).--cwc-overlay-modal--mobile--width
The overlay modal width for mobile (<600px wide).
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
[loaded] { display: none; }
#overlay2 {
--cwc-overlay-modal--background: lightblue;
--cwc-overlay-modal--border-radius: 10px;
--cwc-overlay-modal--max-height: 30%;
--cwc-overlay-modal--padding: 10px;
}
#overlay3 {
--cwc-overlay-modal--border-radius: 12px;
--cwc-overlay-modal--header--border-radius: 10px 10px 0px 0px;
--cwc-overlay-modal--footer--border-radius: 0px 0px 10px 10px;
--cwc-overlay-modal--box-shadow: 0px 0px 15px 0px black;
--cwc-overlay-modal--backdrop--background: black;
--cwc-overlay-modal--backdrop--opacity: 0.5;
}
#overlay3 h3 {
margin: 0;
padding: 0;
}
</style>
<div id="overlays" loaded>
<cwc-overlay-modal id="overlay1">
<span slot="body">Your thing overlayed... no headers, no footers, just an overlay ;)</span>
</cwc-overlay-modal>
<cwc-overlay-modal id="overlay2">
<div slot="body">
<span>Your thing overlayed... no headers, no footers, just an overlay, styled a bit ;)</span><br>
</div>
</cwc-overlay-modal>
<cwc-overlay-modal id="overlay3">
<h3 slot="header">Throw it, Cake!</h3>
<div slot="body">
<p>
Eyahh! These jelly kinders arent... alive, are they? What? No, they cant even talk. Kick it! Thanks for helping me out guys.
What are these buggers for, anyway? Oh, theyre decorations for my Biennial Gumball Ball. Tonight!
</p>
</div>
<div slot="footer">
<cwc-control-button>A Button</cwc-control-button>
</div>
</cwc-overlay-modal>
</div>
<script>
// FOUC, as we are not in an app component... we have to manually pause showing components to ensure they are defined
// this is not an issue in single page apps or components inside components, just components in static HTML pages!
setTimeout(() => document.querySelector('#overlays').removeAttribute('loaded'), 1000);
</script>
show
The modal has been shown.
hide
The modal has been hidden.
show(Number timeout)
Show the modal manually, pass optional milliseconds to override attribute for this one time.
hide()
Hide the modal manually.
visible
flag
The notify overlay is visible.
timeout
Number
The default timeout to use in milliseconds such as 4000 for 4 seconds.
--cwc-overlay-notify--background
The notify background.--cwc-overlay-notify--border
The notify border.--cwc-overlay-notify--border-radius
The notify border radius.--cwc-overlay-notify--bottom
The notify bottom position (use unset to turn off).--cwc-overlay-notify--box-shadow
The notify box shadow.--cwc-overlay-notify--color
The notify text colour.--cwc-overlay-notify--fill
The notify icon fill colour.--cwc-overlay-notify--height
The notify height.--cwc-overlay-notify--left
The notify left position (use unset to turn off).--cwc-overlay-notify--max-height
The notify max height.--cwc-overlay-notify--max-width
The notify max width.--cwc-overlay-notify--min-height
The notify min height.--cwc-overlay-notify--min-width
The notify min width.--cwc-overlay-notify--padding
The notify padding.--cwc-overlay-notify--right
The notify right position (use unset to turn off).--cwc-overlay-notify--top
The notify top position (use unset to turn off).--cwc-overlay-notify--transform
Thenotify transform property.--cwc-overlay-notify--width
The notify width.--cwc-overlay-notify--z-index
The notify Z Index.
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
[loaded] { display: none; }
#notify1 {
font-size: 14px;
--cwc-overlay-notify--background: black;
--cwc-overlay-notify--color: #eee;
}
#notify2 {
font-size: 14px;
--cwc-overlay-notify--top: 70px;
--cwc-overlay-notify--bottom: unset;
--cwc-overlay-notify--background: red;
--cwc-overlay-notify--color: #eee;
--cwc-overlay-notify--border-radius: 6px;
}
#notify3 {
font-size: 14px;
--cwc-overlay-notify--right: 50%;
--cwc-overlay-notify--transform: translateX(50%);
--cwc-overlay-notify--background: darkorange;
--cwc-overlay-notify--color: #eee;
--cwc-overlay-notify--fill: #eee;
--cwc-overlay-notify--border-radius: 100px;
}
#notify3 .icon {
padding: 0;
width: 25px;
height: 25px;
}
</style>
<div id="notifies" loaded>
<cwc-overlay-notify id="notify1" timeout="4000" context="primary">Your Message 1</cwc-overlay-notify>
<cwc-overlay-notify id="notify2" timeout="4000" context="primary">Your Message 2</cwc-overlay-notify>
<cwc-overlay-notify id="notify3" timeout="4000" context="primary">
<cwc-icon-material-general class="icon" name="warning"></cwc-icon-material-general>
Your Message 3
</cwc-overlay-notify>
</div>
show
The to top has been shown.
hidden
The to top has been hidden.
totop
The to top has gone to top.
show()
Show the to top button manually, normally shows automatically.
hide()
Hide the to top button manually, normally hides automatically.
--cwc-overlay-to-top--top
The overlay to top, top position (undefined to unset).--cwc-overlay-to-top--bottom
The overlay to top, bottom position (undefined to unset).--cwc-overlay-to-top--right
The overlay to top, right position (undefined to unset).--cwc-overlay-to-top--left
The overlay to top, left position (undefined to unset).--cwc-overlay-to-top--width
The overlay to top button width.--cwc-overlay-to-top--height
The overlay to top button height.--cwc-overlay-to-top--transition-time
The overlay to top transiation time.--cwc-overlay-to-top--transform
The overlay to top transform.--cwc-overlay-to-top--fill
The overlay to top icon fill colour.--cwc-overlay-to-top--padding
The overlay to top padding.--cwc-overlay-to-top--background
The overlay to top background.--cwc-overlay-to-top--border
The overlay to top border.--cwc-overlay-to-top--border-radius
The overlay to top border radius.--cwc-overlay-to-top--box-shadow
The overlay to top box shadow.--cwc-overlay-to-top--opacity
The over to top opacity.--cwc-overlay-to-top--cursor
The overlay to top cursor.
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
#totop2 {
--cwc-overlay-to-top--background: red;
--cwc-overlay-to-top--left: auto;
--cwc-overlay-to-top--right: 10px;
--cwc-overlay-to-top--bottom: 10px;
--cwc-overlay-to-top--transform: none;
}
</style>
<cwc-overlay-to-top id="totop1"></cwc-overlay-to-top>
<cwc-overlay-to-top id="totop2"></cwc-overlay-to-top>
show
The tooltip has been shown.
hidden
The to tooltip been hidden.
show()
Show tooltip manually, normally shows automatically on hover over linked element.
hide()
Hide tooltip manually, normally hides automatically on hover over linked element.
for
string
Will search the parent elements children for an element that has a matching 'name' value.
--cwc-overlay-tooltip--transition-time
The tooltip transiation time.--cwc-overlay-tooltip--max-width
The tooltip max width.--cwc-overlay-tooltip--box-shadow
The tooltip box shadow.--cwc-overlay-tooltip--border
The tooltip border.--cwc-overlay-tooltip--border-radius
The tooltip border radius.--cwc-overlay-tooltip--background
The tooltip background.--cwc-overlay-tooltip--color
The tooltip text colour.--cwc-overlay-tooltip--padding
The tooltip padding.--cwc-overlay-tooltip--font-size
The tooltip font-size.--cwc-overlay-tooltip--font-weight
The tooltip font weight.--cwc-overlay-tooltip--text-align
The tooltip text align.
<!-- direct import from html (you can import with ES6 import too in JS files! -->
<script type="module" src="/node_modules/custom-web-components/src/overlay/index.js"></script>
<style>
[for="tooltip-2"] {
--cwc-overlay-tooltip--border-radius: 6px;
--cwc-overlay-tooltip--background: blue;
--cwc-overlay-tooltip--color: white;
--cwc-overlay-tooltip--max-width: 100px;
}
[for="tooltip-3"] {
--cwc-overlay-tooltip--border-radius: 10px;
--cwc-overlay-tooltip--background: red;
--cwc-overlay-tooltip--color: white;
--cwc-overlay-tooltip--font-size: 16px;
}
</style>
<div class="row">
<div class="col-md-4 text-left">
<span name="tooltip-1">Some text</span>
<cwc-overlay-tooltip for="tooltip-1">Tooltip that stays on screen.</cwc-overlay-tooltip>
</div>
<div class="col-md-4 text-center">
<span name="tooltip-2">More text</span>
<cwc-overlay-tooltip for="tooltip-2">Tooltip thinner with slightly more text in it to make it deeper.</cwc-overlay-tooltip>
</div>
<div class="col-md-4 text-right">
<span name="tooltip-3">Even more text</span>
<cwc-overlay-tooltip for="tooltip-3">Some text to explain what this is. Some text to explain what this is. Some text to explain what this is. Stays on screen.</cwc-overlay-tooltip>
</div>
</div>