Theme
On this page (3)
Component Skill — components/search-summary/component-skill.md

Native basis

A <div role="status">: "248 results for “calm software”", the time, a "did you mean" link and a clear-search link.

Web Platform APIs

:has()

Classes

.mk-search-summary.mk-search-summary-time.mk-search-summary-suggest.mk-search-summary-clear

Data attributes

data-variant="compact".

§Default

role="status": the count, the query in <q>, how long it took, "did you mean" and clear - announced politely when it changes.

§Compact

data-variant='compact': count and query only - above a filtered list.

§CSS view file

/* -- Search Summary (website · Search & Navigation) -----------------------
   Shows the active query and number of matches - the count, the query, a "did you mean", how long it took and how to clear it. */
@layer components {
  /* every box in the block measures border-box - the same on any page */
  :where(.mk-search-summary, .mk-search-summary *, .mk-search-summary ::before, .mk-search-summary ::after) { box-sizing: border-box; }
  .mk-search-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; padding-block: 0.75rem; border-block-end: 1px solid var(--border); font-size: 0.9375rem;
    & p { margin: 0; }
    & strong { font-weight: 700; }
    & q { font-weight: 600; quotes: "“" "”"; }
  }
  .mk-search-summary-time { color: var(--muted-foreground); font-size: 0.8125rem; }
  .mk-search-summary-suggest { flex-basis: 100%; color: var(--muted-foreground); font-size: 0.875rem;
    & a { color: var(--primary); font-weight: 600; font-style: italic; }
  }
  .mk-search-summary-clear { margin-inline-start: auto; color: var(--muted-foreground); font-size: 0.8125rem;
    &:hover { color: var(--foreground); }
  }
  .mk-search-summary[data-variant="compact"] { padding-block: 0.375rem; border: 0; font-size: 0.8125rem; color: var(--muted-foreground);
    & strong { color: var(--foreground); }
  }
  /* -- Accessibility ------------------------------------------- */
  @media (forced-colors: active) {
    .mk-search-summary { border-color: CanvasText; }
  }
}

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