Blocks
How it works block
The home's set-up section: the headline, the lead, three numbered steps between hairlines, the connect menu beside the quiet button and the clients' marks, with the MCP session playing beside them from 1024.
Install
React apps get the React files; every other stack gets the web component.
npx spyglass-ds add how-it-works-block<script type="module" src="/spyglass-ds/elements/how-it-works-block.js"></script>Set up in under a minute
Add the MCP server to your AI tool and sign in. No API key needed for MCP.
Create a free account. 500 free credits every month. No card required.
Connect. Add the MCP server to your AI tool, or call the REST API.
Ask. Ask in plain words. The answer comes back as structured data.
Acme MCPConnected
getBrandMediaInsightstype: "HOOK", maxDaysBack: 90
23 hooks in the last 90 days. The top three:
| Hook | Ads |
|---|---|
| Seasonal openers, “It’s apple season” | 3 |
| Confessional overshare | 2 |
| Declarations of love for the soda | 2 |
Usage
Showing how to start in three steps, with the product answering a real question next to them.
Never
- Other companies' logos without permission: the default marks are first letters
- More than three steps
- Marks that move on hover: the others dim and the name appears
Adds with it: button, connect-menu, mcp-session, side-drifts
Props
The web component takes the same as attributes or properties (<spyglass-how-it-works-block>); title is heading there.
<HowItWorksBlock>
| Prop | Type | Default |
|---|---|---|
content | HowItWorksContent | |
marks | HowMark[] | howMarks |
connect | ConnectContent | |
session | SessionContent | |
className | string |
Examples
The same example in React and as web components; both render identically.
import { HowItWorksBlock } from '@/react/components/blocks/HowItWorksBlock'
// The three steps, the connect menu with Acme rows and the session asking Acme questions.
export default function Steps() {
return <HowItWorksBlock />
}<!-- The three steps, the connect menu with Acme rows and the session asking Acme questions. -->
<spyglass-how-it-works-block></spyglass-how-it-works-block>Source
import type { CSSProperties } from 'react'
import { Button } from '@/react/components/ui/Button'
import { ConnectMenu } from '@/react/components/site/ConnectMenu'
import { McpSession } from '@/react/components/site/McpSession'
import { SideDrifts } from '@/react/components/visuals/SideDrifts'
import type { ConnectContent } from '@/lib/connect'
import type { SessionContent } from '@/lib/home/session'
import { howItWorksContent, howMarks, type HowItWorksContent, type HowMark } from '@/lib/home/how-it-works'
import { cn } from '@/react/lib/cn'
// The home's set-up section (site v2/V2HowItWorks): on the left the headline, the lead, three numbered steps between
// hairlines, the connect menu beside the quiet button and the clients' marks (under a mouse the others dim and the
// mark's name appears under it; color and opacity only); on the right the MCP session playing (mcp-session). Five to
// seven columns from 1024, stacked below, centered head and the quiet button White and full width on phones (the menu steps aside, the site's MCP pair); a column drift at the left
// edge from 1440. `connect` and `session` go to the menu and the session; `marks` are the clients' marks.
export interface HowItWorksBlockProps {
content?: HowItWorksContent
marks?: HowMark[]
connect?: ConnectContent
session?: SessionContent
className?: string
}
const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'
export function HowItWorksBlock({ content: c = howItWorksContent, marks = howMarks, connect, session, className }: HowItWorksBlockProps) {
return (
<section data-ds="how-it-works-block" className={cn('relative isolate py-(--ds-layout-section) text-fg', className)}>
<style href="ds-how-it-works-block" precedence="ds">{css}</style>
<SideDrifts left="middle" right={false} />
<div className={cn(CONTAINER, 'ds-hw-layout')}>
<div className="ds-hw-copy">
<h2 className="type-section">{c.headline}</h2>
<p className="ds-hw-lead mt-6 max-w-(--ds-layout-measure) type-body-lg text-pretty text-fg-soft">{c.lead}</p>
<ol className="ds-hw-steps">
{c.steps.map((step, i) => (
<li key={step.title} className="ds-hw-step">
<span className="ds-hw-number" aria-hidden="true">{i + 1}</span>
<p className="ds-hw-step-text"><span className="ds-hw-step-title">{step.title}</span> {step.body}</p>
</li>
))}
</ol>
<div className="ds-hw-actions">
<div className="ds-hw-connect"><ConnectMenu content={connect} /></div>
<Button href={c.secondary.href} variant="secondary">{c.secondary.label}</Button>
</div>
{marks.length ? (
<ul className="ds-hw-marks" aria-label={c.marksLabel}>
{marks.map((m) => (
<li key={m.name}>
<a className="ds-hw-mark-link" href={m.href}>
{m.src ? <span className="ds-hw-mark" style={{ '--mark': `url("${m.src}")` } as CSSProperties} aria-hidden="true" /> : <span className="ds-hw-letter" aria-hidden="true">{m.name.replace(/^Acme /, '').slice(0, 1)}</span>}
<span className="ds-hw-mark-name">{m.name}</span>
</a>
</li>
))}
</ul>
) : null}
</div>
<McpSession content={session} />
</div>
</section>
)
}
export default HowItWorksBlock
const css = `
.ds-hw-layout { display: grid; gap: 48px; }
.ds-hw-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
@media (width < 1024px) { .ds-hw-copy > :first-child { text-box: trim-start cap alphabetic; } }
.ds-hw-steps { width: 100%; margin-top: 40px; border-top: var(--ds-border-hairline) solid var(--ds-color-edge); }
.ds-hw-step { display: grid; grid-template-columns: 32px minmax(0, 1fr); padding-block: 16px; border-bottom: var(--ds-border-hairline) solid var(--ds-color-edge); font-size: var(--ds-text-body); line-height: var(--ds-text-body-leading); }
.ds-hw-number { font-family: var(--ds-font-heading); font-variant-numeric: tabular-nums; color: var(--ds-color-fg-muted); }
.ds-hw-step-text { color: var(--ds-color-fg-soft); text-wrap: pretty; }
.ds-hw-step-title { font-weight: var(--ds-font-weight-medium); color: var(--ds-color-fg); }
.ds-hw-connect { display: contents; }
.ds-hw-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.ds-hw-marks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; margin-left: -8px; }
.ds-hw-mark-link { position: relative; display: grid; place-items: center; width: 40px; height: 40px; color: var(--ds-color-fg); transition: color var(--ds-duration-micro) var(--ds-easing-out); }
@media (pointer: coarse) { .ds-hw-mark-link::after { content: ""; position: absolute; inset: -4px; } }
.ds-hw-mark { width: 24px; height: 24px; background-color: currentColor; mask: var(--mark) center / contain no-repeat; }
.ds-hw-letter { display: grid; place-items: center; width: 24px; height: 24px; font-family: var(--ds-font-heading); font-size: var(--ds-text-heading-4); line-height: 1; }
.ds-hw-mark-name { position: absolute; top: 100%; left: 50%; color: var(--ds-color-fg); font-size: var(--ds-text-caption); line-height: var(--ds-text-caption-leading); white-space: nowrap; opacity: 0; translate: -50% 0; pointer-events: none; transition: opacity var(--ds-duration-micro) var(--ds-easing-out); }
@media (hover: hover) and (pointer: fine) {
.ds-hw-marks:has(.ds-hw-mark-link:hover) .ds-hw-mark-link:not(:hover) { color: var(--ds-color-fg-muted); }
.ds-hw-mark-link:hover .ds-hw-mark-name { opacity: 1; }
}
.ds-hw-marks:has(.ds-hw-mark-link:focus-visible) .ds-hw-mark-link:not(:focus-visible) { color: var(--ds-color-fg-muted); }
.ds-hw-mark-link:focus-visible .ds-hw-mark-name { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ds-hw-mark-link, .ds-hw-mark-name { transition: none; } }
@media (width < 768px) {
.ds-hw-copy { align-items: stretch; }
.ds-hw-actions { display: grid; }
.ds-hw-actions > * { width: 100%; }
/* The site's MCP pair on phones (globals.css [data-mcp-pair]): the connect menu steps aside and the quiet button turns
White, the row's one White button. */
.ds-hw-connect { display: none; }
.ds-hw-actions { --ds-color-action-secondary: var(--ds-color-action-primary); --ds-color-action-secondary-hover: var(--ds-color-action-primary-hover); --ds-color-action-secondary-fg: var(--ds-color-action-primary-fg); --ds-color-action-secondary-edge: var(--ds-color-action-primary); --ds-color-action-secondary-edge-hover: var(--ds-color-action-primary-hover); }
.ds-hw-copy > h2, .ds-hw-lead { align-self: center; text-align: center; }
}
@media (min-width: 1024px) { .ds-hw-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: stretch; gap: 64px; } }
`// The home's set-up section (site v2/V2HowItWorks, content/v2/how-it-works): the copy, the three steps and the
// clients' marks under the buttons. The marks are neutral placeholders (each client's first letter); the site's are
// other companies' logos, which come through `marks` with a `src`. Both flavors read this file.
export interface HowMark {
name: string
href: string
/** The mark (an SVG file, drawn as a mask in the type's color, 24px). Leave out for its first letter. */
src?: string
}
export interface HowItWorksContent {
headline: string
lead: string
steps: { title: string; body: string }[]
/** The quiet button beside the connect menu. */
secondary: { label: string; href: string }
marksLabel: string
}
export const howItWorksContent: HowItWorksContent = {
headline: 'Set up in under a minute',
lead: 'Add the MCP server to your AI tool and sign in. No API key needed for MCP.',
steps: [
{ title: 'Create a free account.', body: '500 free credits every month. No card required.' },
{ title: 'Connect.', body: 'Add the MCP server to your AI tool, or call the REST API.' },
{ title: 'Ask.', body: 'Ask in plain words. The answer comes back as structured data.' },
],
secondary: { label: 'Get a free API key', href: '/sign-up' },
marksLabel: 'AI tools',
}
export const howMarks: HowMark[] = ['Acme Chat', 'Acme Code', 'Acme Assistant', 'Acme Agent', 'Acme Editor', 'Acme Search', 'Any MCP client'].map((name) => ({ name, href: '#' }))// 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(' ')
}import { html, nothing } from 'lit'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import '@/elements/components/ui/button'
import '@/elements/components/site/connect-menu'
import '@/elements/components/site/mcp-session'
import '@/elements/components/visuals/side-drifts'
import type { ConnectContent } from '@/lib/connect'
import type { SessionContent } from '@/lib/home/session'
import { howItWorksContent, howMarks, type HowItWorksContent, type HowMark } from '@/lib/home/how-it-works'
import styles from 'virtual:tw'
// HowItWorksBlock.tsx as <spyglass-how-it-works-block>: the headline, lead, three steps, the connect menu and the
// quiet button, the clients' marks, and the MCP session beside them from 1024. `content`, `marks`, `connect` and
// `session` as JSON.
const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'
/** @summary The home's set-up section: three steps, the connect menu and the MCP session playing. */
export class HowItWorksBlock extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="how-it-works-block"]'))
static properties = { content: { type: Object }, marks: { type: Array }, connect: { type: Object }, session: { type: Object } }
/** { headline, lead, steps, secondary, marksLabel }. */
content: HowItWorksContent = howItWorksContent
/** The clients' marks: { name, href, src? }. */
marks: HowMark[] = howMarks
/** The connect menu's rows (lib/connect.ts). */
connect?: ConnectContent
/** The session's questions (lib/home/session.ts). */
session?: SessionContent
render() {
const c = this.content ?? howItWorksContent
const marks = this.marks ?? howMarks
return html`<section data-ds="how-it-works-block" class="relative isolate py-(--ds-layout-section) text-fg"><spyglass-side-drifts left="middle" right="false"></spyglass-side-drifts><div class=${`${CONTAINER} ds-hw-layout`}><div class="ds-hw-copy"><h2 class="type-section">${c.headline}</h2><p class="ds-hw-lead mt-6 max-w-(--ds-layout-measure) type-body-lg text-pretty text-fg-soft">${c.lead}</p><ol class="ds-hw-steps">${c.steps.map((step, i) => html`<li class="ds-hw-step"><span class="ds-hw-number" aria-hidden="true">${i + 1}</span><p class="ds-hw-step-text"><span class="ds-hw-step-title">${step.title}</span> ${step.body}</p></li>`)}</ol><div class="ds-hw-actions"><div class="ds-hw-connect"><spyglass-connect-menu .content=${this.connect}></spyglass-connect-menu></div><spyglass-button href=${c.secondary.href} variant="secondary">${c.secondary.label}</spyglass-button></div>${marks.length ? html`<ul class="ds-hw-marks" aria-label=${c.marksLabel}>${marks.map((m) => html`<li><a class="ds-hw-mark-link" href=${m.href}>${m.src ? html`<span class="ds-hw-mark" style=${`--mark: url("${m.src}")`} aria-hidden="true"></span>` : html`<span class="ds-hw-letter" aria-hidden="true">${m.name.replace(/^Acme /, '').slice(0, 1)}</span>`}<span class="ds-hw-mark-name">${m.name}</span></a></li>`)}</ul>` : nothing}</div><spyglass-mcp-session .content=${this.session}></spyglass-mcp-session></div></section>`
}
}
define('how-it-works-block', HowItWorksBlock).ds-hw-layout { display: grid; gap: 48px; }
.ds-hw-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
@media (width < 1024px) { .ds-hw-copy > :first-child { text-box: trim-start cap alphabetic; } }
.ds-hw-steps { width: 100%; margin-top: 40px; border-top: var(--ds-border-hairline) solid var(--ds-color-edge); }
.ds-hw-step { display: grid; grid-template-columns: 32px minmax(0, 1fr); padding-block: 16px; border-bottom: var(--ds-border-hairline) solid var(--ds-color-edge); font-size: var(--ds-text-body); line-height: var(--ds-text-body-leading); }
.ds-hw-number { font-family: var(--ds-font-heading); font-variant-numeric: tabular-nums; color: var(--ds-color-fg-muted); }
.ds-hw-step-text { color: var(--ds-color-fg-soft); text-wrap: pretty; }
.ds-hw-step-title { font-weight: var(--ds-font-weight-medium); color: var(--ds-color-fg); }
.ds-hw-connect { display: contents; }
.ds-hw-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.ds-hw-marks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; margin-left: -8px; }
.ds-hw-mark-link { position: relative; display: grid; place-items: center; width: 40px; height: 40px; color: var(--ds-color-fg); transition: color var(--ds-duration-micro) var(--ds-easing-out); }
@media (pointer: coarse) { .ds-hw-mark-link::after { content: ""; position: absolute; inset: -4px; } }
.ds-hw-mark { width: 24px; height: 24px; background-color: currentColor; mask: var(--mark) center / contain no-repeat; }
.ds-hw-letter { display: grid; place-items: center; width: 24px; height: 24px; font-family: var(--ds-font-heading); font-size: var(--ds-text-heading-4); line-height: 1; }
.ds-hw-mark-name { position: absolute; top: 100%; left: 50%; color: var(--ds-color-fg); font-size: var(--ds-text-caption); line-height: var(--ds-text-caption-leading); white-space: nowrap; opacity: 0; translate: -50% 0; pointer-events: none; transition: opacity var(--ds-duration-micro) var(--ds-easing-out); }
@media (hover: hover) and (pointer: fine) {
.ds-hw-marks:has(.ds-hw-mark-link:hover) .ds-hw-mark-link:not(:hover) { color: var(--ds-color-fg-muted); }
.ds-hw-mark-link:hover .ds-hw-mark-name { opacity: 1; }
}
.ds-hw-marks:has(.ds-hw-mark-link:focus-visible) .ds-hw-mark-link:not(:focus-visible) { color: var(--ds-color-fg-muted); }
.ds-hw-mark-link:focus-visible .ds-hw-mark-name { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ds-hw-mark-link, .ds-hw-mark-name { transition: none; } }
@media (width < 768px) {
.ds-hw-copy { align-items: stretch; }
.ds-hw-actions { display: grid; }
.ds-hw-actions > * { width: 100%; }
/* The site's MCP pair on phones (globals.css [data-mcp-pair]): the connect menu steps aside and the quiet button turns
White, the row's one White button. */
.ds-hw-connect { display: none; }
.ds-hw-actions { --ds-color-action-secondary: var(--ds-color-action-primary); --ds-color-action-secondary-hover: var(--ds-color-action-primary-hover); --ds-color-action-secondary-fg: var(--ds-color-action-primary-fg); --ds-color-action-secondary-edge: var(--ds-color-action-primary); --ds-color-action-secondary-edge-hover: var(--ds-color-action-primary-hover); }
.ds-hw-copy > h2, .ds-hw-lead { align-self: center; text-align: center; }
}
@media (min-width: 1024px) { .ds-hw-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: stretch; gap: 64px; } }Reference: Site v2/V2HowItWorks (V2HowItWorks.tsx and .module.css, Session.tsx and .module.css, sessionClock.ts, content/v2/how-it-works): five to seven columns 64px apart from 1024, 48px stacked; steps 16px tall padding between hairlines with a 32px number column; actions 12px apart, 40px under the steps; marks 40px tiles 8px apart; the session stage 480px least, 40px in (24/16 on phones), the window's foot fading over 96px; the column drift at the left from 1440; on phones the connect menu hidden and the quiet button White (globals.css [data-mcp-pair]).