# Scroll Fog
URL: /lynx/components/scroll-fog
Source: https://github.com/daangn/seed-design/blob/dev/docs/content/lynx/components/scroll-fog.mdx
Serves as a hint to visually inform users that additional content exists in a scrollable area.
사용 가능 버전: @seed-design/lynx-react@1.0.0
## Preview
```tsx
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 (
{ITEMS.map((item) => (
콘텐츠 {item}
))}
);
}
```
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.
## Installation
- npm: npm install @seed-design/lynx-react
- pnpm: pnpm add @seed-design/lynx-react
- yarn: yarn add @seed-design/lynx-react
- bun: 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.
## Usage
`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.
```tsx
import { ScrollFog } from "@seed-design/lynx-react";
export function App() {
return (
Content to scroll
);
}
```
## Props
### Scroll Fog
## Examples
### Padding
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.
```tsx
// Vertical scroll - top/bottom padding needed
...
// Horizontal scroll - left/right padding needed
...
```
### Horizontal Scroll
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.
```tsx
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 (
{ITEMS.map((item) => (
항목 {item}
))}
);
}
```
### Size
You can adjust the fog size in all directions at once using `size`. Using `sizes` allows you to specify different sizes for each direction.
```tsx
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 (
fog size: 40px
{ITEMS.map((item) => (
콘텐츠 {item}
))}
);
}
```
```tsx
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 (
{ROWS.map((row) => (
{row.items.map((item) => (
{item}
))}
))}
);
}
```
### All Directions
When 2D scrolling is needed, you can apply fog effects in all directions using `placement={["top", "bottom", "left", "right"]}`.
```tsx
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 (
{ROWS.map((row) => (
{row.items.map((item) => (
{item}
))}
))}
);
}
```
### Hide Scrollbar
Using `hideScrollBar`, you can hide the scrollbar while maintaining the fog effect.
```tsx
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 (
hideScrollBar: true
{ITEMS.map((item) => (
콘텐츠 {item}
))}
);
}
```