Scroll Fog Acts as a hint that visually informs users that there is additional content in a scrollable area.
@seed-design/react@1.1.3, @seed-design/css@1.1.3
import { Box, ScrollFog, VStack } from "@seed-design/react" ;
export default function ScrollFogPreview () {
return (
< div
style = {{
height: "200px" ,
width: "300px" ,
border: "1px solid var(--seed-color-stroke-neutral-weak)" ,
borderRadius: "8px" ,
}}
>
< ScrollFog placement = {[ "top" , "bottom" ]}>
< VStack gap = "x4" px = "x4" py = "20px" width = "full" >
{Array. from ({ length: 20 }, ( _ , i ) => (
< Box key = {i} bg = "gray" px = "x4" py = "x3" borderRadius = "r2" >
{i + 1 }
</ Box >
))}
</ VStack >
</ ScrollFog >
</ div >
);
}
This Scroll Fog component is a component for simpler scroll hints only, rather than Chakra ScrollArea ,
Radix ScrollArea ,
or Base UI ScrollArea .
It may be expanded later if additional scrollbar functionality is needed.
import { ScrollFog } from "@seed-design/react" ;
< div style = {{ height: "300px" }}>
< ScrollFog >
{ /* Scrollable content */ }
< div style = {{ padding: "20px 0" }}>Content</ div >
</ ScrollFog >
</ div >
ScrollFog always displays the fog effect, so sufficient padding is required in the specified direction.
Minimum padding : Must maintain 20px.
Vertical scroll taking full screen : Recommended 80px bottom, 20px top padding
Horizontal scroll : Recommended 20px left/right padding
// Vertical scroll - need top/bottom padding
< ScrollFog placement = {[ "top" , "bottom" ]}>
< div style = {{ padding: "20px 0 80px 0" }}>Content</ div >
</ ScrollFog >
// Horizontal scroll - need left/right padding
< ScrollFog placement = {[ "left" , "right" ]}>
< div style = {{ padding: "0 20px" }}>Content</ div >
</ ScrollFog >
When horizontal scrolling is needed, you can apply left/right fog effects using placement={["left", "right"]}.
Provide 20px padding on left and right to ensure content is not cut off.
import { HStack, ScrollFog } from "@seed-design/react" ;
export default function ScrollFogHorizontal () {
return (
< div
style = {{
border: "1px solid var(--seed-color-stroke-neutral-weak)" ,
borderRadius: "8px" ,
width: "300px" ,
}}
>
< ScrollFog placement = {[ "left" , "right" ]}>
< HStack gap = "x3" px = "20px" py = "x4" style = {{ width: "max-content" }}>
{Array. from ({ length: 15 }, ( _ , i ) => (
< div
key = {i}
style = {{
minWidth: "120px" ,
padding: "20px" ,
backgroundColor: "gray" ,
borderRadius: "4px" ,
textAlign: "center" ,
}}
>
{i + 1 }
</ div >
))}
</ HStack >
</ ScrollFog >
</ div >
);
}
You can adjust the scroll effect size using the size attribute. You can adjust the size for each direction using the sizes attribute.
import { ScrollFog } from "@seed-design/react" ;
export default function ScrollFogSize () {
return (
< div
style = {{
maxWidth: "400px" ,
height: "300px" ,
border: "1px solid var(--seed-color-stroke-neutral-weak)" ,
borderRadius: "8px" ,
}}
>
< ScrollFog size = { 40 } placement = {[ "top" , "bottom" , "left" , "right" ]}>
< div
style = {{
display: "grid" ,
gridTemplateColumns: "repeat(10, 100px)" ,
gap: "12px" ,
padding: "16px" ,
}}
>
{Array. from ({ length: 100 }, ( _ , i ) => (
< div
key = {i}
style = {{
width: "100px" ,
height: "100px" ,
display: "flex" ,
alignItems: "center" ,
justifyContent: "center" ,
backgroundColor: "gray" ,
borderRadius: "4px" ,
fontSize: "14px" ,
}}
>
{i + 1 }
</ div >
))}
</ div >
</ ScrollFog >
</ div >
);
}
import { ScrollFog } from "@seed-design/react" ;
export default function ScrollFogSize () {
return (
< div
style = {{
maxWidth: "400px" ,
height: "300px" ,
border: "1px solid var(--seed-color-stroke-neutral-weak)" ,
borderRadius: "8px" ,
}}
>
< ScrollFog
sizes = {{
top: 100 ,
bottom: 10 ,
left: 50 ,
right: 50 ,
}}
placement = {[ "top" , "bottom" , "left" , "right" ]}
>
< div
style = {{
display: "grid" ,
gridTemplateColumns: "repeat(10, 100px)" ,
gap: "12px" ,
padding: "16px" ,
}}
>
{Array. from ({ length: 100 }, ( _ , i ) => (
< div
key = {i}
style = {{
width: "100px" ,
height: "100px" ,
display: "flex" ,
alignItems: "center" ,
justifyContent: "center" ,
backgroundColor: "gray" ,
borderRadius: "4px" ,
fontSize: "14px" ,
}}
>
{i + 1 }
</ div >
))}
</ div >
</ ScrollFog >
</ div >
);
}
When 2D scrolling is needed, you can apply fog effects in all directions using placement={["top", "bottom", "left", "right"]}.
import { ScrollFog } from "@seed-design/react" ;
export default function ScrollFogAllDirections () {
return (
< div
style = {{
maxWidth: "400px" ,
height: "300px" ,
border: "1px solid var(--seed-color-stroke-neutral-weak)" ,
borderRadius: "8px" ,
}}
>
< ScrollFog placement = {[ "top" , "bottom" , "left" , "right" ]}>
< div
style = {{
display: "grid" ,
gridTemplateColumns: "repeat(10, 100px)" ,
gap: "12px" ,
padding: "20px" ,
}}
>
{Array. from ({ length: 100 }, ( _ , i ) => (
< div
key = {i}
style = {{
width: "100px" ,
height: "100px" ,
display: "flex" ,
alignItems: "center" ,
justifyContent: "center" ,
backgroundColor: "gray" ,
borderRadius: "4px" ,
fontSize: "14px" ,
}}
>
{i + 1 }
</ div >
))}
</ div >
</ ScrollFog >
</ div >
);
}
You can hide the scrollbar using the hideScrollBar attribute.
import { ScrollFog } from "@seed-design/react" ;
export default function ScrollFogHideScrollbar () {
return (
< div
style = {{
maxWidth: "400px" ,
height: "300px" ,
border: "1px solid var(--seed-color-stroke-neutral-weak)" ,
borderRadius: "8px" ,
}}
>
< ScrollFog hideScrollBar placement = {[ "top" , "bottom" , "left" , "right" ]}>
< div
style = {{
display: "grid" ,
gridTemplateColumns: "repeat(10, 100px)" ,
gap: "12px" ,
padding: "20px" ,
}}
>
{Array. from ({ length: 100 }, ( _ , i ) => (
< div
key = {i}
style = {{
width: "100px" ,
height: "100px" ,
display: "flex" ,
alignItems: "center" ,
justifyContent: "center" ,
backgroundColor: "gray" ,
borderRadius: "4px" ,
fontSize: "14px" ,
}}
>
{i + 1 }
</ div >
))}
</ div >
</ ScrollFog >
</ div >
);
}