Aside · Full page
A bright assistant product page: a header that hides on scroll down and returns on scroll up, a sky hero whose app window flattens as you leave it, an intro that reads itself in word by word, an app-tile wall, growing benchmark bars, privacy cards, a sky CTA and a link footer.
An assistant that lives
where you already work.
find subscriptions I never use and list them
Working for 1m 12s
✓Opening the billing pages
✓Reading each plan and renewal date
Drafting a short list to cancel
Most assistants stop at the hard part. They hand the task back the moment it needs a login, a form or a second step.
This one keeps going. It uses the sites you are already signed in to and finishes the job, from replies and bookings to the tools only your team uses.
If you can click it, it can do it.
Signing in Works inside the accounts you already use, from mail to dashboards.
Messages Drafts replies and follow-ups, then waits for your nod.
Files Opens, edits and saves the documents on your machine.
Finishes more of what you ask.
Scored on three public test sets of real browsing tasks. Illustrative numbers. Method
Safe enough for your real accounts.
Locked by default New logins and payments always wait for your approval.
Stays on device Memory and history are stored locally and never sold.
Sign in your way Use passkeys or a password manager. We never see either.
Bring your own key Point it at the model provider you already pay for.
Made for you and your agents.
Try it this afternoon.
Usage
Drop the file into your project, along with the shared files listed below, and import it.
import { AsideLanding } from "@/registry/blocks/aside-landing";
export function Example() {
return <AsideLanding />;
}Install prerequisites
Every component here relies only on Tailwind and the cn helper from shadcn/ui.
npm i clsx tailwind-mergeAlso copy these files
Aside · Full page imports these files. Keep the same paths, or update the imports to match.
'use client'
import { useRef, useState } from 'react'
import { AsideMark, SplitButton, useHideOnScroll } from '@/registry/blocks/aside-kit'
import { cn } from '@/lib/utils'
export interface AsideNavbarProps {
brand?: string
links?: string
ctaLabel?: string
className?: string
}
/** A light bar that slides away while you scroll down and comes back the moment you scroll up. */
export function AsideNavbar({ brand = 'shinUI', links = 'Features, Use cases, Guides, Pricing', ctaLabel = 'Download', className }: AsideNavbarProps) {
const ref = useRef<HTMLElement>(null)
const hidden = useHideOnScroll(ref)
const [open, setOpen] = useState(false)
const items = links.split(',').map((s) => s.trim()).filter(Boolean)
return (
<nav
ref={ref}
className={cn(
'as-move relative flex h-14 w-full items-center justify-between gap-6 border-b border-(--as-line) bg-white/80 px-5 backdrop-blur-md transition-[opacity,transform] duration-300',
hidden && !open ? 'pointer-events-none -translate-y-full opacity-0' : 'translate-y-0 opacity-100',
className
)}
>
<a href="#" className="flex items-center gap-2 text-[17px] font-semibold tracking-tight">
<AsideMark />
{brand}
</a>
<div className="hidden items-center gap-7 md:flex">
{items.map((l) => (
<a key={l} href="#" className="text-[13.5px] text-(--as-ink)/80 transition-colors hover:text-(--as-ink)">{l}</a>
))}
</div>
<span className="hidden md:block">
<SplitButton size="sm">{ctaLabel}</SplitButton>
</span>
<button type="button" aria-expanded={open} aria-label="Menu" onClick={() => setOpen((o) => !o)} className="grid size-9 place-items-center rounded-lg border border-(--as-line) md:hidden">
<span className="block h-px w-4 bg-current shadow-[0_5px_0_currentColor,0_-5px_0_currentColor]" />
</button>
{open && (
<div className="absolute inset-x-3 top-full mt-2 flex flex-col gap-1 rounded-xl border border-(--as-line) bg-white p-2 shadow-lg md:hidden">
{items.map((l) => (
<a key={l} href="#" className="rounded-lg px-3 py-2 text-sm hover:bg-(--as-soft)">{l}</a>
))}
</div>
)}
</nav>
)
}
'use client'
import { useRef } from 'react'
import { AppWindow, SplitButton, Sky, useScrollVar } from '@/registry/blocks/aside-kit'
import { cn } from '@/lib/utils'
export interface AsideHeroProps {
badge?: string
title?: string
subtitle?: string
task?: string
animate?: boolean
className?: string
}
const CHATS = ['Plan a team offsite', 'Compare three laptops', 'Summarise unread mail', 'Weekly metrics recap']
const STEPS = ['Opening the billing pages', 'Reading each plan and renewal date', 'Drafting a short list to cancel']
/**
* Sky card with a short headline and a download pill. Below it an app window
* sits tilted back and flattens out as the hero scrolls away.
*/
export function AsideHero({
badge = 'Now in public beta',
title = 'An assistant that lives',
subtitle = 'where you already work.',
task = 'find subscriptions I never use and list them',
animate = true,
className,
}: AsideHeroProps) {
const ref = useRef<HTMLElement>(null)
useScrollVar(ref, { name: '--as-x', mode: 'exit' })
return (
<section ref={ref} className={cn('px-3 pt-3', className)}>
<div className="relative isolate overflow-hidden rounded-2xl px-6 pt-28 pb-0 text-center [perspective:1400px]">
<Sky animate={animate} />
<span className="inline-flex items-center gap-1 rounded-full border border-black/10 bg-white/60 px-3 py-1 text-[12px] text-(--as-ink)/80 backdrop-blur">
{badge} <span aria-hidden>›</span>
</span>
<h1 className="mx-auto mt-5 max-w-3xl text-[clamp(2.2rem,5vw,3.6rem)] leading-[1.08] font-medium tracking-[-0.035em]">
{title}
<br />
{subtitle}
</h1>
<div className="mt-7">
<SplitButton />
</div>
<div
className="as-move mx-auto mt-14 max-w-5xl origin-bottom transition-transform duration-100"
style={{ transform: 'rotateX(calc(max(0, 0.3 - var(--as-x, 0)) * -60deg)) scale(calc(1 - max(0, 0.3 - var(--as-x, 0)) * 0.15))' }}
>
<AppWindow title="Chats · Unused subscriptions" className="rounded-b-none border-b-0 text-left">
<div className="grid h-[380px] grid-cols-[200px_1fr] max-sm:grid-cols-1">
<aside className="space-y-4 border-r border-(--as-line) bg-white/50 p-3 text-[12.5px] max-sm:hidden">
<div className="grid grid-cols-3 gap-1.5">
{['#e1306c', '#4285f4', '#36c5f0', '#a259ff', '#111', '#5865f2'].map((c) => (
<span key={c} className="grid h-8 place-items-center rounded-md bg-black/[0.04]">
<span className="size-3 rounded-[4px]" style={{ background: c }} />
</span>
))}
</div>
<div>
<p className="mb-1.5 px-1 text-[11px] text-(--as-dim)">Chats</p>
{CHATS.map((c, i) => (
<p key={c} className={cn('flex items-center justify-between truncate rounded-md px-2 py-1.5', i === 0 && 'bg-white shadow-sm')}>
<span className="truncate">{c}</span>
{i === 1 && <span className="size-3 shrink-0 rounded-full border border-(--as-faint) border-t-transparent" style={animate ? { animation: 'as-spin 1s linear infinite' } : undefined} />}
{i === 2 && <span className="size-1.5 shrink-0 rounded-full bg-(--as-blue)" />}
</p>
))}
</div>
</aside>
<div className="flex flex-col p-5 text-[13px]">
<p className="ml-auto max-w-[80%] rounded-2xl bg-(--as-soft) px-4 py-2">{task}</p>
<div className="mt-5 space-y-2.5">
<p className="text-[12px] text-(--as-dim)">Working for 1m 12s</p>
{STEPS.map((s, i) => (
<p key={s} className="flex items-center gap-2" style={animate ? { animation: `as-bob 3s ${i * 0.3}s ease-in-out infinite` } : undefined}>
<span className={cn('grid size-4 place-items-center rounded-full text-[9px] text-white', i < 2 ? 'bg-(--as-blue)' : 'border border-(--as-faint)')}>{i < 2 ? '✓' : ''}</span>
<span className={i < 2 ? '' : 'text-(--as-dim)'}>{s}</span>
</p>
))}
</div>
<div className="mt-auto flex items-center gap-2 rounded-xl border border-(--as-line) bg-white px-3 py-2.5 text-(--as-dim)">
<span>Ask anything</span>
<span className="h-4 w-px bg-(--as-ink)" style={animate ? { animation: 'as-caret 1s steps(1) infinite' } : undefined} />
<span className="ml-auto grid size-6 place-items-center rounded-full bg-(--as-ink) text-[11px] text-white">↑</span>
</div>
</div>
</div>
</AppWindow>
</div>
</div>
</section>
)
}
'use client'
import { useRef } from 'react'
import { Eyebrow, Rails, useScrollVar } from '@/registry/blocks/aside-kit'
export interface AsideIntroProps {
eyebrow?: string
paragraphs?: string[]
className?: string
}
const DEFAULT = [
'Most assistants stop at the hard part. They hand the task back the moment it needs a login, a form or a second step.',
'This one keeps going. It uses the sites you are already signed in to and finishes the job, from replies and bookings to the tools only your team uses.',
]
/**
* Two-column statement whose words darken one by one as the section scrolls
* up the screen, so the paragraph reads itself in.
*/
export function AsideIntro({ eyebrow = 'Why we built it', paragraphs = DEFAULT, className }: AsideIntroProps) {
const ref = useRef<HTMLElement>(null)
useScrollVar(ref, { name: '--as-read', mode: 'enter', end: 0.25 })
const words = paragraphs.map((t) => t.split(' '))
const total = words.reduce((n, w) => n + w.length, 0)
let k = 0
return (
<section ref={ref} className={className}>
<Rails className="grid gap-8 px-6 py-24 md:grid-cols-[1fr_1.6fr] md:px-24">
<div>
<Eyebrow>{eyebrow}</Eyebrow>
</div>
<div className="space-y-6 text-[clamp(1.05rem,1.6vw,1.25rem)] leading-[1.55]">
{words.map((ws, pi) => (
<p key={pi}>
{ws.map((w, wi) => {
const at = k++ / total
return (
<span
key={wi}
className="transition-colors duration-200"
style={{ color: `color-mix(in oklab, var(--as-ink) calc(clamp(0, (var(--as-read, 0) * 1.15 - ${at.toFixed(3)}) * 14, 1) * 100%), var(--as-faint))` }}
>
{w}{' '}
</span>
)
})}
</p>
))}
</div>
</Rails>
</section>
)
}
import { Eyebrow, Rails } from '@/registry/blocks/aside-kit'
import { cn } from '@/lib/utils'
export interface AsideCapabilitiesProps {
eyebrow?: string
heading?: string
animate?: boolean
className?: string
}
const TILES = ['#2563eb', '#ef4444', '#10b981', '#f59e0b', '#8b5cf6', '#0ea5e9', '#111827', '#ec4899', '#14b8a6', '#f97316', '#6366f1', '#22c55e', '#e11d48', '#0f766e', '#a855f7', '#3b82f6']
const GLYPHS = ['M4 8h16M4 12h10M4 16h13', 'M5 5h14v14H5z', 'M12 4l8 16H4z', 'M12 4a8 8 0 1 0 0.01 0', 'M4 12h16M12 4v16', 'M5 17 10 7l4 7 2-3 3 6']
const CARDS: [string, string, string][] = [
['Signing in', 'Works inside the accounts you already use, from mail to dashboards.', 'linear-gradient(135deg,#fde2f3,#e0e7ff)'],
['Messages', 'Drafts replies and follow-ups, then waits for your nod.', 'linear-gradient(135deg,#dcfce7,#e0f2fe)'],
['Files', 'Opens, edits and saves the documents on your machine.', 'linear-gradient(135deg,#fef3c7,#fce7f3)'],
]
/** A drifting wall of app tiles above three cards with tinted previews. */
export function AsideCapabilities({ eyebrow = 'No integrations needed', heading = 'If you can click it, it can do it.', animate = true, className }: AsideCapabilitiesProps) {
return (
<section className={className}>
<Rails className="bg-(--as-soft) px-6 py-24 text-center">
<Eyebrow>{eyebrow}</Eyebrow>
<h2 className="mx-auto mt-4 max-w-xl text-[clamp(1.9rem,4vw,3rem)] leading-[1.08] font-medium tracking-[-0.035em]">{heading}</h2>
<div className="mx-auto mt-14 grid max-w-3xl grid-cols-8 gap-3 max-sm:grid-cols-4">
{TILES.map((c, i) => (
<span
key={c + i}
aria-hidden
className="grid aspect-square place-items-center rounded-[22%] shadow-[0_10px_20px_-12px_rgba(0,0,0,0.45)]"
style={{ background: c, animation: animate ? `as-bob ${3 + (i % 4) * 0.6}s ${-(i % 5) * 0.7}s ease-in-out infinite` : undefined, marginTop: i % 2 ? 18 : 0 }}
>
<svg viewBox="0 0 24 24" className="size-1/2 text-white" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d={GLYPHS[i % GLYPHS.length]} />
</svg>
</span>
))}
</div>
<div className="mt-16 grid gap-4 text-left md:grid-cols-3">
{CARDS.map(([t, d, bg]) => (
<div key={t} className="overflow-hidden rounded-xl border border-(--as-line) bg-white">
<div className="grid h-36 place-items-center" style={{ background: bg }}>
<div className="w-3/4 space-y-1.5 rounded-lg bg-white/80 p-3 shadow-sm">
<span className="block h-1.5 w-2/3 rounded bg-black/15" />
<span className="block h-1.5 w-1/2 rounded bg-black/10" />
<span className="block h-1.5 w-3/4 rounded bg-black/10" />
</div>
</div>
<p className={cn('p-4 text-[13.5px] leading-relaxed text-(--as-dim)')}>
<b className="font-medium text-(--as-ink)">{t}</b> {d}
</p>
</div>
))}
</div>
</Rails>
</section>
)
}
'use client'
import { useState } from 'react'
import { AsideMark, Eyebrow, Rails, useInView } from '@/registry/blocks/aside-kit'
import { cn } from '@/lib/utils'
export interface AsideBenchmarksProps {
brand?: string
heading?: string
className?: string
}
const SETS: Record<string, [string, number][]> = {
'Web tasks': [['You', 96.4], ['Agent A', 91.2], ['Agent B', 86.5], ['Agent C', 78.9], ['Agent D', 64.0]],
'Long forms': [['You', 93.1], ['Agent B', 88.0], ['Agent A', 83.7], ['Agent D', 71.2], ['Agent C', 66.5]],
'Multi-site': [['You', 89.8], ['Agent C', 80.4], ['Agent A', 77.9], ['Agent B', 70.1], ['Agent D', 58.6]],
}
/** A ranked bar list with segmented tabs; bars grow in when first seen and re-flow when the tab changes. */
export function AsideBenchmarks({ brand = 'shinUI', heading = 'Finishes more of what you ask.', className }: AsideBenchmarksProps) {
const keys = Object.keys(SETS)
const [tab, setTab] = useState(keys[0])
const [ref, seen] = useInView<HTMLDivElement>(0.3)
const rows = SETS[tab]
return (
<section className={className}>
<Rails className="px-6 py-24 md:px-24">
<h2 className="text-[clamp(1.7rem,3vw,2.2rem)] font-medium tracking-[-0.03em]">{heading}</h2>
<p className="mt-3 max-w-xl text-[15px] leading-relaxed text-(--as-dim)">
Scored on three public test sets of real browsing tasks. Illustrative numbers. <Eyebrow className="text-[15px]">Method</Eyebrow>
</p>
<div ref={ref} className="mt-12 divide-y divide-(--as-line) border-y border-(--as-line)">
{rows.map(([n, v], i) => {
const me = n === 'You'
const w = seen ? ((v - 50) / 50) * 100 : 0
return (
<div key={n} className="grid grid-cols-[120px_1fr_56px] items-center gap-4 py-3 text-[13.5px]">
<span className="flex items-center gap-2 truncate font-medium">
{me ? <AsideMark className="size-4" /> : <span className="size-4 rounded-full border border-(--as-faint)" />}
{me ? brand : n}
</span>
<span className="h-4 rounded-[3px] bg-transparent">
<span
className={cn('block h-full rounded-[3px] transition-[width] duration-700 ease-out', me ? 'bg-(--as-blue)' : 'bg-(--as-line)')}
style={{ width: `${w}%`, transitionDelay: `${i * 70}ms` }}
/>
</span>
<span className="text-right tabular-nums text-(--as-dim)">{v.toFixed(1)}%</span>
</div>
)
})}
</div>
<div role="tablist" className="mx-auto mt-8 flex w-fit gap-1 rounded-lg bg-(--as-soft) p-1">
{keys.map((k) => (
<button key={k} role="tab" type="button" aria-selected={tab === k} onClick={() => setTab(k)} className={cn('rounded-md px-3 py-1.5 text-[12.5px] transition-colors', tab === k ? 'bg-white shadow-sm' : 'text-(--as-dim) hover:text-(--as-ink)')}>
{k}
</button>
))}
</div>
</Rails>
</section>
)
}
import { Eyebrow, Rails } from '@/registry/blocks/aside-kit'
export interface AsidePrivacyProps {
eyebrow?: string
heading?: string
className?: string
}
const ITEMS: [string, string, string][] = [
['Locked by default', 'New logins and payments always wait for your approval.', 'M7 11V8a5 5 0 0 1 10 0v3M5 11h14v9H5z'],
['Stays on device', 'Memory and history are stored locally and never sold.', 'M4 6h16v10H4zM9 20h6M12 16v4'],
['Sign in your way', 'Use passkeys or a password manager. We never see either.', 'M14 4a5 5 0 1 0 0 10 5 5 0 0 0 0-10zM10 12l-6 6v2h3v-2h2v-2h2'],
['Bring your own key', 'Point it at the model provider you already pay for.', 'M12 3l7 4v5c0 4-3 7-7 9-4-2-7-5-7-9V7z'],
]
/** Centred heading over four quiet cards, each with a line icon. */
export function AsidePrivacy({ eyebrow = 'Private by design', heading = 'Safe enough for your real accounts.', className }: AsidePrivacyProps) {
return (
<section className={className}>
<Rails className="bg-(--as-soft) px-6 py-24 text-center">
<Eyebrow>{eyebrow}</Eyebrow>
<h2 className="mx-auto mt-4 max-w-lg text-[clamp(1.9rem,4vw,2.8rem)] leading-[1.1] font-medium tracking-[-0.035em]">{heading}</h2>
<div className="mt-14 grid gap-4 text-left sm:grid-cols-2 lg:grid-cols-4">
{ITEMS.map(([t, d, path]) => (
<div key={t} className="rounded-xl border border-(--as-line) bg-white p-5">
<div className="grid h-24 place-items-center rounded-lg bg-(--as-soft)">
<svg viewBox="0 0 24 24" aria-hidden className="size-9 text-(--as-ink)" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round">
<path d={path} />
</svg>
</div>
<p className="mt-4 text-[13.5px] leading-relaxed text-(--as-dim)">
<b className="font-medium text-(--as-ink)">{t}</b> {d}
</p>
</div>
))}
</div>
</Rails>
</section>
)
}
import { SplitButton, Sky } from '@/registry/blocks/aside-kit'
import { cn } from '@/lib/utils'
export interface AsideCtaProps {
title?: string
subtitle?: string
animate?: boolean
className?: string
}
/** A sky card closing the page with a two-line line and the download pill. */
export function AsideCta({ title = 'Made for you and your agents.', subtitle = 'Try it this afternoon.', animate = true, className }: AsideCtaProps) {
return (
<section className={cn('px-3 py-3', className)}>
<div className="relative isolate overflow-hidden rounded-2xl px-6 py-24 text-center">
<Sky animate={animate} />
<h2 className="text-[clamp(1.8rem,4vw,2.8rem)] leading-[1.1] font-medium tracking-[-0.035em]">
{title}
<br />
{subtitle}
</h2>
<div className="mt-8">
<SplitButton />
</div>
</div>
</section>
)
}
import { AsideMark } from '@/registry/blocks/aside-kit'
import { cn } from '@/lib/utils'
export interface AsideFooterProps {
brand?: string
className?: string
}
const COLS: [string, string[]][] = [
['Product', ['Assistant', 'Passwords', 'Memory', 'Download']],
['Use cases', ['Sales', 'Recruiting', 'Support', 'Research']],
['Resources', ['Guides', 'Changelog', 'Status', 'Help']],
['Company', ['About', 'Careers', 'Press', 'Contact']],
['Legal', ['Terms', 'Privacy', 'Security']],
]
/** Five plain link columns with a brand line and a slim bottom bar. */
export function AsideFooter({ brand = 'shinUI', className }: AsideFooterProps) {
return (
<footer className={cn('px-6 pt-16', className)}>
<div className="mx-auto grid max-w-6xl grid-cols-2 gap-8 sm:grid-cols-3 md:grid-cols-6">
<a href="#" className="col-span-2 flex items-start gap-2 text-[17px] font-semibold tracking-tight sm:col-span-3 md:col-span-1">
<AsideMark /> {brand}
</a>
{COLS.map(([h, ls]) => (
<div key={h}>
<p className="text-[12px] text-(--as-dim)">{h}</p>
<ul className="mt-3 space-y-2">
{ls.map((l) => (
<li key={l}>
<a href="#" className="text-[13.5px] text-(--as-ink)/85 hover:text-(--as-ink)">{l}</a>
</li>
))}
</ul>
</div>
))}
</div>
<div className="mx-auto mt-14 flex max-w-6xl justify-between border-t border-(--as-line) py-5 text-[12px] text-(--as-dim)">
<span>© 2026 {brand}</span>
<span>Made with care</span>
</div>
</footer>
)
}
'use client'
import { useEffect, useRef, useState, type ComponentProps, type CSSProperties, type ReactNode, type RefObject } from 'react'
import { cn } from '@/lib/utils'
/** Aside palette. Every colour lives in an --as-* var so a theme can override it. */
const VARS = {
'--as-bg': '#ffffff',
'--as-soft': '#f7f7f8',
'--as-ink': '#0b0c0e',
'--as-dim': '#6b6f76',
'--as-faint': '#b4b7bc',
'--as-line': '#ececee',
'--as-blue': '#1f6bff',
'--as-sky-1': '#7fd8ff',
'--as-sky-2': '#c6ecff',
'--as-sky-3': '#eef9ff',
} as CSSProperties
const KEYFRAMES = `
@keyframes as-drift { from { transform: translateX(-4%) } to { transform: translateX(4%) } }
@keyframes as-bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
@keyframes as-caret { 50% { opacity: 0 } }
@keyframes as-spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) {
.as-anim, .as-anim * { animation: none !important; transition: none !important }
.as-move { transform: none !important }
}`
export function AsideRoot({ className, style, children, ...rest }: ComponentProps<'div'>) {
return (
<div className={cn('as-anim bg-(--as-bg) font-sans text-(--as-ink) antialiased', className)} style={{ ...VARS, ...style }} {...rest}>
<style>{KEYFRAMES}</style>
{children}
</div>
)
}
/** Original mark: a ring crossed by a soft wave. */
export function AsideMark({ className }: { className?: string }) {
return (
<svg viewBox="0 0 24 24" aria-hidden className={cn('size-6', className)} fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round">
<circle cx="12" cy="12" r="9" />
<path d="M5.5 14.5c2.2-3 4.3-3 6.5 0s4.3 3 6.5 0" />
</svg>
)
}
/** Sky gradient with drifting cloud puffs, drawn with gradients only. */
export function Sky({ className, animate = true }: { className?: string; animate?: boolean }) {
const puffs = [
{ l: '-6%', t: '12%', w: 46, o: 0.9 },
{ l: '62%', t: '4%', w: 52, o: 0.8 },
{ l: '30%', t: '52%', w: 70, o: 0.7 },
{ l: '-10%', t: '70%', w: 50, o: 0.85 },
{ l: '70%', t: '62%', w: 48, o: 0.9 },
]
return (
<div aria-hidden className={cn('pointer-events-none absolute inset-0 -z-10 overflow-hidden', className)} style={{ background: 'linear-gradient(180deg, var(--as-sky-1), var(--as-sky-2) 55%, var(--as-sky-3))' }}>
{puffs.map((p, i) => (
<span
key={i}
className="absolute aspect-[2.4/1] rounded-[50%] blur-2xl"
style={{
left: p.l,
top: p.t,
width: `${p.w}%`,
opacity: p.o,
background: 'radial-gradient(closest-side, #fff, rgba(255,255,255,0.6) 60%, transparent)',
animation: animate ? `as-drift ${18 + i * 4}s ${-i * 3}s ease-in-out infinite alternate` : undefined,
}}
/>
))}
</div>
)
}
/** Blue text link with a chevron, used as a section eyebrow. */
export function Eyebrow({ className, children, ...rest }: ComponentProps<'a'>) {
return (
<a href="#" className={cn('inline-flex items-center gap-1 text-[14px] font-medium text-(--as-blue) hover:underline', className)} {...rest}>
{children}
<span aria-hidden>›</span>
</a>
)
}
/** Black pill with a divided chevron, like a download button with options. */
export function SplitButton({ children = 'Download', size = 'md', className }: { children?: ReactNode; size?: 'sm' | 'md'; className?: string }) {
return (
<span className={cn('inline-flex items-stretch overflow-hidden rounded-[10px] bg-(--as-ink) text-white shadow-[0_6px_20px_-8px_rgba(0,0,0,0.5)]', size === 'sm' ? 'h-8 text-[13px]' : 'h-10 text-[14px]', className)}>
<button type="button" className="flex items-center gap-1.5 px-3.5 font-medium hover:bg-white/10">
<svg viewBox="0 0 16 16" aria-hidden className="size-3.5" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"><path d="M8 2v8M4.5 7 8 10.5 11.5 7M3 13.5h10" /></svg>
{children}
</button>
<span className="my-2 w-px bg-white/25" />
<button type="button" aria-label="More options" className="px-2.5 hover:bg-white/10">
<svg viewBox="0 0 12 12" aria-hidden className="size-3" fill="none" stroke="currentColor" strokeWidth="1.5"><path d="M3 4.5 6 7.5 9 4.5" /></svg>
</button>
</span>
)
}
/** A desktop app frame with traffic lights and an address bar. */
export function AppWindow({ title = 'New tab', className, children }: { title?: string; className?: string; children?: ReactNode }) {
return (
<div className={cn('overflow-hidden rounded-xl border border-black/10 bg-white/85 shadow-[0_30px_80px_-30px_rgba(10,40,80,0.45)] backdrop-blur', className)}>
<div className="flex items-center gap-3 border-b border-(--as-line) px-4 py-2.5">
<span className="flex gap-1.5">
{['#ff5f57', '#febc2e', '#28c840'].map((c) => (
<span key={c} className="size-2.5 rounded-full" style={{ background: c }} />
))}
</span>
<span className="ml-2 flex gap-2 text-(--as-faint)">‹ ›</span>
<span className="truncate text-[12px] text-(--as-dim)">{title}</span>
</div>
{children}
</div>
)
}
/** Page column with hairline rails on both sides. */
export function Rails({ className, children }: { className?: string; children: ReactNode }) {
return <div className={cn('mx-auto max-w-6xl border-x border-(--as-line)', className)}>{children}</div>
}
function scrollParent(el: HTMLElement) {
let sp: HTMLElement | null = el.parentElement
while (sp && !/(auto|scroll)/.test(getComputedStyle(sp).overflowY)) sp = sp.parentElement
return sp
}
/** Calls `fn` with the scroll offset and the element's position relative to its scroller, once per frame. */
function useScrollFrame<T extends HTMLElement>(ref: RefObject<T | null>, fn: (s: { y: number; top: number; vh: number; rect: DOMRect }) => void) {
const cb = useRef(fn)
useEffect(() => {
cb.current = fn
})
useEffect(() => {
const el = ref.current
if (!el) return
const sp = scrollParent(el)
const target: HTMLElement | Window = sp ?? window
let raf = 0
const update = () => {
raf = 0
cb.current({ y: sp ? sp.scrollTop : window.scrollY, top: sp ? sp.getBoundingClientRect().top : 0, vh: sp ? sp.clientHeight : window.innerHeight, rect: el.getBoundingClientRect() })
}
const queue = () => {
if (!raf) raf = requestAnimationFrame(update)
}
queue()
target.addEventListener('scroll', queue, { passive: true })
window.addEventListener('resize', queue)
return () => {
cancelAnimationFrame(raf)
target.removeEventListener('scroll', queue)
window.removeEventListener('resize', queue)
}
}, [ref])
}
/**
* Writes 0–1 progress to a CSS var. 'cross': element enters the bottom → leaves the top.
* 'exit': element top at the scroller top → fully scrolled out.
* 'enter': element enters the bottom → its top reaches `end` of the viewport height.
*/
export function useScrollVar<T extends HTMLElement>(ref: RefObject<T | null>, { name = '--as-p', mode = 'cross', end = 0.35 }: { name?: string; mode?: 'cross' | 'enter' | 'exit'; end?: number } = {}) {
useScrollFrame(ref, ({ top, vh, rect }) => {
const rel = rect.top - top
const p = mode === 'cross' ? (vh - rel) / (vh + rect.height) : mode === 'exit' ? -rel / rect.height : (vh - rel) / (vh * (1 - end))
ref.current?.style.setProperty(name, Math.min(1, Math.max(0, p)).toFixed(4))
})
}
/** Hidden while scrolling down past `offset`, shown again on any scroll up. */
export function useHideOnScroll<T extends HTMLElement>(ref: RefObject<T | null>, offset = 80) {
const [hidden, setHidden] = useState(false)
const last = useRef(0)
useScrollFrame(ref, ({ y }) => {
const d = y - last.current
if (Math.abs(d) > 4) setHidden(d > 0 && y > offset)
last.current = y
})
return hidden
}
/** True once the element has come into view (stays true). */
export function useInView<T extends HTMLElement>(threshold = 0.3) {
const ref = useRef<T>(null)
const [seen, setSeen] = useState(false)
useEffect(() => {
const el = ref.current
if (!el || seen) return
const io = new IntersectionObserver(([e]) => e.isIntersecting && setSeen(true), { threshold })
io.observe(el)
return () => io.disconnect()
}, [seen, threshold])
return [ref, seen] as const
}
More in Blocks
Bento Grid
A responsive bento layout that collapses to a single column on mobile, with per-card column and row spans and a hover glow that scales from the corner.
Timeline
A vertical timeline with a brand dot per milestone and a left rule — enough structure for changelogs, roadmaps and onboarding steps.
ASCII Footer
The brand set in monospace characters that shimmer in a slow wave and scramble under the cursor, or an ASCII sunset sea.