# Dog-ear page checkbox

> A book page that folds its corner down when checked, the way you mark where you stopped reading.

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

## Where to use it

This checkbox is a whole page of a book, with greyed lines of text, a page number and a label. Checking it folds the top right corner down with a springy motion, showing the coloured back of the paper and a soft shadow, the classic dog-ear that marks a page. Hovering lifts the corner slightly. It fits reading apps, bookmarks, saved articles and study tools.

The main color is the back of the fold and the secondary color the paper. A registered CSS property drives the fold, so the size and spring are easy to tweak, and several pages side by side make a lively reading list.

## Code

### HTML

```html
<label class="uvq02-dog"><input type="checkbox"><span class="pg"><span class="ls" aria-hidden="true"><i></i><i></i><i></i><i></i></span><span class="tx">Mark this page</span><span class="nm" aria-hidden="true">87</span></span><span class="ea" aria-hidden="true"></span></label>
```

### CSS

```css
.uvq02-dog {
  --c1: #ff6b4a;
  --c2: #fffaf0;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

@property --uvq02-d {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.uvq02-dog {
  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;
  --uvq02-d: 0em;
  position: relative;
  display: block;
  width: 12.5em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 .5em .7em rgba(0,0,0,.22));
  transition: --uvq02-d calc(0.6s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

.uvq02-dog .pg {
  display: flex;
  flex-direction: column;
  gap: .55em;
  padding: 1.2em 1.3em .9em;
  background: linear-gradient(90deg,rgba(0,0,0,.05),transparent 1.2em),var(--c2);
  color: #2c2a26;
  clip-path: polygon(0 0,calc(100% - var(--uvq02-d)) 0,100% var(--uvq02-d),100% 100%,0 100%);
}

.uvq02-dog .ls {
  display: flex;
  flex-direction: column;
  gap: .45em;
}

.uvq02-dog .ls i {
  display: block;
  height: .36em;
  border-radius: 1em;
  background: rgba(44,42,38,.13);
}

.uvq02-dog .ls i:nth-child(2) {
  width: 92%;
}

.uvq02-dog .ls i:nth-child(3) {
  width: 97%;
}

.uvq02-dog .ls i:nth-child(4) {
  width: 58%;
}

.uvq02-dog .tx {
  margin-top: .3em;
  font-weight: 700;
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  font-size: 1.1em;
}

.uvq02-dog .nm {
  align-self: flex-end;
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  font-size: .72em;
  font-style: italic;
  color: rgba(44,42,38,.55);
}

.uvq02-dog .ea {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--uvq02-d);
  height: var(--uvq02-d);
  background: linear-gradient(45deg,color-mix(in srgb,var(--c1) 78%,#000),var(--c1) 30%,color-mix(in srgb,var(--c1) 70%,#fff) 49.5%,transparent 50%);
  filter: drop-shadow(-.12em .14em .1em rgba(0,0,0,.28));
}

.uvq02-dog:hover {
  --uvq02-d: .9em;
}

.uvq02-dog:has(input:checked) {
  --uvq02-d: 2.6em;
}

.uvq02-dog:active .pg {
  background-color: color-mix(in srgb,var(--c2) 94%,#000);
}

.uvq02-dog:active {
  --uvq02-d: 1.4em;
}

.uvq02-dog:has(input:checked) .tx {
  color: color-mix(in srgb,var(--c1) 70%,#2c2a26);
}

.uvq02-dog:has(input:focus-visible) {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

### React

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

const css = `
@property --uvq02-d {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.uvq02-dog {
  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;
  --uvq02-d: 0em;
  position: relative;
  display: block;
  width: 12.5em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 .5em .7em rgba(0,0,0,.22));
  transition: --uvq02-d calc(0.6s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

.uvq02-dog .pg {
  display: flex;
  flex-direction: column;
  gap: .55em;
  padding: 1.2em 1.3em .9em;
  background: linear-gradient(90deg,rgba(0,0,0,.05),transparent 1.2em),var(--c2);
  color: #2c2a26;
  clip-path: polygon(0 0,calc(100% - var(--uvq02-d)) 0,100% var(--uvq02-d),100% 100%,0 100%);
}

.uvq02-dog .ls {
  display: flex;
  flex-direction: column;
  gap: .45em;
}

.uvq02-dog .ls i {
  display: block;
  height: .36em;
  border-radius: 1em;
  background: rgba(44,42,38,.13);
}

.uvq02-dog .ls i:nth-child(2) {
  width: 92%;
}

.uvq02-dog .ls i:nth-child(3) {
  width: 97%;
}

.uvq02-dog .ls i:nth-child(4) {
  width: 58%;
}

.uvq02-dog .tx {
  margin-top: .3em;
  font-weight: 700;
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  font-size: 1.1em;
}

.uvq02-dog .nm {
  align-self: flex-end;
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  font-size: .72em;
  font-style: italic;
  color: rgba(44,42,38,.55);
}

.uvq02-dog .ea {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--uvq02-d);
  height: var(--uvq02-d);
  background: linear-gradient(45deg,color-mix(in srgb,var(--c1) 78%,#000),var(--c1) 30%,color-mix(in srgb,var(--c1) 70%,#fff) 49.5%,transparent 50%);
  filter: drop-shadow(-.12em .14em .1em rgba(0,0,0,.28));
}

.uvq02-dog:hover {
  --uvq02-d: .9em;
}

.uvq02-dog:has(input:checked) {
  --uvq02-d: 2.6em;
}

.uvq02-dog:active .pg {
  background-color: color-mix(in srgb,var(--c2) 94%,#000);
}

.uvq02-dog:active {
  --uvq02-d: 1.4em;
}

.uvq02-dog:has(input:checked) .tx {
  color: color-mix(in srgb,var(--c1) 70%,#2c2a26);
}

.uvq02-dog:has(input:focus-visible) {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function ChkDogear() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff6b4a",
          "--c2": "#fffaf0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-dog"><input type="checkbox" /><span className="pg"><span className="ls" aria-hidden="true"><i></i><i></i><i></i><i></i></span><span className="tx">Mark this page</span><span className="nm" aria-hidden="true">87</span></span><span className="ea" aria-hidden="true"></span></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 “Dog-ear page checkbox” block (Checkboxes) from AIMRAN Library to my project.

## What it is
A book page that folds its corner down when checked, the way you mark where you stopped reading.

## Chosen settings
- Main color: #ff6b4a
- Secondary color: #fffaf0
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Marcar esta página"

## 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 = `
@property --uvq02-d {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.uvq02-dog {
  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;
  --uvq02-d: 0em;
  position: relative;
  display: block;
  width: 12.5em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 .5em .7em rgba(0,0,0,.22));
  transition: --uvq02-d calc(0.6s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

.uvq02-dog .pg {
  display: flex;
  flex-direction: column;
  gap: .55em;
  padding: 1.2em 1.3em .9em;
  background: linear-gradient(90deg,rgba(0,0,0,.05),transparent 1.2em),var(--c2);
  color: #2c2a26;
  clip-path: polygon(0 0,calc(100% - var(--uvq02-d)) 0,100% var(--uvq02-d),100% 100%,0 100%);
}

.uvq02-dog .ls {
  display: flex;
  flex-direction: column;
  gap: .45em;
}

.uvq02-dog .ls i {
  display: block;
  height: .36em;
  border-radius: 1em;
  background: rgba(44,42,38,.13);
}

.uvq02-dog .ls i:nth-child(2) {
  width: 92%;
}

.uvq02-dog .ls i:nth-child(3) {
  width: 97%;
}

.uvq02-dog .ls i:nth-child(4) {
  width: 58%;
}

.uvq02-dog .tx {
  margin-top: .3em;
  font-weight: 700;
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  font-size: 1.1em;
}

.uvq02-dog .nm {
  align-self: flex-end;
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  font-size: .72em;
  font-style: italic;
  color: rgba(44,42,38,.55);
}

.uvq02-dog .ea {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--uvq02-d);
  height: var(--uvq02-d);
  background: linear-gradient(45deg,color-mix(in srgb,var(--c1) 78%,#000),var(--c1) 30%,color-mix(in srgb,var(--c1) 70%,#fff) 49.5%,transparent 50%);
  filter: drop-shadow(-.12em .14em .1em rgba(0,0,0,.28));
}

.uvq02-dog:hover {
  --uvq02-d: .9em;
}

.uvq02-dog:has(input:checked) {
  --uvq02-d: 2.6em;
}

.uvq02-dog:active .pg {
  background-color: color-mix(in srgb,var(--c2) 94%,#000);
}

.uvq02-dog:active {
  --uvq02-d: 1.4em;
}

.uvq02-dog:has(input:checked) .tx {
  color: color-mix(in srgb,var(--c1) 70%,#2c2a26);
}

.uvq02-dog:has(input:focus-visible) {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function ChkDogear() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff6b4a",
          "--c2": "#fffaf0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-dog"><input type="checkbox" /><span className="pg"><span className="ls" aria-hidden="true"><i></i><i></i><i></i><i></i></span><span className="tx">Mark this page</span><span className="nm" aria-hidden="true">87</span></span><span className="ea" aria-hidden="true"></span></label>
      </div>
    </>
  );
}
```

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