Menu

Components

Flat card

akaOSS's feed card: no edge and no fill at rest, a wash of the ink on hover and focus, and a cover that zooms a little.

Usage

A feed

Uses.aka-card-flat.aka-cover-zoom

<ol className="-mx-2 grid gap-x-2 gap-y-4 sm:grid-cols-3">
  <li className="min-w-0">
    <a href={post.href} className="aka-card-flat p-2 pb-3.5">
      <div className="aka-cover-zoom aspect-[16/10] rounded-xl">
        <DemoImage src={post.src} alt="" width={post.width} height={post.height} className="h-full w-full object-cover" />
      </div>
      <p className="mt-3 font-mono text-12 text-muted-foreground">{post.meta}</p>
      <h3 className="mt-1 text-17 font-normal leading-snug text-foreground">{post.title}</h3>
      <p className="mt-1 line-clamp-3 text-14 font-light leading-relaxed text-muted-foreground">{post.summary}</p>
    </a>
  </li>
</ol>

From akaOSS's research feed. Cards carry no border and no rule; space separates them, and the 3 percent wash says which one is under the pointer or the keyboard. The negative margin lines the text up with the column while the wash reaches past it.

Examples

Without a cover

<a href="/aka-style/laws" className="aka-card-flat p-3">
  <p className="font-mono text-12 text-muted-foreground">Reference</p>
  <h3 className="mt-1 text-17 font-normal text-foreground">The Laws</h3>
</a>

The wash works on its own. aka-cover-zoom only matters where there is a picture to move.

Best practices

When to use

  • A feed or an index of many like items, where an edge on every card would read as a grid of boxes.
  • The card ladder instead for a single card, a specimen, or anything that must read as a surface at rest.

Behaviour

  • The wash is a 3 percent mix of the ink over --dur-ink, on hover and on keyboard focus alike.
  • The cover scales to 1.03 over 500ms ease-out, the plate's own timing, and only where hover exists.
  • Under reduced motion the cover does not zoom at all. akaOSS removes only the transition, so its cover still jumps; the system version follows aka-card-lift and drops the transform.
  • The corner is --radius-flat, 1.25rem, larger than the ladder's because the wash extends past the content.

Accessibility

  • The whole card is one link and its title is the name; keep the rest of the text inside it short.
  • A cover that carries no information takes alt="".
  • Focus shows the wash and the select ring together.

CSS

The rules, as globals.css has them, with the reasoning the stylesheet keeps beside them.

app/globals.css, line 811
@layer components {
  /*
   * The flat card, from akaOSS: the second surface style beside the ladder.
   *
   * No edge and no fill at rest. In a feed of many cards an edge on each one
   * turns the page into a grid of boxes, so space separates them instead,
   * and the card under the pointer or the keyboard takes a 3% wash of the
   * ink. The wash is a held state, not a pulse: it is the secondary button's
   * fill, at a card's scale.
   *
   * The cover zooms with the plate's own timing, so the two image hovers on
   * the site share one. Hover rules sit under (hover: hover), since a CSS
   * rule does not get Tailwind's hoverOnlyWhenSupported. Under reduced
   * motion the cover does not zoom at all, the way .aka-card-lift drops its
   * transform; akaOSS removes only the transition, so its cover still jumps.
   */
  .aka-card-flat {
    display: block;
    border-radius: var(--radius-flat);
    transition: background-color var(--dur-ink) ease;
  }
  @media (hover: hover) {
    .aka-card-flat:hover {
      background-color: color-mix(in srgb, var(--foreground) 3%, transparent);
    }
  }
  .aka-card-flat:focus-visible {
    background-color: color-mix(in srgb, var(--foreground) 3%, transparent);
  }
  .aka-cover-zoom {
    position: relative;
    overflow: hidden;
  }
  .aka-cover-zoom img {
    @apply transition-transform duration-500 ease-out;
  }
  @media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .aka-card-flat:hover .aka-cover-zoom img {
      transform: scale(1.03);
    }
  }
}