JSFiddle - React, Tailwind, and code Playground

by Anderson Carlos Woss

HTML

<div class="toast">
  <button class="toast-action" for="open">TOAST</button>
  <div class="toast-message">
    <p>Lorem, ipsum dolor.</p>
    <a href="#!">X</a>
  </div>
  
</div>

CSS

.toast > .toast-action {
    background-color: purple;
    border-radius: .5em;
    box-shadow: 0 .25em .5em 0 rgba(0, 0, 0, .25);
    padding: 1em;
    color: #fff;
    text-transform: uppercase;
    font-family: sans-serif;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background-color 250ms;
}
.toast > .toast-action:hover {
    background-color: rgb(100, 0, 100);
}

.toast > .toast-message {
    position: fixed;
    display: flex;
    bottom: -80px;
    left: 0;
    width: 100%;
    justify-content: space-between;
    background-color: rgb(100, 0, 100);
    font-family: sans-serif;
    transition: bottom .5s ease-out;
}
.toast > .toast-message {
    color: #fff;
    margin: 0;
    text-decoration: none;
}
.toast > .toast-message p,
.toast > .toast-message a {
    color: #fff;
    margin: 0;
    padding: 2em;
    text-decoration: none;
}

.toast-action:focus + .toast-message {
  bottom: 0;
}

.toast > .toast-message:focus-within {
  bottom: -80px;
}