Inset shadow scroll areas
Five scroll areas with a token inner shadow at the edges that signals overflow: soft, deep, top, bottom and frame. Each renders a gradient overlay from a foreground tint to transparent, styles its own thin scrollbar, and is sized.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/scroll-area-insetDependencies, the @ai2/tokens theme and the component file are installed together.
Copy the source
components/ui/scroll-area-inset.tsx"use client"
import type * as React from "react"
import { cn } from "@/lib/utils"
/* Scroll-area inset family: 5 decorative scroll areas. They draw gradient layers giving an inner-shadow effect at the top and bottom edges (and on all edges in Frame). The shadow goes from a low-alpha tone of the foreground token via color-mix to transparent; the content slides beneath it and signals the overflow. size -> the viewport height. */
export type StyledSize = "sm" | "md" | "lg" | "xl"
const height: Record<StyledSize, string> = {
sm: "h-40",
md: "h-56",
lg: "h-72",
xl: "h-96",
}
const base = "w-full overflow-y-auto rounded-lg border border-border bg-surface-2 p-3"
const scrollbar =
"[scrollbar-width:thin] [scrollbar-color:var(--color-border)_transparent] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border"
/* Varsayilan icerik: kaydirmayi tetikleyecek kadar uzun, token-stilli satirlar. */
function DefaultRows({ count = 16 }: { count?: number }) {
return (
<div className="flex flex-col gap-2">
{Array.from({ length: count }).map((_, i) => (
<div
key={i}
className="flex items-center justify-between rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground"
>
<span className="font-medium">Satir {i + 1}</span>
<span className="text-xs text-muted-foreground">token</span>
</div>
))}
</div>
)
}
type Props = {
className?: string
size?: StyledSize
children?: React.ReactNode
}
/* Shared shell: a relative wrapper plus the scroll area plus the given edge shadows. */
function InsetShell({
className,
size = "md",
children,
overlays,
}: Props & { overlays: React.ReactNode }) {
return (
<div data-slot="styled-scroll-area" className={cn("relative", className)}>
<div className={cn(base, height[size], scrollbar)}>{children ?? <DefaultRows />}</div>
{overlays}
</div>
)
}
const topSoft =
"pointer-events-none absolute inset-x-px top-px h-7 rounded-t-lg bg-gradient-to-b from-[color-mix(in_oklab,var(--color-foreground)_10%,transparent)] to-transparent"
const bottomSoft =
"pointer-events-none absolute inset-x-px bottom-px h-7 rounded-b-lg bg-gradient-to-t from-[color-mix(in_oklab,var(--color-foreground)_10%,transparent)] to-transparent"
const topDeep =
"pointer-events-none absolute inset-x-px top-px h-11 rounded-t-lg bg-gradient-to-b from-[color-mix(in_oklab,var(--color-foreground)_24%,transparent)] to-transparent"
const bottomDeep =
"pointer-events-none absolute inset-x-px bottom-px h-11 rounded-b-lg bg-gradient-to-t from-[color-mix(in_oklab,var(--color-foreground)_24%,transparent)] to-transparent"
/* Soft: ust ve alt kenarda ince, hafif ic golge. */
export function SoftInsetScrollArea(props: Props) {
return (
<InsetShell
{...props}
overlays={
<>
<div aria-hidden className={topSoft} />
<div aria-hidden className={bottomSoft} />
</>
}
/>
)
}
/* Deep: ust ve alt kenarda derin, belirgin ic golge. */
export function DeepInsetScrollArea(props: Props) {
return (
<InsetShell
{...props}
overlays={
<>
<div aria-hidden className={topDeep} />
<div aria-hidden className={bottomDeep} />
</>
}
/>
)
}
/* Top: an inner shadow on the top edge only. */
export function TopInsetScrollArea(props: Props) {
return <InsetShell {...props} overlays={<div aria-hidden className={topDeep} />} />
}
/* Bottom: an inner shadow on the bottom edge only. */
export function BottomInsetScrollArea(props: Props) {
return <InsetShell {...props} overlays={<div aria-hidden className={bottomDeep} />} />
}
/* Frame: dort kenarda ic golge; icerigi bir cerceve icine oturtur. */
export function FrameInsetScrollArea(props: Props) {
return (
<InsetShell
{...props}
overlays={
<>
<div aria-hidden className={topSoft} />
<div aria-hidden className={bottomSoft} />
<div
aria-hidden
className="pointer-events-none absolute inset-y-px left-px w-6 rounded-l-lg bg-gradient-to-r from-[color-mix(in_oklab,var(--color-foreground)_10%,transparent)] to-transparent"
/>
<div
aria-hidden
className="pointer-events-none absolute inset-y-px right-px w-6 rounded-r-lg bg-gradient-to-l from-[color-mix(in_oklab,var(--color-foreground)_10%,transparent)] to-transparent"
/>
</>
}
/>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Soft
A thin, subtle inner shadow at the top and bottom edges.
import { SoftInsetScrollArea } from "@/components/ui/scroll-area-inset"
<SoftInsetScrollArea />Deep
A deep, pronounced inner shadow at the top and bottom edges.
import { DeepInsetScrollArea } from "@/components/ui/scroll-area-inset"
<DeepInsetScrollArea />Top
An inner shadow at the top edge only.
import { TopInsetScrollArea } from "@/components/ui/scroll-area-inset"
<TopInsetScrollArea />Bottom
An inner shadow at the bottom edge only.
import { BottomInsetScrollArea } from "@/components/ui/scroll-area-inset"
<BottomInsetScrollArea />Frame
An inner shadow on all four edges, framing the content.
import { FrameInsetScrollArea } from "@/components/ui/scroll-area-inset"
<FrameInsetScrollArea />ai2 Inset shadow scroll areas: 5 styled variations on the token system
The ai2 Inset shadow scroll areas are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around scroll containers with an inner edge shadow that signals overflow. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: the inset shadow and scrollbar styling is pure CSS; no motion library work is required. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, nothing animates; the areas still scroll and still show the edge shadow.
What is in the ai2 Inset shadow scroll areas?
5 exports in one file: Soft, Deep, Top, Bottom and Frame. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: the inset shadow and scrollbar styling is pure CSS; no motion library work is required.
- Reduced-motion aware: Under prefers-reduced-motion, nothing animates; the areas still scroll and still show the edge shadow.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Inset shadow scroll areas sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.