Skip to content
Honor Society®Brand system

v0.15.1

Forms and controls

Search

One white pill box that holds the search field, a clear button and a navy Search pill, in a GET form.

Block
.hs-search
CSS
components/search.css (in /brand.css)
JS
components/search.js: load it only on a page with this component
Status
Decided
Markdown
/components/search.md

What it is

A search form drawn as one white pill box. The box holds the field, a round clear button and the submit. The submit is a navy pill labelled Search, or a magnifier in the compact header size. The box looks the same on white, soft and navy grounds, so no ground needs its own button colour.

When to use

  • The hero of a search-first page, such as the help center home (--large).
  • The head of a catalog or a results page: the scholarship directory, the benefits list, site search, a help center category (default, in the Page head).
  • A keyword search inside a content band, above a list (default).
  • A search in the site header (--compact).

When not to use

  • To narrow a list by fixed values (type, level, tier): use the Filter panel.
  • To switch between a few categories of one short list: use Filter chips.
  • As a second search on a page that already shows one. A page with a search in its hero or head leaves the header search out.

Rules

  • Markup: form.hs-search[role="search"][method="get"] > label.hs-visually-hidden + input.hs-search__input[type="search"] + button.hs-search__clear[type="button"] + button.hs-button.hs-button--navy.hs-button--sm.hs-search__button[type="submit"].
  • The box is a pill because it holds a pill: the curves of the box and the button share a centre. This is the one form control with the pill radius. Every other field keeps --hs-radius-sm.
  • The submit is always the navy pill. The search never takes the gold: the page's gold button stays its one gold element.
  • The submit label is Search. The placeholder names what the search covers ("Search help articles") or shows an example query ("nursing, study abroad").
  • --compact puts button.hs-search__button.hs-search__button--icon[aria-label="Search"] with the magnifier in place of the pill. It has no .hs-button class.
  • The form submits with GET, so every search has a URL, the back button keeps it and it works without JavaScript. The keyword parameter is q unless the platform fixes its own.
  • Print the current keyword back into value, escaped. Never print it unescaped anywhere on the page.
  • components/search.js sets .is-filled on the form while the field has a value; that shows the clear button. Without the script the clear button stays hidden, and Escape still clears the field.
  • A suggestion list hangs under the form, at the form's width.

Accessibility

  • role="search" makes the form a search landmark.
  • The label is visually hidden but present: it names the field ("Search help articles"). The button text names the action. The icon submit and the clear button take aria-label.
  • Focus on the field shows on the whole box: gold outline, navy ring, navy border. Where :has() is missing, the ring shows on the field.
  • Targets: the field, the clear button and the submit are 40px or more (48px in --large). Field text is 16px or more, so iOS does not zoom on focus.
  • Field text ink 13.0:1, placeholder slate 6.2:1, box border slate 500 3.7:1 on white. White on the navy pill 12.4:1.

Variants

Large, in a hero

A 58px box at 18px text, under the hero lead. The box stays white on navy.

Preview on navy

<form class="hs-search hs-search--large" role="search" method="get" action="/hc/en-us/search">
  <label class="hs-visually-hidden" for="search-hero">Search help articles</label>
  <input class="hs-search__input" id="search-hero" type="search" name="query" placeholder="Search help articles, questions, or keywords">
  <button class="hs-search__clear" type="button" aria-label="Clear search"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
  <button class="hs-button hs-button--navy hs-button--sm hs-search__button" type="submit">Search</button>
</form>

Default, in a page head

The catalog head: eyebrow, H1, lead, then the search in place of the action row.

Full-width preview: the snippet sets its own ground

Scholarships

Scholarship directory

Awards from Honor Society® and other providers, each with its own eligibility, deadline and application.

<section class="hs-band hs-band--soft hs-page-head" data-section="hero">
  <div class="hs-container">
    <p class="hs-eyebrow">Scholarships</p>
    <h1 class="hs-heading hs-heading--h1 hs-heading--rule">Scholarship directory</h1>
    <p class="hs-lead hs-page-head__lead">Awards from Honor Society&reg; and other providers, each with its own eligibility, deadline and application.</p>
    <form class="hs-search" role="search" method="get" action="/scholarship-directory">
      <label class="hs-visually-hidden" for="search-directory">Search scholarships</label>
      <input class="hs-search__input" id="search-directory" type="search" name="q" placeholder="nursing, study abroad">
      <button class="hs-search__clear" type="button" aria-label="Clear search"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
      <button class="hs-button hs-button--navy hs-button--sm hs-search__button" type="submit">Search</button>
    </form>
  </div>
</section>

Default, in a content band

A keyword search above a list, with a value and the clear button.

Preview on white

<form class="hs-search is-filled" role="search" method="get" action="/search/node">
  <label class="hs-visually-hidden" for="search-site">Search honorsociety.org</label>
  <input class="hs-search__input" id="search-site" type="search" name="q" value="leadership">
  <button class="hs-search__clear" type="button" aria-label="Clear search"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
  <button class="hs-button hs-button--navy hs-button--sm hs-search__button" type="submit">Search</button>
</form>

Compact, in a site header

A 40px box with a magnifier submit, for a navy header bar. The header's gold button stays its one gold element.

Preview on navy

<form class="hs-search hs-search--compact" role="search" method="get" action="/search">
  <label class="hs-visually-hidden" for="search-header">Search the store</label>
  <input class="hs-search__input" id="search-header" type="search" name="q" placeholder="Search the store">
  <button class="hs-search__clear" type="button" aria-label="Clear search"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
  <button class="hs-search__button hs-search__button--icon" type="submit" aria-label="Search"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="6.5"/><path d="m16 16 4.5 4.5"/></svg></button>
</form>