Design

Toasts

With a little bit of JavaScript, you can create a toast notification. The following example shows how to create a simple toast notification using the Shut framework.

Hello there toaster
Oh oh!
Yippee!
Be careful!
HTML
<div class="toast">
				<div class="text">
					Hello there toaster
				</div>
			</div>
			<div class="toast error">
				<div class="text">
					Oh oh!
				</div>
			</div>
			<div class="toast success">
				<div class="text">
					Yippee!
				</div>
			</div>
			<div class="toast warning">
				<div class="text">
					Be careful!
				</div>
			</div>
Style
.toast {
		display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    background-color: var(--sh-grey-dark);
    color: var(--sh-white);
    position: fixed;
    inset-block-end: var(--sh-space);
    inset-inline: var(--sh-space);
    max-width: 500px;
    margin-inline: auto;
    font-size: 90%;
    z-index: 5100;
    border-radius: var(--sh-radius);
    box-shadow: 0 0 7px -1px rgba(0, 0, 0, 0.5);
    &.error {
      background-color: var(--sh-red);
    }
		/* tranform out of view, to bring back in js by adding inview class */
		transform: translateY(calc(100% + var(--sh-space)));
    transition: transform 0.2s ease-in-out;

    &.inview {
      transform: translateY(0);
    }
		&.error {
			background-color: var(--sh-red);
		}
		
		&.success {
			background-color: var(--sh-green);
		}
		
		&.warning {
			background-color: var(--sh-yellow);
			color: var(--sh-textcolor);	
		}

		.text {
			padding: var(--sh-space);
			margin-right: var(--sh-halfspace);
			flex-basis: 100%;
		}
	}

Here are extra flavors of the toast, with icon, with secondary text, and with optional buttons.

Hello there toaster
This is a secondary message.
HTML
<div class="toast spaced">
	<div class="icon">
		<i class="symbol icon-sun"></i>
	</div>
	<div class="text">
		Hello there toaster
		<div class="secondary">This is a secondary message.</div>
	</div>
	<div class="buttons">
		<button class="btn-fake">OK</button>
	</div>
</div>
Style
.toast {
		display: flex;
		flex-wrap: nowrap;
		align-items: flex-start;
		background-color: var(--sh-grey-dark);
		color: var(--sh-white);
		/* position: fixed; */
		inset-block-end: var(--sh-space);
		inset-inline: var(--sh-space);
		max-width: 500px;
		margin-inline: auto;
		font-size: 90%;
		z-index: 5100;
		border-radius: var(--sh-radius);
		box-shadow: 0 0 7px -1px rgba(0, 0, 0, 0.5);

		&.error {
			background-color: var(--sh-red);
		}

		&.success {
			background-color: var(--sh-green);

		}

		&.warning {
			background-color: var(--sh-yellow);
			color: var(--sh-textcolor);
		}
	}

	.text {
		padding: var(--sh-space);
		margin-right: var(--sh-halfspace);
		flex-basis: 100%;
	}
	.secondary {
    opacity: 0.7;
    font-weight: 300;
  }
  .icon {
    --ol-icon-padding: var(--sh-space);
    padding-block-start: var(--ol-icon-padding);
    padding-inline-start: var(--ol-icon-padding);
  }
  .success {
    .icon {
      --ol-icon-padding: calc(var(--sh-space) - 5px);
    }
    i:before {
      background-color: var(--sh-green);
      padding: 5px;
      border-radius: 100%;
      line-height: 1;
    }
  }
  .warning {
    .icon {
      --ol-icon-padding: calc(var(--sh-space) - 5px);
    }
    i {
      color: var(--sh-text-color);
    }
    i:before {
      background-color: var(--sh-yellow);
      padding: 5px;
      border-radius: 100%;
      line-height: 1;
    }
  }

  .buttons {
    display: flex;

    button {
      padding: var(--sh-space);
      cursor: pointer;
      color: inherit;
      display: block;
    }
  }