# Calendar event toast

> Confirms a new appointment with a date tile, a time slot and a colored bar that grows along the side.

- Category: [Toasts](https://library.aimran.es/components/toasts)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-toast-calendar
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Made for the moment a date gets locked in. When a client books a haircut on a salon's website, or a patient picks a slot with the dentist, the calendar toast shows the day, the time range and the place in one glance. It works as a small receipt that the booking went through.

Always include the time and the place; the date tile alone is not much use. Add an “Add to calendar” link if people will need it later. And keep the side bar in your brand color so it reads as yours.

## Code

### HTML

```html
<div class="uv-zcal"><button class="fire">Create event</button><div class="toast"><time><b>25</b>SEP</time><span><b>Design review</b><small>16:30–17:15 · Estudio</small></span><i></i></div></div>
```

### CSS

```css
.uv-zcal {
  --c1: #0071e3;
  --c2: #8ec5ff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uv-zcal {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  position: relative;
  width: 20em;
  height: 14em;
  font-size: var(--s);
}

.uv-zcal>.fire {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  padding: .8em 1.25em;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--c1);
  cursor: pointer;
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-zcal .toast {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: .5em;
  display: flex;
  align-items: center;
  gap: .75em;
  width: 18em;
  padding: .85em;
  border-radius: 1em;
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 18px 45px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translate(-50%,2em);
}

.uv-zcal time {
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: .8em;
  font-size: .56em;
  color: #fff;
  background: var(--c1);
}

.uv-zcal time b {
  font-size: 1.7em;
}

.uv-zcal .toast span {
  display: grid;
  gap: .12em;
}

.uv-zcal small {
  opacity: .5;
}

.uv-zcal .toast>i {
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--c1);
  transform: scaleY(0);
  transform-origin: bottom;
}

.uv-zcal .toast.show {
  animation: uv-zcal calc(4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-zcal .toast.show>i {
  animation: uv-zcal-line calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes uv-zcal {
  0% {
    opacity: 0;
    transform: translate(-50%,2em) scale(.9);
  }
  12%,86% {
    opacity: 1;
    transform: translate(-50%,0) scale(1);
    pointer-events: auto;
  }
  100% {
    opacity: 0;
    transform: translate(-50%,1em);
  }
}

@keyframes uv-zcal-line {
  to {
    transform: scaleY(1);
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uv-zcal").forEach(el => {
  const b=el.querySelector(".fire"),t=el.querySelector(".toast");b.addEventListener("click",()=>{t.classList.remove("show");void t.offsetWidth;t.classList.add("show")});
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uv-zcal {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  position: relative;
  width: 20em;
  height: 14em;
  font-size: var(--s);
}

.uv-zcal>.fire {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  padding: .8em 1.25em;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--c1);
  cursor: pointer;
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-zcal .toast {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: .5em;
  display: flex;
  align-items: center;
  gap: .75em;
  width: 18em;
  padding: .85em;
  border-radius: 1em;
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 18px 45px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translate(-50%,2em);
}

.uv-zcal time {
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: .8em;
  font-size: .56em;
  color: #fff;
  background: var(--c1);
}

.uv-zcal time b {
  font-size: 1.7em;
}

.uv-zcal .toast span {
  display: grid;
  gap: .12em;
}

.uv-zcal small {
  opacity: .5;
}

.uv-zcal .toast>i {
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--c1);
  transform: scaleY(0);
  transform-origin: bottom;
}

.uv-zcal .toast.show {
  animation: uv-zcal calc(4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-zcal .toast.show>i {
  animation: uv-zcal-line calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes uv-zcal {
  0% {
    opacity: 0;
    transform: translate(-50%,2em) scale(.9);
  }
  12%,86% {
    opacity: 1;
    transform: translate(-50%,0) scale(1);
    pointer-events: auto;
  }
  100% {
    opacity: 0;
    transform: translate(-50%,1em);
  }
}

@keyframes uv-zcal-line {
  to {
    transform: scaleY(1);
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const b=el.querySelector(".fire"),t=el.querySelector(".toast");b.addEventListener("click",()=>{t.classList.remove("show");void t.offsetWidth;t.classList.add("show")});
}

export default function ToastCalendar() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uv-zcal"><button className="fire">Create event</button><div className="toast"><time><b>25</b>SEP</time><span><b>Design review</b><small>16:30–17:15 · Estudio</small></span><i></i></div></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Calendar event toast” block (Toasts) from AIMRAN Library to my project.

## What it is
Confirms a new appointment with a date tile, a time slot and a colored bar that grows along the side.

## Chosen settings
- Main color: #0071e3
- Secondary color: #8ec5ff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Design review"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uv-zcal {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  position: relative;
  width: 20em;
  height: 14em;
  font-size: var(--s);
}

.uv-zcal>.fire {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  padding: .8em 1.25em;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--c1);
  cursor: pointer;
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-zcal .toast {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: .5em;
  display: flex;
  align-items: center;
  gap: .75em;
  width: 18em;
  padding: .85em;
  border-radius: 1em;
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 18px 45px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translate(-50%,2em);
}

.uv-zcal time {
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: .8em;
  font-size: .56em;
  color: #fff;
  background: var(--c1);
}

.uv-zcal time b {
  font-size: 1.7em;
}

.uv-zcal .toast span {
  display: grid;
  gap: .12em;
}

.uv-zcal small {
  opacity: .5;
}

.uv-zcal .toast>i {
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--c1);
  transform: scaleY(0);
  transform-origin: bottom;
}

.uv-zcal .toast.show {
  animation: uv-zcal calc(4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-zcal .toast.show>i {
  animation: uv-zcal-line calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes uv-zcal {
  0% {
    opacity: 0;
    transform: translate(-50%,2em) scale(.9);
  }
  12%,86% {
    opacity: 1;
    transform: translate(-50%,0) scale(1);
    pointer-events: auto;
  }
  100% {
    opacity: 0;
    transform: translate(-50%,1em);
  }
}

@keyframes uv-zcal-line {
  to {
    transform: scaleY(1);
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const b=el.querySelector(".fire"),t=el.querySelector(".toast");b.addEventListener("click",()=>{t.classList.remove("show");void t.offsetWidth;t.classList.add("show")});
}

export default function ToastCalendar() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uv-zcal"><button className="fire">Create event</button><div className="toast"><time><b>25</b>SEP</time><span><b>Design review</b><small>16:30–17:15 · Estudio</small></span><i></i></div></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
