Scroll Fog Serves as a hint to visually inform users that additional content exists in a scrollable area.
@seed-design/lynx-react@1.0.0
import "./styles" ;
import { Box, ScrollFog, Text, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
const ITEMS = Array. from ({ length: 20 }, ( _ , index ) => index + 1 );
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< Box
className = {seedClassName}
height = "full"
display = "flex"
alignItems = "center"
justifyContent = "center"
bg = "bg.layerDefault"
>
< Box
width = "300px"
height = "240px"
borderWidth = { 1 }
borderColor = "stroke.neutralWeak"
borderRadius = "8px"
style = {{ overflow: "hidden" }}
>
< ScrollFog style = {{ width: "100%" , height: "100%" }} placement = {[ "top" , "bottom" ]}>
< VStack pt = "20px" px = "16px" pb = "80px" gap = "8px" >
{ ITEMS . map (( item ) => (
< Box
key = {item}
height = "40px"
flexShrink = { false }
display = "flex"
alignItems = "center"
justifyContent = "center"
borderRadius = "4px"
bg = "bg.neutralWeak"
>
< Text color = "fg.neutral" fontSize = "14px" >
콘텐츠 {item}
</ Text >
</ Box >
))}
</ VStack >
</ ScrollFog >
</ Box >
</ Box >
);
}
Scroll Fog is a component for simple scroll hints rather than a complete Scroll Area. It displays a separate non-interactive mask layer using Rootage's gradient.fade-mask over the scroll area.
npm install @seed-design/lynx-react pnpm add @seed-design/lynx-react yarn add @seed-design/lynx-react bun add @seed-design/lynx-react
Lynx's ScrollFog is provided directly from the @seed-design/lynx-react package without a Registry snippet or Recipe.
ScrollFog supports placement for any direction, common size, direction-specific sizes, and hideScrollBar just like the React version. You can specify top, bottom, left, and right in any combination for placement. The Fog layer does not intercept touch input, so you can scroll or manipulate the content.
import { ScrollFog } from "@seed-design/lynx-react" ;
export function App () {
return (
< view style = {{ height: "300px" }}>
< ScrollFog placement = {[ "top" , "bottom" ]}>
< view style = {{ padding: "20px 0 80px" }}>
< text >Content to scroll</ text >
</ view >
</ ScrollFog >
</ view >
);
}
children?React.ReactNode
className?string | undefined
style?string | CSSProperties | undefined
ScrollFog always displays the fog effect, so sufficient padding in the specified directions is needed.
Minimum padding : Must maintain 20px.
Vertical scrolling occupying full screen : Recommend 80px bottom and 20px top padding.
Horizontal scrolling : Recommend 20px left and right padding.
// Vertical scroll - top/bottom padding needed
< ScrollFog placement = {[ "top" , "bottom" ]}>
< view style = {{ padding: "20px 0 80px" }}>...</ view >
</ ScrollFog >
// Horizontal scroll - left/right padding needed
< ScrollFog placement = {[ "left" , "right" ]}>
< view style = {{ padding: "0 20px" }}>...</ view >
</ ScrollFog >
When horizontal scrolling is needed, you can apply left and right fog effects using placement={["left", "right"]}. Provide 20px left and right padding to prevent content from being cut off.
import "./styles" ;
import { Box, HStack, ScrollFog, Text, useSeedClassName } from "@seed-design/lynx-react" ;
const ITEMS = Array. from ({ length: 15 }, ( _ , index ) => index + 1 );
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< Box
className = {seedClassName}
height = "full"
display = "flex"
alignItems = "center"
justifyContent = "center"
bg = "bg.layerDefault"
>
< Box
width = "300px"
height = "140px"
borderWidth = { 1 }
borderColor = "stroke.neutralWeak"
borderRadius = "8px"
style = {{ overflow: "hidden" }}
>
< ScrollFog style = {{ width: "100%" , height: "100%" }} placement = {[ "left" , "right" ]}>
< HStack width = "2000px" height = "full" px = "20px" align = "center" gap = "12px" >
{ ITEMS . map (( item ) => (
< Box
key = {item}
width = "120px"
height = "80px"
flexShrink = { false }
display = "flex"
alignItems = "center"
justifyContent = "center"
borderRadius = "4px"
bg = "bg.neutralWeak"
>
< Text color = "fg.neutral" fontSize = "14px" >
항목 {item}
</ Text >
</ Box >
))}
</ HStack >
</ ScrollFog >
</ Box >
</ Box >
);
}
You can adjust the fog size in all directions at once using size. Using sizes allows you to specify different sizes for each direction.
import "./styles" ;
import { Box, ScrollFog, Text, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
const ITEMS = Array. from ({ length: 20 }, ( _ , index ) => index + 1 );
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< Box
className = {seedClassName}
height = "full"
display = "flex"
alignItems = "center"
justifyContent = "center"
bg = "bg.layerDefault"
>
< Box
width = "300px"
height = "240px"
borderWidth = { 1 }
borderColor = "stroke.neutralWeak"
borderRadius = "8px"
style = {{ overflow: "hidden" }}
>
< ScrollFog
style = {{ width: "100%" , height: "100%" }}
size = { 40 }
placement = {[ "top" , "bottom" ]}
>
< VStack pt = "40px" px = "16px" pb = "80px" gap = "12px" >
< Text color = "fg.neutralMuted" fontSize = "14px" >
fog size: 40px
</ Text >
< VStack gap = "8px" >
{ ITEMS . map (( item ) => (
< Box
key = {item}
height = "40px"
flexShrink = { false }
display = "flex"
alignItems = "center"
justifyContent = "center"
borderRadius = "4px"
bg = "bg.neutralWeak"
>
< Text color = "fg.neutral" fontSize = "14px" >
콘텐츠 {item}
</ Text >
</ Box >
))}
</ VStack >
</ VStack >
</ ScrollFog >
</ Box >
</ Box >
);
}
import "./styles" ;
import { Box, ScrollFog, Text, useSeedClassName } from "@seed-design/lynx-react" ;
const ITEMS = Array. from ({ length: 100 }, ( _ , index ) => index + 1 );
const ROWS = Array. from ({ length: 10 }, ( _ , rowIndex ) => ({
id: rowIndex + 1 ,
items: ITEMS . slice (rowIndex * 10 , rowIndex * 10 + 10 ),
}));
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< Box
className = {seedClassName}
height = "full"
display = "flex"
alignItems = "center"
justifyContent = "center"
bg = "bg.layerDefault"
>
< Box
width = "400px"
height = "300px"
borderWidth = { 1 }
borderColor = "stroke.neutralWeak"
borderRadius = "8px"
style = {{ overflow: "hidden" }}
>
< ScrollFog
style = {{ width: "100%" , height: "100%" }}
sizes = {{
top: 100 ,
bottom: 10 ,
left: 50 ,
right: 50 ,
}}
placement = {[ "top" , "bottom" , "left" , "right" ]}
>
< Box
width = "1140px"
height = "1140px"
p = "16px"
display = "flex"
flexDirection = "column"
gap = "12px"
>
{ ROWS . map (( row ) => (
< Box key = {row.id} display = "flex" flexDirection = "row" gap = "12px" >
{row.items. map (( item ) => (
< Box
key = {item}
width = "100px"
height = "100px"
flexShrink = { false }
display = "flex"
alignItems = "center"
justifyContent = "center"
borderRadius = "4px"
bg = "bg.neutralWeak"
>
< Text color = "fg.neutral" fontSize = "14px" >
{item}
</ Text >
</ Box >
))}
</ Box >
))}
</ Box >
</ ScrollFog >
</ Box >
</ Box >
);
}
When 2D scrolling is needed, you can apply fog effects in all directions using placement={["top", "bottom", "left", "right"]}.
import "./styles" ;
import { Box, ScrollFog, Text, useSeedClassName } from "@seed-design/lynx-react" ;
const ITEMS = Array. from ({ length: 100 }, ( _ , index ) => index + 1 );
const ROWS = Array. from ({ length: 10 }, ( _ , rowIndex ) => ({
id: rowIndex + 1 ,
items: ITEMS . slice (rowIndex * 10 , rowIndex * 10 + 10 ),
}));
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< Box
className = {seedClassName}
height = "full"
display = "flex"
alignItems = "center"
justifyContent = "center"
bg = "bg.layerDefault"
>
< Box
width = "400px"
height = "300px"
borderWidth = { 1 }
borderColor = "stroke.neutralWeak"
borderRadius = "8px"
style = {{ overflow: "hidden" }}
>
< ScrollFog
style = {{ width: "100%" , height: "100%" }}
placement = {[ "top" , "bottom" , "left" , "right" ]}
>
< Box
width = "1148px"
height = "1148px"
p = "20px"
display = "flex"
flexDirection = "column"
gap = "12px"
>
{ ROWS . map (( row ) => (
< Box key = {row.id} display = "flex" flexDirection = "row" gap = "12px" >
{row.items. map (( item ) => (
< Box
key = {item}
width = "100px"
height = "100px"
flexShrink = { false }
display = "flex"
alignItems = "center"
justifyContent = "center"
borderRadius = "4px"
bg = "bg.neutralWeak"
>
< Text color = "fg.neutral" fontSize = "14px" >
{item}
</ Text >
</ Box >
))}
</ Box >
))}
</ Box >
</ ScrollFog >
</ Box >
</ Box >
);
}
Using hideScrollBar, you can hide the scrollbar while maintaining the fog effect.
import "./styles" ;
import { Box, ScrollFog, Text, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
const ITEMS = Array. from ({ length: 20 }, ( _ , index ) => index + 1 );
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< Box
className = {seedClassName}
height = "full"
display = "flex"
alignItems = "center"
justifyContent = "center"
bg = "bg.layerDefault"
>
< Box
width = "300px"
height = "240px"
borderWidth = { 1 }
borderColor = "stroke.neutralWeak"
borderRadius = "8px"
style = {{ overflow: "hidden" }}
>
< ScrollFog
style = {{ width: "100%" , height: "100%" }}
hideScrollBar
placement = {[ "top" , "bottom" ]}
>
< VStack pt = "20px" px = "16px" pb = "80px" gap = "12px" >
< Text color = "fg.neutralMuted" fontSize = "14px" >
hideScrollBar: true
</ Text >
< VStack gap = "8px" >
{ ITEMS . map (( item ) => (
< Box
key = {item}
height = "40px"
flexShrink = { false }
display = "flex"
alignItems = "center"
justifyContent = "center"
borderRadius = "4px"
bg = "bg.neutralWeak"
>
< Text color = "fg.neutral" fontSize = "14px" >
콘텐츠 {item}
</ Text >
</ Box >
))}
</ VStack >
</ VStack >
</ ScrollFog >
</ Box >
</ Box >
);
}