Site
Plan card
The Creator plan card from the ad: the plan's name in Funnel Display, the price as a sentence with concrete numbers, the lines it includes and one full-width White button, on the #262626 fill with the brand corner.
Install
React apps get the React files; every other stack gets the web component.
npx spyglass-ds add plan-card<script type="module" src="/spyglass-ds/elements/plan-card.js"></script>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
A plan on a pricing page or under an offer headline. One plan card per plan, the button saying what it starts.
Never
- A border, a shadow or a glow
- A colored or second button in the card
- Check marks or icons before the lines: the ad sets them as plain lines
- A price without numbers ("Affordable")
The copy in the example is the ad's own. onSelect (React) and the select event (web component) fire when the button is pressed; href makes the button a link.
Adds with it: button
Props
The web component takes the same as attributes or properties (<spyglass-plan-card>); title is heading there.
<PlanCard>
| Prop | Type | Default |
|---|---|---|
title | ReactNode The plan's name. | |
price | ReactNode The price, as a sentence with concrete numbers. | |
features | string[] What the plan includes, one line each. | [] |
cta | string The button's label. | |
href | string Makes the button a link. | |
onSelect | () => void Called when the button is pressed. | |
className | string |
Examples
The same example in React and as web components; both render identically.
import { PlanCard } from '@/react/components/site/PlanCard'
// The Creator plan, as the ad sets it.
export default function Creator() {
return (
<PlanCard
className="w-150 max-w-full"
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"
/>
)
}<!-- The Creator plan, as the ad sets it. -->
<spyglass-plan-card class="w-150 max-w-full" 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>Source
import type { ReactNode } from 'react'
import { Button } from '@/react/components/ui/Button'
import { cn } from '@/react/lib/cn'
// The site's plan tier (pages/Pricing .tier): a #262626 fill on Black with the 8px corner, 24px in; the plan's name in
// Funnel Display 32/36 at 400, the price line in DM Sans, what the plan includes as #D4D4D4 14/20 lines under a
// #4D4D4D hairline, and one full-width White button. The price 16px under the name, the lines 24px under it and 8px
// apart, the button 24px below
// (cards stretched side by side keep their buttons on one line: the lines take the extra height).
export interface PlanCardProps {
/** The plan's name. */
title: ReactNode
/** The price, as a sentence with concrete numbers. */
price?: ReactNode
/** What the plan includes, one line each. */
features?: string[]
/** The button's label. */
cta?: string
/** Makes the button a link. */
href?: string
/** Called when the button is pressed. */
onSelect?: () => void
className?: string
}
export function PlanCard({ title, price, features = [], cta, href, onSelect, className }: PlanCardProps) {
return (
<div data-ds="plan-card" className={cn('flex flex-col rounded-panel bg-surface-raised p-6 text-fg', className)}>
<h3 className="type-heading-2">{title}</h3>
{price && <p className="mt-4 type-body text-fg">{price}</p>}
{features.length > 0 && (
<ul className="mt-6 flex grow flex-col gap-2 border-t border-edge-surface pt-6 type-ui text-fg-soft">
{features.map((f) => <li key={f}>{f}</li>)}
</ul>
)}
{cta && <Button href={href} onClick={onSelect} className="mt-6 w-full">{cta}</Button>}
</div>
)
}
export default PlanCard// 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 styles from 'virtual:tw'
// PlanCard.tsx as <spyglass-plan-card>: the site's plan tier, the #262626 fill with the 8px corner, the plan's name
// (`heading`, React's `title`), the price line, the lines it includes (`features`, a list) and one full-width White
// button (`cta`, a link with `href`). Pressing the button fires `select`.
/**
* @summary The plan card: name, price, what it includes and one White button.
* @fires select - The button was pressed.
*/
export class PlanCard extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="plan-card"]'))
static properties = { heading: {}, price: {}, features: { type: Array }, cta: {}, href: {} }
/** The plan's name (React's `title`). */
heading = ''
/** The price, as a sentence with concrete numbers. */
price?: string
/** What the plan includes, one line each. */
features: string[] = []
/** The button's label. */
cta?: string
/** Makes the button a link. */
href?: string
render() {
const features = this.features ?? []
return html`<div data-ds="plan-card" class="flex flex-col rounded-panel bg-surface-raised p-6 text-fg"><h3 class="type-heading-2">${this.heading}</h3>${this.price ? html`<p class="mt-4 type-body text-fg">${this.price}</p>` : nothing}${features.length ? html`<ul class="mt-6 flex grow flex-col gap-2 border-t border-edge-surface pt-6 type-ui text-fg-soft">${features.map((f) => html`<li>${f}</li>`)}</ul>` : nothing}${this.cta ? html`<spyglass-button href=${ifDefined(this.href)} class="mt-6 w-full" @click=${() => this.emit('select')}>${this.cta}</spyglass-button>` : nothing}</div>`
}
}
define('plan-card', PlanCard)Reference: Figma page 8: Ad, Creator plan offer: Card, Creator plan (600x452, #262626, radius 10, 48px in; Creator at 48, the price at 112, the lines from 184, 24px apart; Button, Start Creator for 50% off 504x56 at 348).