Skip to content

<np-logout>

A button component to log out an authenticated user.

Properties

NameTypeRequiredDefaultDescription
stateStatenoundefinedThe component’s internal state.
enum State {
LOGGINGOUT = "loggingout", // Revoking session
LOGGEDOUT = "loggedout", // Session is revoked
ERROR = "error", // Something went wrong
}

Methods

NameDescription
logoutEnds the current session.

Custom Events

NameDescriptionType
np:logoutThe session is closed.void
np:errorSomething went wrong.NoPwdError

The np:error custom event detail inherits from the NoPwdError.

Slots

NameDescription
(default)The button’s label.
loggingoutClosing the session.
loggedoutSession is closed.
errorAn error occurred.

Usage:

<!-- Override the default slot -->
<np-logout></np-logout>
<!-- Override specific slots -->
<np-logout>
Logout
<span slot="loggingout">Please wait</span>
<span slot="loggedout">Bye!</span>
<span slot="error">Oops</span>
</np-logout>

Parts

NameDescription
buttonThe component’s button wrapper.

Usage:

/* Target only the default state */
np-logout:not([state])::part(button) {
background-color: black;
color: white;
}
np-logout[state="loggingout"]::part(button) {
background-color: transparent;
color: grey;
}
np-logout[state="loggedout"]::part(button) {
background-color: green;
color: white;
}
np-logout[state="error"]::part(button) {
background-color: red;
color: white;
}