maud-ui 0.1.0

58 headless, accessible UI components for Rust web apps. Built on maud + htmx, styled like shadcn/ui.
Documentation
/* Toast component — clean card style, no left border accent */

/* Viewport container — fixed position, stacks toasts bottom-right */
.mui-toast-viewport {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  z-index: 100;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}

/* Toast card — uniform border, elevated shadow */
.mui-toast {
  pointer-events: auto;
  background: var(--mui-bg-card);
  border: 1px solid var(--mui-border);
  border-radius: var(--mui-radius-lg);
  padding: 0.875rem 2.5rem 0.875rem 1rem;
  box-shadow: var(--mui-shadow-lg);
  min-width: 20rem;
  max-width: 24rem;
  position: relative;
  animation: mui-toast-enter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Variant indicator dot -------------------------------------------- */
/* Small colored dot before the title instead of thick left border */

.mui-toast__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--mui-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
}

.mui-toast__title::before {
  content: "";
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--mui-radius-full);
  background: var(--mui-accent);
}

/* Variant dot colors */
.mui-toast--info .mui-toast__title::before {
  background: var(--mui-accent);
}

.mui-toast--success .mui-toast__title::before {
  background: var(--mui-success);
}

.mui-toast--warning .mui-toast__title::before {
  background: var(--mui-warning);
}

.mui-toast--danger .mui-toast__title::before {
  background: var(--mui-danger);
}

/* Description — muted, indented to align past the dot */
.mui-toast__description {
  color: var(--mui-text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-top: 0.25rem;
  padding-left: 1rem;
}

/* Close button — subtle, top-right */
.mui-toast__close {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  background: transparent;
  border: none;
  color: var(--mui-text-subtle);
  cursor: pointer;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--mui-radius-sm);
  font-size: 0.875rem;
  line-height: 1;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
              color 150ms cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

/* Show close on card hover */
.mui-toast:hover .mui-toast__close {
  opacity: 1;
}

.mui-toast__close:hover {
  background-color: var(--mui-bg-input);
  color: var(--mui-text);
}

.mui-toast__close:focus-visible {
  outline: 2px solid var(--mui-border-focus);
  outline-offset: 2px;
  opacity: 1;
}

/* --- Exit animation --------------------------------------------------- */
.mui-toast--exit {
  animation: mui-toast-exit 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* --- Keyframes -------------------------------------------------------- */
@keyframes mui-toast-enter {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mui-toast-exit {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}