# Digital watch alarm toggle

> A watch LCD with ghost segments: the bell icon darkens when the alarm is set, and pressing it lights the backlight.

- Category: [Toggles](https://library.aimran.es/components/toggles)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-tg-lcd-alarm
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Inspired by classic resin digital watches, this switch shows a small greenish LCD with faint 88:88 ghost segments behind the time. Turning it on darkens the bell and the AL marker, the bell gives a short ring, and holding it down turns on a cyan backlight like the light button on a real watch. It works well for alarms, reminders and timers.

The main color is the backlight and the second one tints the LCD glass. Replace 07:30 in the HTML with any time, and keep a monospace font so the digits stay aligned with the ghost segments.

## Code

### HTML

```html
<label class="uvq03-lcd"><input type="checkbox" role="switch"><span class="cs"><span class="bt"></span><span class="sc"><span class="dg"><b class="gs">88:88</b><b class="d">07:30</b></span><span class="ic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a6 6 0 0 0-6 6v4l-2 3h16l-2-3V9a6 6 0 0 0-6-6zm-2.2 15a2.2 2.2 0 0 0 4.4 0z"/></svg><b>AL</b></span></span></span>Daily alarm</label>
```

### CSS

```css
.uvq03-lcd {
  --c1: #41e0c4;
  --c2: #b9c5a3;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq03-lcd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .8em;
  cursor: pointer;
  user-select: none;
  font-weight: 550;
}

.uvq03-lcd input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-lcd .cs {
  position: relative;
  display: block;
  flex: none;
  padding: .42em .5em;
  border-radius: .9em;
  background: linear-gradient(180deg,#2d2f34,#131417);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14),0 .55em 1em -.5em rgba(0,0,0,.6);
}

.uvq03-lcd .bt {
  position: absolute;
  right: -.26em;
  top: 50%;
  width: .3em;
  height: .9em;
  margin-top: -.45em;
  border-radius: .12em;
  background: linear-gradient(90deg,#4f5259,#a3a6ad);
  transition: transform calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-lcd .sc {
  position: relative;
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .38em .55em;
  border-radius: .42em;
  color: #1f2a1c;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2));
  box-shadow: inset 0 .12em .3em rgba(0,0,0,.4);
  transition: background calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-lcd .dg {
  position: relative;
  font: italic 700 1.35em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .02em;
}

.uvq03-lcd .gs {
  opacity: .09;
}

.uvq03-lcd .d {
  position: absolute;
  inset: 0;
}

.uvq03-lcd .ic {
  display: grid;
  justify-items: center;
  gap: .12em;
  opacity: .12;
}

.uvq03-lcd .ic svg {
  width: .95em;
  height: .95em;
  fill: currentColor;
  transform-origin: 50% 15%;
}

.uvq03-lcd .ic b {
  font: 800 .5em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}

.uvq03-lcd:hover .bt {
  transform: translateX(-.05em);
}

.uvq03-lcd:active .bt {
  transform: translateX(-.14em);
}

.uvq03-lcd:active .sc {
  background: radial-gradient(circle,color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
  box-shadow: inset 0 .12em .3em rgba(0,0,0,.25),0 0 1.1em -.2em var(--c1);
}

.uvq03-lcd input:checked + .cs .ic {
  opacity: 1;
}

.uvq03-lcd input:checked + .cs .ic svg {
  animation: uvq03-lcd calc(0.7s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq03-lcd {
  20% {
    transform: rotate(16deg);
  }
  40% {
    transform: rotate(-14deg);
  }
  60% {
    transform: rotate(9deg);
  }
  80% {
    transform: rotate(-4deg);
  }
}

.uvq03-lcd input:focus-visible + .cs {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion:reduce) {
  .uvq03-lcd,.uvq03-lcd *,.uvq03-lcd *::before,.uvq03-lcd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uvq03-lcd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .8em;
  cursor: pointer;
  user-select: none;
  font-weight: 550;
}

.uvq03-lcd input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-lcd .cs {
  position: relative;
  display: block;
  flex: none;
  padding: .42em .5em;
  border-radius: .9em;
  background: linear-gradient(180deg,#2d2f34,#131417);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14),0 .55em 1em -.5em rgba(0,0,0,.6);
}

.uvq03-lcd .bt {
  position: absolute;
  right: -.26em;
  top: 50%;
  width: .3em;
  height: .9em;
  margin-top: -.45em;
  border-radius: .12em;
  background: linear-gradient(90deg,#4f5259,#a3a6ad);
  transition: transform calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-lcd .sc {
  position: relative;
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .38em .55em;
  border-radius: .42em;
  color: #1f2a1c;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2));
  box-shadow: inset 0 .12em .3em rgba(0,0,0,.4);
  transition: background calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-lcd .dg {
  position: relative;
  font: italic 700 1.35em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .02em;
}

.uvq03-lcd .gs {
  opacity: .09;
}

.uvq03-lcd .d {
  position: absolute;
  inset: 0;
}

.uvq03-lcd .ic {
  display: grid;
  justify-items: center;
  gap: .12em;
  opacity: .12;
}

.uvq03-lcd .ic svg {
  width: .95em;
  height: .95em;
  fill: currentColor;
  transform-origin: 50% 15%;
}

.uvq03-lcd .ic b {
  font: 800 .5em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}

.uvq03-lcd:hover .bt {
  transform: translateX(-.05em);
}

.uvq03-lcd:active .bt {
  transform: translateX(-.14em);
}

.uvq03-lcd:active .sc {
  background: radial-gradient(circle,color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
  box-shadow: inset 0 .12em .3em rgba(0,0,0,.25),0 0 1.1em -.2em var(--c1);
}

.uvq03-lcd input:checked + .cs .ic {
  opacity: 1;
}

.uvq03-lcd input:checked + .cs .ic svg {
  animation: uvq03-lcd calc(0.7s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq03-lcd {
  20% {
    transform: rotate(16deg);
  }
  40% {
    transform: rotate(-14deg);
  }
  60% {
    transform: rotate(9deg);
  }
  80% {
    transform: rotate(-4deg);
  }
}

.uvq03-lcd input:focus-visible + .cs {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion:reduce) {
  .uvq03-lcd,.uvq03-lcd *,.uvq03-lcd *::before,.uvq03-lcd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

export default function TgLcdAlarm() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#41e0c4",
          "--c2": "#b9c5a3",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-lcd"><input type="checkbox" role="switch" /><span className="cs"><span className="bt"></span><span className="sc"><span className="dg"><b className="gs">88:88</b><b className="d">07:30</b></span><span className="ic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a6 6 0 0 0-6 6v4l-2 3h16l-2-3V9a6 6 0 0 0-6-6zm-2.2 15a2.2 2.2 0 0 0 4.4 0z" /></svg><b>AL</b></span></span></span>Daily alarm</label>
      </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 “Digital watch alarm toggle” block (Toggles) from AIMRAN Library to my project.

## What it is
A watch LCD with ghost segments: the bell icon darkens when the alarm is set, and pressing it lights the backlight.

## Chosen settings
- Main color: #41e0c4
- Secondary color: #b9c5a3
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Alarma diaria"

## 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
import type { CSSProperties } from "react";

const css = `
.uvq03-lcd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .8em;
  cursor: pointer;
  user-select: none;
  font-weight: 550;
}

.uvq03-lcd input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-lcd .cs {
  position: relative;
  display: block;
  flex: none;
  padding: .42em .5em;
  border-radius: .9em;
  background: linear-gradient(180deg,#2d2f34,#131417);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14),0 .55em 1em -.5em rgba(0,0,0,.6);
}

.uvq03-lcd .bt {
  position: absolute;
  right: -.26em;
  top: 50%;
  width: .3em;
  height: .9em;
  margin-top: -.45em;
  border-radius: .12em;
  background: linear-gradient(90deg,#4f5259,#a3a6ad);
  transition: transform calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-lcd .sc {
  position: relative;
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .38em .55em;
  border-radius: .42em;
  color: #1f2a1c;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2));
  box-shadow: inset 0 .12em .3em rgba(0,0,0,.4);
  transition: background calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-lcd .dg {
  position: relative;
  font: italic 700 1.35em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .02em;
}

.uvq03-lcd .gs {
  opacity: .09;
}

.uvq03-lcd .d {
  position: absolute;
  inset: 0;
}

.uvq03-lcd .ic {
  display: grid;
  justify-items: center;
  gap: .12em;
  opacity: .12;
}

.uvq03-lcd .ic svg {
  width: .95em;
  height: .95em;
  fill: currentColor;
  transform-origin: 50% 15%;
}

.uvq03-lcd .ic b {
  font: 800 .5em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}

.uvq03-lcd:hover .bt {
  transform: translateX(-.05em);
}

.uvq03-lcd:active .bt {
  transform: translateX(-.14em);
}

.uvq03-lcd:active .sc {
  background: radial-gradient(circle,color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
  box-shadow: inset 0 .12em .3em rgba(0,0,0,.25),0 0 1.1em -.2em var(--c1);
}

.uvq03-lcd input:checked + .cs .ic {
  opacity: 1;
}

.uvq03-lcd input:checked + .cs .ic svg {
  animation: uvq03-lcd calc(0.7s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq03-lcd {
  20% {
    transform: rotate(16deg);
  }
  40% {
    transform: rotate(-14deg);
  }
  60% {
    transform: rotate(9deg);
  }
  80% {
    transform: rotate(-4deg);
  }
}

.uvq03-lcd input:focus-visible + .cs {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion:reduce) {
  .uvq03-lcd,.uvq03-lcd *,.uvq03-lcd *::before,.uvq03-lcd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

export default function TgLcdAlarm() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#41e0c4",
          "--c2": "#b9c5a3",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-lcd"><input type="checkbox" role="switch" /><span className="cs"><span className="bt"></span><span className="sc"><span className="dg"><b className="gs">88:88</b><b className="d">07:30</b></span><span className="ic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a6 6 0 0 0-6 6v4l-2 3h16l-2-3V9a6 6 0 0 0-6-6zm-2.2 15a2.2 2.2 0 0 0 4.4 0z" /></svg><b>AL</b></span></span></span>Daily alarm</label>
      </div>
    </>
  );
}
```

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