ClassiJSYou already know it. Star on GitHub

Examples

Getting Started
OverviewInstallationGetting StartedWork List
Components
Buttons
Basic ButtonsToggle ButtonsButton StatesButton IconsMenu ButtonsMenu Bottom ButtonsSplit ButtonsSplit Bottom ButtonsLeft Text ButtonsRight Text ButtonsLink ButtonsButton with CountSegmented ButtonsVertical Segmented Buttons
Tabs
Basic TabsPlain TabsFramed TabsIcon TabsAdvanced TabsHeader TabsRemote Content TabsLazy TabsReorderable TabsOverflow TabsTab Positions
Menus and Toolbars
Basic ToolbarDocked ToolbarsBreadcrumb ToolbarToolbar OverflowToolbar MenusStatus Bar
Panels
Basic PanelFramed PanelHeader Positioning
Feedback and Overlays
Anchored TooltipsPointer TooltipsRich TooltipsClosable TooltipsPopoversLoading MaskProgress BarWindowsMessage BoxesToast Notifications
Form Fields
Forms and FieldsetsField GroupsCombo BoxTag FieldNumber FieldDate/Month PickerField TypesCheckboxRadioText FieldText AreaColor FieldSelect Field
Advanced Forms
Multi-selectSlider FieldRating FieldForm ValidationRepeatable FieldsUpload ProgressForm Examples
Trees
Basic TreesJSON Tree
Code Block
Basic Code BlockTitle and Line NumbersWrapped CodeEditable Code
Navigation
Thumbnail View

No results found.

Feedback and Overlays - Toast Notifications

Feedback and Overlays - Toast Notifications

Toast Notifications

Options
NameValueTypeDefaultDescription
labelstring"Notifications"Provides the accessible region name.
position
"top-left" | "top-right" | "bottom-left" | "bottom-right""top-right"Places notifications at a viewport corner.
NameValueTypeDefaultDescription
titlestring"Notification"Displays the notification heading.
status
"info" | "success" | "warning" | "error""info"Sets the notification state.
duration
number4000Sets auto-dismiss time; zero keeps it open.
Styles
--cj-overlay-background#E9F2FF
--cj-overlay-color#333333
--cj-overlay-border-color#8EAACE
--cj-progress-background#E0EDFC
--cj-progress-border-color#6593CF
--cj-window-background#DFE9F6
--cj-window-border-color#99BCE8
/* Choose a color to generate CSS overrides. */
_overlay.scssscss
.cj-tooltip,
.cj-popover {
  display: inline-flex;
  vertical-align: middle;
}
.cj-tooltip__target,
.cj-popover__trigger {
  display: inline-flex;
}
.cj-tooltip__surface,
.cj-popover__surface {
  box-sizing: border-box;
  z-index: var(--cj-z-popup, 1000);
  min-width: 80px;
  max-width: min(320px, calc(100vw - 16px));
  overflow: visible;
  border: 1px solid var(--cj-overlay-border-color, #8eaace);
  border-radius: 2px;
  background: var(--cj-overlay-background, #e9f2ff);
  box-shadow: 1px 1px 3px #0003;
  color: var(--cj-overlay-color, #333);
  font: 11px/16px var(--cj-font);
}
.cj-tooltip__surface {
  padding: 2px;
  border-radius: 3px;
  box-shadow: none;
  color: #444;
  font: normal 11px/normal var(--cj-font);
}
.cj-tooltip__surface[hidden],
.cj-popover__surface[hidden] {
  display: none;
}
.cj-tooltip__header,
.cj-popover__header {
  display: flex;
  min-height: 22px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 2px 7px;
  border-bottom: 1px solid #b8cce6;
  color: #04408c;
  background: linear-gradient(#f2f7fd, #d9e7f7);
}
.cj-tooltip__body,
.cj-popover__body {
  padding: 5px 7px;
}
.cj-tooltip__body {
  padding: 3px;
}
.cj-tooltip__close,
.cj-popover__close,
.cj-toast__close,
.cj-window__close {
  appearance: none;
  position: relative;
  width: 15px;
  height: 15px;
  flex: none;
  padding: 0;
  border: 0;
  background: url("./overlay-close.svg") center / 15px 15px no-repeat;
  cursor: pointer;
}
.cj-tooltip__close:hover,
.cj-popover__close:hover,
.cj-toast__close:hover,
.cj-window__close:hover {
  background-image: url("./overlay-close-hover.svg");
}
.cj-tooltip__close:focus-visible,
.cj-popover__close:focus-visible,
.cj-toast__close:focus-visible,
.cj-window__close:focus-visible {
  outline: 1px dotted currentColor;
}
.cj-tooltip__anchor,
.cj-popover__anchor {
  position: absolute;
  width: 8px;
  height: 8px;
  border: solid var(--cj-overlay-border-color, #8eaace);
  background: var(--cj-overlay-background, #e9f2ff);
  transform: rotate(45deg);
}
[data-placement="top"] > :is(.cj-tooltip__anchor, .cj-popover__anchor) {
  bottom: -5px;
  left: calc(50% - 4px);
  border-width: 0 1px 1px 0;
}
[data-placement="bottom"] > :is(.cj-tooltip__anchor, .cj-popover__anchor) {
  top: -5px;
  left: calc(50% - 4px);
  border-width: 1px 0 0 1px;
}
[data-placement="left"] > :is(.cj-tooltip__anchor, .cj-popover__anchor) {
  top: calc(50% - 4px);
  right: -5px;
  border-width: 1px 1px 0 0;
}
[data-placement="right"] > :is(.cj-tooltip__anchor, .cj-popover__anchor) {
  top: calc(50% - 4px);
  left: -5px;
  border-width: 0 0 1px 1px;
}
.cj-popover__surface {
  min-width: 180px;
  max-width: min(360px, calc(100vw - 16px));
}
.cj-popover__body {
  font-size: 12px;
  line-height: 1.45;
}
.cj-mask-container {
  position: relative;
  min-width: 0;
}
.cj-loading-mask[hidden] {
  display: none;
}
.cj-progress {
  --cj-progress-background: #e0e8f3;
  --cj-progress-fill: linear-gradient(
    #b2ccee,
    #88b1e5 50%,
    #73a3e0 51%,
    #5e96db
  );
  position: relative;
  box-sizing: border-box;
  width: 250px;
  max-width: 100%;
  height: 20px;
  overflow: hidden;
  border: 1px solid var(--cj-progress-border-color, #6594cf);
  background: var(--cj-progress-background);
  font: bold 11px/18px var(--cj-font);
}
.cj-progress__bar {
  position: relative;
  z-index: 1;
  width: var(--cj-progress-value);
  height: 100%;
  background: var(--cj-progress-fill);
  transition: width 160ms ease;
}
.cj-progress::before {
  content: attr(data-progress-text);
  position: absolute;
  z-index: 0;
  inset: 0;
  color: #15428b;
  text-align: center;
}
.cj-progress__text {
  position: absolute;
  z-index: 2;
  inset: 0;
  color: #fff;
  text-align: center;
  clip-path: inset(0 calc(100% - var(--cj-progress-value)) 0 0);
}
.cj-progress--indeterminate .cj-progress__bar {
  width: 40%;
  animation: cj-progress-slide 1.2s ease-in-out infinite alternate;
}
.cj-window {
  position: relative;
  box-sizing: border-box;
  min-width: min(250px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  margin: auto;
  padding: 4px;
  overflow: hidden;
  border: 1px solid var(--cj-window-border-color, #a2b1c5);
  border-radius: 5px;
  background: var(--cj-window-background, #ced9e7);
  box-shadow:
    inset 0 1px #ecf2fb,
    inset 0 -1px #ecf2fb,
    inset -1px 0 #ecf2fb,
    inset 1px 0 #ecf2fb,
    0 3px 10px #0005;
  color: #000;
  font: 12px var(--cj-font);
}
.cj-window[open] {
  display: block;
}
.cj-window__body-wrap {
  display: grid;
  height: calc(100% - 22px);
  min-height: 0;
  margin-top: 22px;
  grid-template-rows: minmax(0, 1fr) auto;
}
.cj-window:not([open]) {
  display: none;
}
.cj-window::backdrop {
  background: rgb(31 45 61 / 35%);
}
.cj-window__header {
  position: absolute;
  z-index: 1;
  top: -1px;
  right: -1px;
  left: -1px;
  display: flex;
  height: 23px;
  align-items: center;
  justify-content: space-between;
  padding: 5px 5px 1px;
  border: 1px solid #a2b1c5;
  border-bottom: 0;
  background: #ced9e7;
  box-shadow:
    inset 0 1px #ecf2fb,
    inset -1px 0 #ecf2fb,
    inset 1px 0 #ecf2fb;
  color: #04468c;
  touch-action: none;
  user-select: none;
}
.cj-window[data-draggable] .cj-window__header {
  cursor: move;
}
.cj-window__title {
  margin: 0;
  padding: 0 2px 1px;
  font: bold 11px/15px var(--cj-font);
}
.cj-window__tools {
  display: flex;
  color: #4b6d98;
}
.cj-window__close {
  translate: 0 -0.5px;
}
.cj-window__body {
  box-sizing: border-box;
  min-height: 40px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #99bbe8;
  background: #dfe8f6;
}
.cj-window__footer {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 4px 6px;
}
.cj-window__footer .cj-button {
  min-width: 75px;
}
.cj-window--resizable {
  resize: none;
}
.cj-window__resize-handle {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  cursor: nwse-resize;
  touch-action: none;
  user-select: none;
}
.cj-message-box__content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.cj-message-box__content p {
  margin: 0;
}
.cj-message-box .cj-window__body {
  min-height: 48px;
  padding: 10px;
  border: 0;
  background: #ced9e7;
}
.cj-message-box .cj-window__footer {
  justify-content: center;
  gap: 6px;
}
.cj-message-box .cj-button:focus:not(:hover):not(:active) {
  border-color: #b0ccf2;
  background: linear-gradient(#fff, #f9f9f9 48%, #e7e7e7 52%, #ececec);
}
.cj-message-box__icon {
  width: 32px;
  height: 32px;
  flex: none;
  background: center / contain no-repeat;
}
.cj-message-box__icon--info {
  background-image: url("./message-info.svg");
}
.cj-message-box__icon--question {
  background-image: url("./message-question.svg");
}
.cj-message-box__icon--warning {
  background-image: url("./message-warning.svg");
}
.cj-message-box__icon--error {
  background-image: url("./message-error.svg");
}
.cj-toast-region {
  position: fixed;
  z-index: var(--cj-z-portal, 30000);
  display: flex;
  width: min(300px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  pointer-events: none;
}
.cj-toast-region--top-left {
  top: 8px;
  left: 8px;
}
.cj-toast-region--top-right {
  top: 8px;
  right: 8px;
}
.cj-toast-region--bottom-left {
  bottom: 8px;
  left: 8px;
}
.cj-toast-region--bottom-right {
  right: 8px;
  bottom: 8px;
}
.cj-toast {
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  border: 1px solid #99bce8;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 2px 7px #0004;
  color: #333;
  font: 11px/16px var(--cj-font);
  pointer-events: auto;
  animation: cj-toast-enter 160ms ease-out;
}
.cj-toast__header {
  display: flex;
  min-height: 25px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 5px 4px 8px;
  color: #04408c;
  background: linear-gradient(#e8f1fb, #cbdcf2);
}
.cj-toast__body {
  padding: 8px;
  font-size: 12px;
}
.cj-toast--success {
  border-color: #86ae70;
}
.cj-toast--warning {
  border-color: #d0a651;
}
.cj-toast--error {
  border-color: #ca7777;
}
.cj-toast--closing {
  opacity: 0;
  transform: translateX(14px);
  transition: 160ms ease-in;
}
@keyframes cj-progress-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}
@keyframes cj-toast-enter {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cj-progress--indeterminate .cj-progress__bar,
  .cj-toast {
    animation-duration: 1ms;
    animation-iteration-count: 1;
  }
}
@media (max-width: 520px) {
  .cj-window {
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px);
  }
  .cj-window--resizable {
    resize: none;
  }
}

Show temporary application notifications.

Notice
A new notification is available.
Saved
All changes were saved.
Error
The request could not be completed.

Code

---
import { Toast, ToastRegion } from 'classijs';
import 'classijs/styles.css';
---
<ToastRegion position="bottom-right">
  <Toast title="Saved" status="success" duration={0}>
    All changes were saved.
  </Toast>
</ToastRegion>