# Library card catalogue filter

> A wooden card catalogue cabinet where each subject is a drawer with a brass pull that slides out when ticked.

- Category: [Filters](https://library.aimran.es/components/filters)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-f-card-catalog
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Library card catalogues were the original filter: one drawer per subject, full of index cards. Here each drawer is a checkbox with a typed label in a brass frame, and checking it pulls the drawer forward to show the cards inside. The wood grain is made only of CSS gradients. It suits bookshops, archives, course catalogues and reading apps.

Use the first colour for the brass hardware and the second for the wood, from pale oak to walnut. Keep the labels to one short word, and pair the cabinet with a result list that groups items by the open drawers.

## Code

### HTML

```html
<fieldset class="uvq05-cc"><legend>Subjects</legend><div class="cab"><label><input type="checkbox"><span class="dw"><span class="cards" aria-hidden="true"></span><span class="fr"><span class="tag">Art</span><i class="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" checked><span class="dw"><span class="cards" aria-hidden="true"></span><span class="fr"><span class="tag">Science</span><i class="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox"><span class="dw"><span class="cards" aria-hidden="true"></span><span class="fr"><span class="tag">History</span><i class="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox"><span class="dw"><span class="cards" aria-hidden="true"></span><span class="fr"><span class="tag">Poetry</span><i class="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" checked><span class="dw"><span class="cards" aria-hidden="true"></span><span class="fr"><span class="tag">Travel</span><i class="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox"><span class="dw"><span class="cards" aria-hidden="true"></span><span class="fr"><span class="tag">Kitchen</span><i class="pl" aria-hidden="true"></i></span></span></label></div><p class="ct"><span>Open drawers:</span> <span class="n"></span></p></fieldset>
```

### CSS

```css
.uvq05-cc {
  --c1: #c9a227;
  --c2: #7a4a2a;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq05-cc {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  width: 17em;
  counter-reset: uvq05-cc;
}

.uvq05-cc legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq05-cc .cab {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: .75em .5em;
  padding: .6em .6em 1em;
  border-radius: .55em;
  background: repeating-linear-gradient(96deg,rgba(0,0,0,.08) 0 .12em,transparent .12em .6em),linear-gradient(170deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2) 40%,color-mix(in srgb,var(--c2) 75%,#000));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25),inset 0 .15em 0 rgba(255,255,255,.18),0 1.4em 2.4em -1.4em rgba(0,0,0,.6);
}

.uvq05-cc label {
  position: relative;
  cursor: pointer;
}

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

.uvq05-cc input:checked {
  counter-increment: uvq05-cc;
}

.uvq05-cc .dw {
  position: relative;
  display: block;
  height: 3.3em;
  border-radius: .25em;
  background: #1e130b;
  box-shadow: inset 0 .3em .5em rgba(0,0,0,.75);
}

.uvq05-cc .cards {
  position: absolute;
  left: .3em;
  right: .3em;
  top: .35em;
  height: 1.1em;
  border-radius: .1em .1em 0 0;
  background: repeating-linear-gradient(180deg,#f3ead3 0 .16em,#c9b88f .16em .21em);
  transform: translateY(.5em);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-cc .cards::before {
  content: "";
  position: absolute;
  left: 18%;
  top: -.28em;
  width: 1em;
  height: .32em;
  border-radius: .1em .1em 0 0;
  background: #f3ead3;
  box-shadow: 1.5em .08em 0 #e9dcbc;
}

.uvq05-cc .fr {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35em;
  border-radius: .25em;
  background: repeating-linear-gradient(92deg,rgba(0,0,0,.06) 0 .1em,transparent .1em .5em),linear-gradient(180deg,color-mix(in srgb,var(--c2) 72%,#fff),color-mix(in srgb,var(--c2) 90%,#fff));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28),inset 0 .12em 0 rgba(255,255,255,.25),0 .1em .15em rgba(0,0,0,.3);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1),box-shadow calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-cc .tag {
  max-width: 90%;
  padding: .15em .4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 .56em ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #3a2a1a;
  background: #f6eedb;
  border-radius: .1em;
  box-shadow: 0 0 0 .16em var(--c1),0 0 0 .24em rgba(0,0,0,.3);
}

.uvq05-cc .pl {
  width: 1.3em;
  height: .45em;
  border-radius: 0 0 .8em .8em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 65%,#fff),var(--c1) 50%,color-mix(in srgb,var(--c1) 60%,#000));
  box-shadow: 0 .12em .15em rgba(0,0,0,.45);
}

.uvq05-cc label:hover .fr {
  transform: translateY(.12em);
}

.uvq05-cc label:active .fr {
  transform: translateY(.3em) scale(1.02);
}

.uvq05-cc label:has(input:checked) {
  z-index: 2;
}

.uvq05-cc input:checked+.dw .fr {
  transform: translateY(.75em) scale(1.05);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28),inset 0 .12em 0 rgba(255,255,255,.25),0 .7em .8em -.2em rgba(0,0,0,.55);
}

.uvq05-cc input:checked+.dw .cards {
  transform: translateY(-.1em);
}

.uvq05-cc input:focus-visible+.dw {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq05-cc .ct {
  margin: .8em 0 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}

.uvq05-cc .n::before {
  content: counter(uvq05-cc);
  font-weight: 800;
  color: var(--fg);
}
```

### React

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

const css = `
.uvq05-cc {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  width: 17em;
  counter-reset: uvq05-cc;
}

.uvq05-cc legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq05-cc .cab {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: .75em .5em;
  padding: .6em .6em 1em;
  border-radius: .55em;
  background: repeating-linear-gradient(96deg,rgba(0,0,0,.08) 0 .12em,transparent .12em .6em),linear-gradient(170deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2) 40%,color-mix(in srgb,var(--c2) 75%,#000));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25),inset 0 .15em 0 rgba(255,255,255,.18),0 1.4em 2.4em -1.4em rgba(0,0,0,.6);
}

.uvq05-cc label {
  position: relative;
  cursor: pointer;
}

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

.uvq05-cc input:checked {
  counter-increment: uvq05-cc;
}

.uvq05-cc .dw {
  position: relative;
  display: block;
  height: 3.3em;
  border-radius: .25em;
  background: #1e130b;
  box-shadow: inset 0 .3em .5em rgba(0,0,0,.75);
}

.uvq05-cc .cards {
  position: absolute;
  left: .3em;
  right: .3em;
  top: .35em;
  height: 1.1em;
  border-radius: .1em .1em 0 0;
  background: repeating-linear-gradient(180deg,#f3ead3 0 .16em,#c9b88f .16em .21em);
  transform: translateY(.5em);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-cc .cards::before {
  content: "";
  position: absolute;
  left: 18%;
  top: -.28em;
  width: 1em;
  height: .32em;
  border-radius: .1em .1em 0 0;
  background: #f3ead3;
  box-shadow: 1.5em .08em 0 #e9dcbc;
}

.uvq05-cc .fr {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35em;
  border-radius: .25em;
  background: repeating-linear-gradient(92deg,rgba(0,0,0,.06) 0 .1em,transparent .1em .5em),linear-gradient(180deg,color-mix(in srgb,var(--c2) 72%,#fff),color-mix(in srgb,var(--c2) 90%,#fff));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28),inset 0 .12em 0 rgba(255,255,255,.25),0 .1em .15em rgba(0,0,0,.3);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1),box-shadow calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-cc .tag {
  max-width: 90%;
  padding: .15em .4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 .56em ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #3a2a1a;
  background: #f6eedb;
  border-radius: .1em;
  box-shadow: 0 0 0 .16em var(--c1),0 0 0 .24em rgba(0,0,0,.3);
}

.uvq05-cc .pl {
  width: 1.3em;
  height: .45em;
  border-radius: 0 0 .8em .8em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 65%,#fff),var(--c1) 50%,color-mix(in srgb,var(--c1) 60%,#000));
  box-shadow: 0 .12em .15em rgba(0,0,0,.45);
}

.uvq05-cc label:hover .fr {
  transform: translateY(.12em);
}

.uvq05-cc label:active .fr {
  transform: translateY(.3em) scale(1.02);
}

.uvq05-cc label:has(input:checked) {
  z-index: 2;
}

.uvq05-cc input:checked+.dw .fr {
  transform: translateY(.75em) scale(1.05);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28),inset 0 .12em 0 rgba(255,255,255,.25),0 .7em .8em -.2em rgba(0,0,0,.55);
}

.uvq05-cc input:checked+.dw .cards {
  transform: translateY(-.1em);
}

.uvq05-cc input:focus-visible+.dw {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq05-cc .ct {
  margin: .8em 0 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}

.uvq05-cc .n::before {
  content: counter(uvq05-cc);
  font-weight: 800;
  color: var(--fg);
}
`;

export default function FCardCatalog() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c9a227",
          "--c2": "#7a4a2a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq05-cc"><legend>Subjects</legend><div className="cab"><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Art</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" checked={true} /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Science</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">History</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Poetry</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" checked={true} /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Travel</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Kitchen</span><i className="pl" aria-hidden="true"></i></span></span></label></div><p className="ct"><span>Open drawers:</span> <span className="n"></span></p></fieldset>
      </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 “Library card catalogue filter” block (Filters) from AIMRAN Library to my project.

## What it is
A wooden card catalogue cabinet where each subject is a drawer with a brass pull that slides out when ticked.

## Chosen settings
- Main color: #c9a227
- Secondary color: #7a4a2a
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Materias"

## 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 = `
.uvq05-cc {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  width: 17em;
  counter-reset: uvq05-cc;
}

.uvq05-cc legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
}

.uvq05-cc .cab {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: .75em .5em;
  padding: .6em .6em 1em;
  border-radius: .55em;
  background: repeating-linear-gradient(96deg,rgba(0,0,0,.08) 0 .12em,transparent .12em .6em),linear-gradient(170deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2) 40%,color-mix(in srgb,var(--c2) 75%,#000));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25),inset 0 .15em 0 rgba(255,255,255,.18),0 1.4em 2.4em -1.4em rgba(0,0,0,.6);
}

.uvq05-cc label {
  position: relative;
  cursor: pointer;
}

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

.uvq05-cc input:checked {
  counter-increment: uvq05-cc;
}

.uvq05-cc .dw {
  position: relative;
  display: block;
  height: 3.3em;
  border-radius: .25em;
  background: #1e130b;
  box-shadow: inset 0 .3em .5em rgba(0,0,0,.75);
}

.uvq05-cc .cards {
  position: absolute;
  left: .3em;
  right: .3em;
  top: .35em;
  height: 1.1em;
  border-radius: .1em .1em 0 0;
  background: repeating-linear-gradient(180deg,#f3ead3 0 .16em,#c9b88f .16em .21em);
  transform: translateY(.5em);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-cc .cards::before {
  content: "";
  position: absolute;
  left: 18%;
  top: -.28em;
  width: 1em;
  height: .32em;
  border-radius: .1em .1em 0 0;
  background: #f3ead3;
  box-shadow: 1.5em .08em 0 #e9dcbc;
}

.uvq05-cc .fr {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35em;
  border-radius: .25em;
  background: repeating-linear-gradient(92deg,rgba(0,0,0,.06) 0 .1em,transparent .1em .5em),linear-gradient(180deg,color-mix(in srgb,var(--c2) 72%,#fff),color-mix(in srgb,var(--c2) 90%,#fff));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28),inset 0 .12em 0 rgba(255,255,255,.25),0 .1em .15em rgba(0,0,0,.3);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1),box-shadow calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq05-cc .tag {
  max-width: 90%;
  padding: .15em .4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 .56em ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #3a2a1a;
  background: #f6eedb;
  border-radius: .1em;
  box-shadow: 0 0 0 .16em var(--c1),0 0 0 .24em rgba(0,0,0,.3);
}

.uvq05-cc .pl {
  width: 1.3em;
  height: .45em;
  border-radius: 0 0 .8em .8em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 65%,#fff),var(--c1) 50%,color-mix(in srgb,var(--c1) 60%,#000));
  box-shadow: 0 .12em .15em rgba(0,0,0,.45);
}

.uvq05-cc label:hover .fr {
  transform: translateY(.12em);
}

.uvq05-cc label:active .fr {
  transform: translateY(.3em) scale(1.02);
}

.uvq05-cc label:has(input:checked) {
  z-index: 2;
}

.uvq05-cc input:checked+.dw .fr {
  transform: translateY(.75em) scale(1.05);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28),inset 0 .12em 0 rgba(255,255,255,.25),0 .7em .8em -.2em rgba(0,0,0,.55);
}

.uvq05-cc input:checked+.dw .cards {
  transform: translateY(-.1em);
}

.uvq05-cc input:focus-visible+.dw {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq05-cc .ct {
  margin: .8em 0 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}

.uvq05-cc .n::before {
  content: counter(uvq05-cc);
  font-weight: 800;
  color: var(--fg);
}
`;

export default function FCardCatalog() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c9a227",
          "--c2": "#7a4a2a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq05-cc"><legend>Subjects</legend><div className="cab"><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Art</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" checked={true} /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Science</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">History</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Poetry</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" checked={true} /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Travel</span><i className="pl" aria-hidden="true"></i></span></span></label><label><input type="checkbox" /><span className="dw"><span className="cards" aria-hidden="true"></span><span className="fr"><span className="tag">Kitchen</span><i className="pl" aria-hidden="true"></i></span></span></label></div><p className="ct"><span>Open drawers:</span> <span className="n"></span></p></fieldset>
      </div>
    </>
  );
}
```

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