Site

Proof strip

The site's proof marquee: marks in the muted gray moving left at a slow constant speed, fading out at both ends; under a mouse it stops and the mark under the pointer turns White; still with reduced motion.

Install

React apps get the React files; every other stack gets the web component.

npx spyglass-ds add proof-strip
<script type="module" src="/spyglass-ds/elements/proof-strip.js"></script>
Acme placeholders
  • Acme
  • Acme Labs
  • Acme Studio
  • Acme Goods
  • Acme Air
  • Acme & Co

Usage

Showing who uses the product under a hero or a sign-in form, with marks you are allowed to show.

Never

  • Third-party logos without permission: the default marks are Acme wordmarks
  • Marks in their own colors: they are drawn in the muted gray
  • Marks that move or grow on hover

Props

The web component takes the same as attributes or properties (<spyglass-proof-strip>); title is heading there.

<ProofStrip>

PropTypeDefault
logosProofLogo[]proofPlaceholders
tightboolean

48px between marks instead of 64 (the sign-in page's row).

false
classNamestring

Examples

The same example in React and as web components; both render identically.

react/examples/proof-strip/Marks.tsx
import { ProofStrip } from '@/react/components/site/ProofStrip'
// The marquee with Acme placeholder marks, set as wordmarks.

export default function Marks() {
  return <ProofStrip />
}
elements/examples/proof-strip/Marks.html
<!-- The marquee with Acme placeholder marks, set as wordmarks. -->
<spyglass-proof-strip></spyglass-proof-strip>

Source

react/components/site/ProofStrip.tsx
import type { CSSProperties } from 'react'
import { cn } from '@/react/lib/cn'

// The site's proof marquee (v3/V3Proof ProofStrip): a row of marks in the muted gray moving left at a constant, slow
// speed (one copy every 68s, linear, as constant motion is), fading out at both ends over 14% of the row. Under a mouse
// the row stops and the mark under the pointer turns White (color only; nothing moves). With reduced motion the row
// holds still. The moving row is hidden from assistive tech; the names are listed once for it instead.
// Marks come in through `logos`: an SVG or PNG `src` drawn as a mask in the gray (its own colors are not used), or,
// with no `src`, the name set as a Funnel Display wordmark, so no third-party logo is ever drawn by default.
export interface ProofLogo {
  name: string
  /** The mark's file (SVG or PNG), drawn in the muted gray. Leave out to set the name as a wordmark. */
  src?: string
  /** Its width over its height. */
  ratio?: number
  /** Its height in px (16 to 32). */
  height?: number
}

export interface ProofStripProps {
  logos?: ProofLogo[]
  /** 48px between marks instead of 64 (the sign-in page's row). */
  tight?: boolean
  className?: string
}

export const proofPlaceholders: ProofLogo[] = [{ name: 'Acme' }, { name: 'Acme Labs' }, { name: 'Acme Studio' }, { name: 'Acme Goods' }, { name: 'Acme Air' }, { name: 'Acme & Co' }]

export function ProofStrip({ logos = proofPlaceholders, tight = false, className }: ProofStripProps) {
  return (
    <div data-ds="proof-strip" className={cn('w-full max-w-288', className)}>
      <style href="ds-proof-strip" precedence="ds">{css}</style>
      <ul className="sr-only">{[...new Set(logos.map((l) => l.name))].map((name) => <li key={name}>{name}</li>)}</ul>
      <div aria-hidden="true" className="ds-proof-strip group/strip overflow-hidden">
        <ul role="list" className="ds-proof-track flex w-max items-center">
          {[0, 1, 2].flatMap((copy) => logos.map((l, i) => (
            <li key={`${copy}-${i}-${l.name}`} className={cn('group/mark grid h-8 flex-none place-items-center', tight ? 'px-6' : 'px-8')}>
              {l.src
                ? <span className="block bg-fg-muted transition-[background-color] duration-160 ease-out pointer-fine:group-hover/mark:bg-fg" style={{ height: l.height ?? 24, width: (l.height ?? 24) * (l.ratio ?? 4), mask: `url("${l.src}") center / contain no-repeat` } as CSSProperties} />
                : <span className="type-heading-4 whitespace-nowrap text-fg-muted transition-[color] duration-160 ease-out pointer-fine:group-hover/mark:text-fg">{l.name}</span>}
            </li>
          )))}
        </ul>
      </div>
    </div>
  )
}

export default ProofStrip

const css = `
.ds-proof-strip { mask-image: linear-gradient(to right, transparent, var(--ds-color-black) 14%, var(--ds-color-black) 86%, transparent); }
.ds-proof-track { animation: ds-proof-strip 68s linear infinite; }
@keyframes ds-proof-strip { to { transform: translateX(calc(-100% / 3)); } }
@media (hover: hover) and (pointer: fine) { .ds-proof-strip:hover .ds-proof-track { animation-play-state: paused; } }
@media (prefers-reduced-motion: reduce) { .ds-proof-track { animation: none; } }
`
react/lib/cn.ts
// Joins class names, skipping falsy ones: cn('a', on && 'b', ['c', undefined]). It does not merge conflicting
// utilities (no tailwind-merge), as Vue's class binding does not: the library's classes are written not to compete,
// and a className from the caller is appended after them, as Vue appends a fallthrough class.
export type ClassValue = string | false | null | undefined | 0 | ClassValue[]

export function cn(...values: ClassValue[]): string {
	const out: string[] = []
	for (const v of values) {
		if (!v) continue
		if (Array.isArray(v)) {
			const s = cn(...v)
			if (s) out.push(s)
		}
		else out.push(v)
	}
	return out.join(' ')
}
elements/components/site/proof-strip.ts
import { html } from 'lit'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import styles from 'virtual:tw'

// ProofStrip.tsx as <spyglass-proof-strip>: the site's proof marquee, marks in the muted gray moving left at a constant
// slow speed and fading at both ends; under a mouse it stops and the mark under the pointer turns White; still with
// reduced motion. `logos` as JSON: { name, src?, ratio?, height? }; with no `src` the name is set as a wordmark.

export interface ProofLogo { name: string; src?: string; ratio?: number; height?: number }
export const proofPlaceholders: ProofLogo[] = [{ name: 'Acme' }, { name: 'Acme Labs' }, { name: 'Acme Studio' }, { name: 'Acme Goods' }, { name: 'Acme Air' }, { name: 'Acme & Co' }]

/** @summary The proof marquee: marks moving slowly in a row that fades at its ends. */
export class ProofStrip extends DsElement {
	static styles = [DsElement.styles, styles]
	protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="proof-strip"]'))
	static properties = { logos: { type: Array }, tight: { type: Boolean } }
	/** The marks: { name, src?, ratio?, height? }. */
	logos: ProofLogo[] = proofPlaceholders
	/** 48px between marks instead of 64 (the sign-in page's row). */
	tight = false

	render() {
		const logos = this.logos ?? proofPlaceholders
		return html`<div data-ds="proof-strip" class="w-full max-w-288"><ul class="sr-only">${[...new Set(logos.map((l) => l.name))].map((name) => html`<li>${name}</li>`)}</ul><div aria-hidden="true" class="ds-proof-strip group/strip overflow-hidden"><ul role="list" class="ds-proof-track flex w-max items-center">${[0, 1, 2].flatMap(() => logos.map((l) => html`<li class=${`group/mark grid h-8 flex-none place-items-center ${this.tight ? 'px-6' : 'px-8'}`}>${l.src ? html`<span class="block bg-fg-muted transition-[background-color] duration-160 ease-out pointer-fine:group-hover/mark:bg-fg" style=${`height: ${l.height ?? 24}px; width: ${(l.height ?? 24) * (l.ratio ?? 4)}px; mask: url("${l.src}") center / contain no-repeat`}></span>` : html`<span class="type-heading-4 whitespace-nowrap text-fg-muted transition-[color] duration-160 ease-out pointer-fine:group-hover/mark:text-fg">${l.name}</span>`}</li>`))}</ul></div></div>`
	}
}

define('proof-strip', ProofStrip)
elements/components/site/proof-strip.css
.ds-proof-strip { mask-image: linear-gradient(to right, transparent, var(--ds-color-black) 14%, var(--ds-color-black) 86%, transparent); }
.ds-proof-track { animation: ds-proof-strip 68s linear infinite; }
@keyframes ds-proof-strip { to { transform: translateX(calc(-100% / 3)); } }
@media (hover: hover) and (pointer: fine) { .ds-proof-strip:hover .ds-proof-track { animation-play-state: paused; } }
@media (prefers-reduced-motion: reduce) { .ds-proof-track { animation: none; } }

Reference: Site v3/V3Proof ProofStrip (V3Proof.module.css): three copies of the row moving one copy every 68s, linear; a 14% fade at each end; 32px slots 64px apart (48 on the sign-in page); --text-3 marks turning White on hover; paused on hover; none with reduced motion.