Blocks
Offer block
The offer as the posts and the Creator plan ad close: a centered Funnel Display headline, the terms in capitals with concrete numbers and one White button, with the light flowing in around them or from the top over a plan card.
Install
React apps get the React files; every other stack gets the web component.
npx spyglass-ds add offer-block<script type="module" src="/spyglass-ds/elements/offer-block.js"></script>Stop screenshotting at midnight.
Creator
$10 for your first month, then $20/month
- AI-powered research across brands, creators, ads, and campaigns
- Unlimited board swipe files, alerts, and tracked brands
- Unlimited team seats
Usage
The last section of a page, or the pricing page's top: one offer, one action.
Never
- Terms without numbers
- Two offers in one block
- The light boxed in behind the headline
Adds with it: ascii-texture, brand-light, button
Props
The web component takes the same as attributes or properties (<spyglass-offer-block>); title is heading there.
<OfferBlock>
| Prop | Type | Default |
|---|---|---|
headline | ReactNode | |
note | ReactNode The terms, set in capitals: "$10 for your first month, then $20/month". | |
cta | { label: string; href?: string } The White button. | |
light | 'corner' | 'field' corner (the offer post) or field (the plan ad). | 'corner' |
seed | number | 0 |
texture | boolean The ASCII texture behind the light. | true |
children | ReactNode Instead of the terms and the button: a plan card. | |
className | string |
Examples
The same example in React and as web components; both render identically.
import { OfferBlock } from '@/react/components/blocks/OfferBlock'
// The offer post: the headline, the terms in capitals and one White button.
export default function Post() {
return <OfferBlock headline="Stop screenshotting at midnight." note="$10 for your first month, then $20/month" cta={{ label: 'Start Creator for 50% off', href: '#pricing' }} />
}<!-- The offer post: the headline, the terms in capitals and one White button. -->
<spyglass-offer-block headline="Stop screenshotting at midnight." note="$10 for your first month, then $20/month" cta='{"label":"Start Creator for 50% off","href":"#pricing"}'></spyglass-offer-block>import { OfferBlock } from '@/react/components/blocks/OfferBlock'
import { PlanCard } from '@/react/components/site/PlanCard'
// The Creator plan ad: the light field over the headline and the plan card.
export default function Plan() {
return (
<OfferBlock headline="Stop screenshotting at midnight." light="field" seed={0}>
<PlanCard
className="w-150 max-w-full text-left"
title="Creator"
price="$10 for your first month, then $20/month"
features={['AI-powered research across brands, creators, ads, and campaigns', 'Unlimited board swipe files, alerts, and tracked brands', 'Unlimited team seats']}
cta="Start Creator for 50% off"
/>
</OfferBlock>
)
}<!-- The Creator plan ad: the light field over the headline and the plan card. -->
<spyglass-offer-block headline="Stop screenshotting at midnight." light="field" seed="0">
<spyglass-plan-card class="w-150 max-w-full text-left" heading="Creator" price="$10 for your first month, then $20/month" features='["AI-powered research across brands, creators, ads, and campaigns","Unlimited board swipe files, alerts, and tracked brands","Unlimited team seats"]' cta="Start Creator for 50% off"></spyglass-plan-card>
</spyglass-offer-block>Source
import type { ReactNode } from 'react'
import { Button } from '@/react/components/ui/Button'
import { BrandLight } from '@/react/components/visuals/BrandLight'
import { AsciiTexture } from '@/react/components/visuals/AsciiTexture'
import { cn } from '@/react/lib/cn'
// The offer, as the posts and the Creator plan ad close: a centered Funnel Display headline, the terms in capitals
// with concrete numbers, and one White button, with the light flowing in around them (`corner`) or from the top
// (`field`, as the ad sets it over a plan card); on phones, where the corners are too close to the
// headline, the corner light becomes the field above it. The children replace the terms and the button (a plan card). The
// offer post's spacing times 2/3: the terms 24px under the headline, the button 24px under the terms.
export interface OfferBlockProps {
headline: ReactNode
/** The terms, set in capitals: "$10 for your first month, then $20/month". */
note?: ReactNode
/** The White button. */
cta?: { label: string; href?: string }
/** corner (the offer post) or field (the plan ad). */
light?: 'corner' | 'field'
seed?: number
/** The ASCII texture behind the light. */
texture?: boolean
/** Instead of the terms and the button: a plan card. */
children?: ReactNode
className?: string
}
// Where the texture keeps clear, in its 1440x900 frame: the headline and the terms, or the column of the plan card.
const CLEAR = { corner: [{ x: 200, y: 140, w: 1040, h: 620 }], field: [{ x: 280, y: 0, w: 880, h: 900 }] }
export function OfferBlock({ headline, note, cta, light = 'corner', seed = 0, texture = true, children, className }: OfferBlockProps) {
return (
<section data-ds="offer-block" className={cn('relative isolate overflow-hidden bg-surface text-fg', className)}>
{texture && <AsciiTexture seed={seed + 3} width={1440} height={900} density={0.35} clear={CLEAR[light] ?? CLEAR.corner} cover className="absolute inset-0 -z-10 size-full" />}
{light === 'corner' ? (
<>
<BrandLight variant="corner" seed={seed} ground={false} cover className="absolute inset-0 -z-10 size-full max-sm:hidden" />
<BrandLight variant="field" seed={seed} ground={false} cover className="absolute inset-x-0 top-0 -z-10 h-48 mask-b-from-40% sm:hidden" />
</>
) : (
<BrandLight variant="field" seed={seed} ground={false} cover className="absolute inset-x-0 top-0 -z-10 h-80 mask-b-from-40% max-sm:h-48" />
)}
<div className={cn('mx-auto flex w-full max-w-page flex-col items-center px-12 text-center max-sm:px-4', light === 'field' ? 'pt-72 pb-24 max-sm:pt-44 max-sm:pb-16' : 'py-32 max-sm:pt-44 max-sm:pb-20')}>
<h2 className="max-w-3xl type-section">{headline}</h2>
{children ? (
<div className="mt-12 flex w-full justify-center max-sm:mt-8">{children}</div>
) : (
<>
{note && <p className="mt-6 type-label text-fg">{note}</p>}
{cta && <Button href={cta.href} size="lg" className="mt-6">{cta.label}</Button>}
</>
)}
</div>
</section>
)
}
export default OfferBlock// 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 { ifDefined } from 'lit/directives/if-defined.js'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import '@/elements/components/ui/button'
import '@/elements/components/visuals/ascii-texture'
import '@/elements/components/visuals/brand-light'
import styles from 'virtual:tw'
// OfferBlock.tsx as <spyglass-offer-block>: the centered headline, the terms in capitals (`note`) and one White button
// (`cta`, { label, href }), the light around (`corner`) or from the top (`field`); the default slot (a plan card)
// replaces the terms and the button.
const CLEAR = { corner: [{ x: 200, y: 140, w: 1040, h: 620 }], field: [{ x: 280, y: 0, w: 880, h: 900 }] }
/**
* @summary The offer: headline, terms and one White button, in the light.
* @slot - A plan card, instead of the terms and the button.
*/
export class OfferBlock extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="offer-block"]'))
static properties = { headline: {}, note: {}, cta: { type: Object }, light: {}, seed: { type: Number }, texture: { type: Boolean, converter: { fromAttribute: (v: string | null) => v !== 'false' } } }
headline = ''
/** The terms, set in capitals. */
note?: string
/** The White button ({ label, href }). */
cta?: { label: string; href?: string }
/** corner or field. */
light: 'corner' | 'field' = 'corner'
seed = 0
/** The ASCII texture behind the light (texture="false" to leave it out). */
texture = true
render() {
const field = this.light === 'field'
return html`<section data-ds="offer-block" class="relative isolate overflow-hidden bg-surface text-fg">${this.texture ? html`<spyglass-ascii-texture seed=${this.seed + 3} width="1440" height="900" density="0.35" .clear=${CLEAR[this.light] ?? CLEAR.corner} cover class="absolute inset-0 -z-10 size-full"></spyglass-ascii-texture>` : nothing}${field ? html`<spyglass-brand-light variant="field" seed=${this.seed} ground="false" cover class="absolute inset-x-0 top-0 -z-10 h-80 mask-b-from-40% max-sm:h-48"></spyglass-brand-light>` : html`<spyglass-brand-light variant="corner" seed=${this.seed} ground="false" cover class="absolute inset-0 -z-10 size-full max-sm:hidden"></spyglass-brand-light><spyglass-brand-light variant="field" seed=${this.seed} ground="false" cover class="absolute inset-x-0 top-0 -z-10 h-48 mask-b-from-40% sm:hidden"></spyglass-brand-light>`}<div class=${['mx-auto flex w-full max-w-page flex-col items-center px-12 text-center max-sm:px-4', field ? 'pt-72 pb-24 max-sm:pt-44 max-sm:pb-16' : 'py-32 max-sm:pt-44 max-sm:pb-20'].join(' ')}><h2 class="max-w-3xl type-section">${this.headline}</h2>${this.hasSlot() ? html`<div class="mt-12 flex w-full justify-center max-sm:mt-8"><slot></slot></div>` : html`${this.note ? html`<p class="mt-6 type-label text-fg">${this.note}</p>` : nothing}${this.cta ? html`<spyglass-button href=${ifDefined(this.cta.href)} size="lg" class="mt-6">${this.cta.label}</spyglass-button>` : nothing}`}</div></section>`
}
}
define('offer-block', OfferBlock)Reference: Figma page 8: Post, Offer (Stop screenshotting at midnight. at 404; $10 for your first month, then $20/month in capitals at 580; Button, Start Creator for 50% off 320x64 at 626); Ad, Creator plan offer (Light field 1080x612 over the headline and the plan card).