Components
Scroll fade
Put scroll-fade on the element that scrolls, the one with overflow-y-auto or overflow-x-auto.
The fade is a mask on that element, not a gradient laid over it. The content itself dissolves into whatever is behind, so it works on any background and nothing sits on top of the content to get in the way of a press.
An edge fades only while there is more beyond it. At the top of a list only the bottom fades; scroll down and the top fades in as the first rows leave. A list short enough to fit does not fade at all. This follows the scroll position in CSS, with no script. A browser without scroll-driven animations fades both edges all the time.
The utility comes from shadcn/tailwind.css, which each app imports in its globals.css.
- Staff Software Engineer, QuantumLeap
- Principal Software Engineer, InnoWave
- Lead Frontend Engineer, NextGen Robotics
- Engineering Manager, Brightside Health
- Staff Platform Engineer, Ledgerline
- Senior Backend Engineer, Fernhill
- Principal Data Engineer, Northwind Energy
- Staff Machine Learning Engineer, Tallis
- Senior Software Engineer, Copperfield
- Lead Mobile Engineer, Harbour
const ROLES = [
'Staff Software Engineer, QuantumLeap',
'Principal Software Engineer, InnoWave',
'Lead Frontend Engineer, NextGen Robotics',
'Engineering Manager, Brightside Health',
'Staff Platform Engineer, Ledgerline',
'Senior Backend Engineer, Fernhill',
'Principal Data Engineer, Northwind Energy',
'Staff Machine Learning Engineer, Tallis',
'Senior Software Engineer, Copperfield',
'Lead Mobile Engineer, Harbour',
]
export function ScrollFadeVertical() {
return (
<div className="w-full max-w-xs overflow-hidden rounded-lg border border-border bg-card">
<ul className="scroll-fade max-h-48 overflow-y-auto p-4">
{ROLES.map((role) => (
<li key={role} className="py-2 text-sm">
{role}
</li>
))}
</ul>
</div>
)
}
import { Chip, ChipGroup } from '@dex/shared/components/chip-group'
const SKILLS = [
'TypeScript',
'Go',
'Python',
'Rust',
'React',
'PostgreSQL',
'Kubernetes',
'Terraform',
'GraphQL',
'AWS',
]
export function ScrollFadeHorizontal() {
return (
<div className="w-full max-w-xs overflow-hidden rounded-lg border border-border bg-card">
<div className="scroll-fade-x overflow-x-auto p-4">
<ChipGroup
type="multiple"
chipSize="sm"
aria-label="Skills"
defaultValue={['TypeScript']}
className="w-max flex-nowrap"
>
{SKILLS.map((skill) => (
<Chip key={skill} value={skill}>
{skill}
</Chip>
))}
</ChipGroup>
</div>
</div>
)
}
- Intro call with Dex
- CV sent to QuantumLeap
- Intro call with the hiring manager
- Take-home exercise
- System design interview
- Team day in London
- References
- Offer
scroll-fade-b
scroll-fade-e
import { Chip, ChipGroup } from '@dex/shared/components/chip-group'
const STEPS = [
'Intro call with Dex',
'CV sent to QuantumLeap',
'Intro call with the hiring manager',
'Take-home exercise',
'System design interview',
'Team day in London',
'References',
'Offer',
]
const LOCATIONS = ['London', 'Manchester', 'Bristol', 'Edinburgh', 'Leeds', 'Cambridge', 'Remote']
export function ScrollFadeOneEdge() {
return (
<>
<div className="w-full max-w-60 overflow-hidden rounded-lg border border-border bg-card">
<ul className="scroll-fade-b max-h-48 overflow-y-auto p-4">
{STEPS.map((step) => (
<li key={step} className="py-2 text-sm">
{step}
</li>
))}
</ul>
<p className="border-t border-border px-4 py-2 text-center font-mono text-xs text-muted-foreground">
scroll-fade-b
</p>
</div>
<div className="w-full max-w-60 overflow-hidden rounded-lg border border-border bg-card">
<div className="scroll-fade-e overflow-x-auto p-4">
<ChipGroup
type="single"
chipSize="sm"
aria-label="Location"
defaultValue="London"
className="w-max flex-nowrap"
>
{LOCATIONS.map((location) => (
<Chip key={location} value={location}>
{location}
</Chip>
))}
</ChipGroup>
</div>
<p className="border-t border-border px-4 py-2 text-center font-mono text-xs text-muted-foreground">
scroll-fade-e
</p>
</div>
</>
)
}
- Intro call with Dex
- CV sent to QuantumLeap
- Intro call with the hiring manager
- Take-home exercise
- System design interview
- Team day in London
- References
- Offer
scroll-fade-4
- Intro call with Dex
- CV sent to QuantumLeap
- Intro call with the hiring manager
- Take-home exercise
- System design interview
- Team day in London
- References
- Offer
scroll-fade-24
const STEPS = [
'Intro call with Dex',
'CV sent to QuantumLeap',
'Intro call with the hiring manager',
'Take-home exercise',
'System design interview',
'Team day in London',
'References',
'Offer',
]
export function ScrollFadeSize() {
return (
<>
<div className="w-full max-w-60 overflow-hidden rounded-lg border border-border bg-card">
<ul className="scroll-fade max-h-48 overflow-y-auto p-4 scroll-fade-4">
{STEPS.map((step) => (
<li key={step} className="py-2 text-sm">
{step}
</li>
))}
</ul>
<p className="border-t border-border px-4 py-2 text-center font-mono text-xs text-muted-foreground">
scroll-fade-4
</p>
</div>
<div className="w-full max-w-60 overflow-hidden rounded-lg border border-border bg-card">
<ul className="scroll-fade max-h-48 overflow-y-auto p-4 scroll-fade-24">
{STEPS.map((step) => (
<li key={step} className="py-2 text-sm">
{step}
</li>
))}
</ul>
<p className="border-t border-border px-4 py-2 text-center font-mono text-xs text-muted-foreground">
scroll-fade-24
</p>
</div>
</>
)
}
- Staff Software Engineer, QuantumLeap
- Principal Software Engineer, InnoWave
- Lead Frontend Engineer, NextGen Robotics
const ROLES = [
'Staff Software Engineer, QuantumLeap',
'Principal Software Engineer, InnoWave',
'Lead Frontend Engineer, NextGen Robotics',
]
export function ScrollFadeNoOverflow() {
return (
<div className="w-full max-w-xs overflow-hidden rounded-lg border border-border bg-card">
<ul className="scroll-fade max-h-48 overflow-y-auto p-4">
{ROLES.map((role) => (
<li key={role} className="py-2 text-sm">
{role}
</li>
))}
</ul>
</div>
)
}
| Class | What it does |
|---|---|
scroll-fadescroll-fade-y |
Fades the top and bottom of a vertical scroller |
scroll-fade-x |
Fades the start and end of a horizontal scroller |
scroll-fade-tscroll-fade-b |
Fades the top only, or the bottom only |
scroll-fade-sscroll-fade-e |
Fades the start only, or the end only |
scroll-fade-10scroll-fade-[2rem] |
Sets how deep the fade is, on the spacing scale or as a length. The default is 12% of the scroller, up to 40px |
scroll-fade-t-4scroll-fade-b-4 |
Sets the depth of one edge. The same for s and e |
scroll-fade-none |
Turns the fade off, for example from a breakpoint: md:scroll-fade-none |
- The chat's message list fades at the top and bottom, and its row of quick replies fades at both ends.
Tablefades the cut-off edge of a table that is wider than its card.- The steps of the onboarding form fade where a long step scrolls.