Theme
On this page (4)
Component Skill — components/speaker-item/component-skill.md

Native basis

An <article> named by the speaker: a portrait with descriptive alt, name, role and company, an optional bio and a link to the session.

Web Platform APIs

<article>object-fitaspect-ratioContainer queries

Classes

.mk-speaker-item.mk-speaker-item-photo.mk-speaker-item-body.mk-speaker-item-name.mk-speaker-item-role.mk-speaker-item-bio.mk-speaker-item-talk.mk-speaker-item-keynote

Data attributes

data-variant: featured, compact.

§Grid

Default: a square grayscale portrait that turns to color on hover or focus, name, role and a link to the talk.

§Keynote

data-variant='featured': the keynote - a 4:5 portrait beside the bio, larger type, a keynote label.

§Compact

data-variant='compact': a round portrait with name, role and talk on one row - for agendas and sidebars.

§CSS view file

/* -- Speaker Item (website · Events & Promotions) -------------------------
   Introduces one speaker with a portrait, role, and biography - with their talk, as a card, a featured keynote or a compact row. */
@layer components {
  /* every box in the block measures border-box - the same on any page */
  :where(.mk-speaker-item, .mk-speaker-item *, .mk-speaker-item ::before, .mk-speaker-item ::after) { box-sizing: border-box; }
  .mk-speaker-item { display: flex; flex-direction: column; gap: 0.875rem; }
  .mk-speaker-item-photo { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-xl); background: var(--muted); filter: grayscale(1) contrast(1.05); transition: filter 300ms ease; }
  .mk-speaker-item:hover .mk-speaker-item-photo, .mk-speaker-item:focus-within .mk-speaker-item-photo { filter: none; }
  .mk-speaker-item-body { display: grid; gap: 0.25rem; }
  .mk-speaker-item-name { margin: 0; font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
  .mk-speaker-item-role { margin: 0; color: var(--muted-foreground); font-size: 0.875rem; }
  .mk-speaker-item-bio { margin: 0.5rem 0; color: var(--muted-foreground); line-height: 1.65; text-wrap: pretty; }
  .mk-speaker-item-talk { display: inline-flex; align-items: flex-start; gap: 0.375rem; margin-block-start: 0.375rem; color: var(--primary); font-size: 0.875rem; font-weight: 600; text-decoration: none; line-height: 1.4;
    & svg { flex: none; width: 0.875rem; height: 0.875rem; margin-block-start: 0.15rem; }
    &:hover { text-decoration: underline; text-underline-offset: 3px; }
    &:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
  }
  .mk-speaker-item[data-variant="featured"] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--card);
    color: var(--card-foreground);
    & .mk-speaker-item-photo { aspect-ratio: 4 / 5; filter: none; }
    & .mk-speaker-item-name { font-size: 1.75rem; letter-spacing: -0.02em; }
    & .mk-speaker-item-role { font-size: 1rem; }
  }
  .mk-speaker-item-keynote { width: fit-content; margin-block-end: 0.5rem; padding: 0.125rem 0.625rem; border-radius: 999px; background: var(--foreground); color: var(--background); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
  .mk-speaker-item[data-variant="compact"] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.875rem;
    & .mk-speaker-item-photo { width: 3.5rem; height: 3.5rem; border-radius: 50%; filter: none; }
    & .mk-speaker-item-body { gap: 0; }
    & .mk-speaker-item-name { font-size: 0.9375rem; }
    & .mk-speaker-item-talk { margin: 0.125rem 0 0; font-size: 0.8125rem; }
  }
  /* -- Accessibility ------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    .mk-speaker-item-photo { transition: none; }
  }
  @media (forced-colors: active) {
    .mk-speaker-item[data-variant="featured"] { border-color: CanvasText; }
  }
}

Comments, ideas or improvements? Edit this page's source on GitHub