# Ribbon bookmark toggle

> A satin ribbon peeks out of a notebook and drops down to hang below it when you save the page.

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

## Where to use it

This switch is a small hardback notebook with ruled pages, a red margin line and a stack of page edges. A satin ribbon peeks out at the top; turning the switch on lets the ribbon fall below the cover with a forked end and a gentle swing, just like marking a page in a real book. It suits read later lists, saved articles, recipes and course progress.

The main color is the ribbon and the second one is the paper. Try a green ribbon on cream pages or a gold one on grey, and use a short label such as Save or Read later beside it.

## Code

### HTML

```html
<label class="uvq03-bmk"><input type="checkbox" role="switch"><span class="bk"><i class="pg"></i><i class="rb"></i></span>Save for later</label>
```

### CSS

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

.uvq03-bmk {
  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-bmk input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-bmk .bk {
  position: relative;
  display: block;
  flex: none;
  width: 3.3em;
  height: 3.9em;
  margin: .2em 0 .9em;
  border-radius: .2em .45em .45em .2em;
  background: linear-gradient(90deg,#1f2a3f,#33445f 18%,#2b3a54);
  box-shadow: 0 .5em .9em -.45em rgba(0,0,0,.55);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-bmk .bk i {
  position: absolute;
  display: block;
}

.uvq03-bmk .pg {
  left: .28em;
  top: .2em;
  right: .2em;
  bottom: .3em;
  border-radius: .1em .3em .3em .1em;
  background: linear-gradient(90deg,rgba(0,0,0,.14),transparent .3em),linear-gradient(90deg,transparent .5em,rgba(215,60,60,.5) .5em .55em,transparent .55em),repeating-linear-gradient(180deg,transparent 0 .38em,rgba(70,110,170,.3) .38em .42em),var(--c2);
  box-shadow: .06em .06em 0 #e2dccb,.12em .12em 0 #d6cfbb,.18em .18em 0 rgba(0,0,0,.18);
}

.uvq03-bmk .rb {
  right: .7em;
  top: -.1em;
  width: .5em;
  height: 1.1em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c1) 75%,#000),var(--c1) 35%,color-mix(in srgb,var(--c1) 65%,#fff) 55%,var(--c1) 72%);
  clip-path: polygon(0 0,100% 0,100% 100%,50% calc(100% - .28em),0 100%);
  transform-origin: 50% 0;
  transition: height calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-bmk:hover input:not(:checked) + .bk .rb {
  height: 1.5em;
}

.uvq03-bmk:active .bk {
  transform: scale(.96);
}

.uvq03-bmk input:checked + .bk .rb {
  height: 4.9em;
  animation: uvq03-bmk calc(1.1s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.2s / var(--k));
}

@keyframes uvq03-bmk {
  25% {
    transform: rotate(6deg);
  }
  50% {
    transform: rotate(-4deg);
  }
  75% {
    transform: rotate(1.5deg);
  }
}

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

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

### React

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

const css = `
.uvq03-bmk {
  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-bmk input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-bmk .bk {
  position: relative;
  display: block;
  flex: none;
  width: 3.3em;
  height: 3.9em;
  margin: .2em 0 .9em;
  border-radius: .2em .45em .45em .2em;
  background: linear-gradient(90deg,#1f2a3f,#33445f 18%,#2b3a54);
  box-shadow: 0 .5em .9em -.45em rgba(0,0,0,.55);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-bmk .bk i {
  position: absolute;
  display: block;
}

.uvq03-bmk .pg {
  left: .28em;
  top: .2em;
  right: .2em;
  bottom: .3em;
  border-radius: .1em .3em .3em .1em;
  background: linear-gradient(90deg,rgba(0,0,0,.14),transparent .3em),linear-gradient(90deg,transparent .5em,rgba(215,60,60,.5) .5em .55em,transparent .55em),repeating-linear-gradient(180deg,transparent 0 .38em,rgba(70,110,170,.3) .38em .42em),var(--c2);
  box-shadow: .06em .06em 0 #e2dccb,.12em .12em 0 #d6cfbb,.18em .18em 0 rgba(0,0,0,.18);
}

.uvq03-bmk .rb {
  right: .7em;
  top: -.1em;
  width: .5em;
  height: 1.1em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c1) 75%,#000),var(--c1) 35%,color-mix(in srgb,var(--c1) 65%,#fff) 55%,var(--c1) 72%);
  clip-path: polygon(0 0,100% 0,100% 100%,50% calc(100% - .28em),0 100%);
  transform-origin: 50% 0;
  transition: height calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-bmk:hover input:not(:checked) + .bk .rb {
  height: 1.5em;
}

.uvq03-bmk:active .bk {
  transform: scale(.96);
}

.uvq03-bmk input:checked + .bk .rb {
  height: 4.9em;
  animation: uvq03-bmk calc(1.1s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.2s / var(--k));
}

@keyframes uvq03-bmk {
  25% {
    transform: rotate(6deg);
  }
  50% {
    transform: rotate(-4deg);
  }
  75% {
    transform: rotate(1.5deg);
  }
}

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

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

export default function TgBookmark() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c8102e",
          "--c2": "#f7f0de",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-bmk"><input type="checkbox" role="switch" /><span className="bk"><i className="pg"></i><i className="rb"></i></span>Save for later</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 “Ribbon bookmark toggle” block (Toggles) from AIMRAN Library to my project.

## What it is
A satin ribbon peeks out of a notebook and drops down to hang below it when you save the page.

## Chosen settings
- Main color: #c8102e
- Secondary color: #f7f0de
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Guardar para después"

## 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-bmk {
  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-bmk input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-bmk .bk {
  position: relative;
  display: block;
  flex: none;
  width: 3.3em;
  height: 3.9em;
  margin: .2em 0 .9em;
  border-radius: .2em .45em .45em .2em;
  background: linear-gradient(90deg,#1f2a3f,#33445f 18%,#2b3a54);
  box-shadow: 0 .5em .9em -.45em rgba(0,0,0,.55);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-bmk .bk i {
  position: absolute;
  display: block;
}

.uvq03-bmk .pg {
  left: .28em;
  top: .2em;
  right: .2em;
  bottom: .3em;
  border-radius: .1em .3em .3em .1em;
  background: linear-gradient(90deg,rgba(0,0,0,.14),transparent .3em),linear-gradient(90deg,transparent .5em,rgba(215,60,60,.5) .5em .55em,transparent .55em),repeating-linear-gradient(180deg,transparent 0 .38em,rgba(70,110,170,.3) .38em .42em),var(--c2);
  box-shadow: .06em .06em 0 #e2dccb,.12em .12em 0 #d6cfbb,.18em .18em 0 rgba(0,0,0,.18);
}

.uvq03-bmk .rb {
  right: .7em;
  top: -.1em;
  width: .5em;
  height: 1.1em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c1) 75%,#000),var(--c1) 35%,color-mix(in srgb,var(--c1) 65%,#fff) 55%,var(--c1) 72%);
  clip-path: polygon(0 0,100% 0,100% 100%,50% calc(100% - .28em),0 100%);
  transform-origin: 50% 0;
  transition: height calc(0.55s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-bmk:hover input:not(:checked) + .bk .rb {
  height: 1.5em;
}

.uvq03-bmk:active .bk {
  transform: scale(.96);
}

.uvq03-bmk input:checked + .bk .rb {
  height: 4.9em;
  animation: uvq03-bmk calc(1.1s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.2s / var(--k));
}

@keyframes uvq03-bmk {
  25% {
    transform: rotate(6deg);
  }
  50% {
    transform: rotate(-4deg);
  }
  75% {
    transform: rotate(1.5deg);
  }
}

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

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

export default function TgBookmark() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c8102e",
          "--c2": "#f7f0de",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-bmk"><input type="checkbox" role="switch" /><span className="bk"><i className="pg"></i><i className="rb"></i></span>Save for later</label>
      </div>
    </>
  );
}
```

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