프리뷰 또는 이전 버전의 문서를 보고 있습니다.seed-design.io 방문
우리는 왜 디자인 엔지니어를 찾게 됐을까
Skip to Content
React

Snackbar

화면 하단에 일시적으로 나타나 상태나 결과를 안내하는 컴포넌트입니다.

사용 가능 버전@seed-design/[email protected], @seed-design/[email protected]

Installation

npx @seed-design/cli@latest add ui:snackbar

Props

Snackbar

Prop

Type

messagestring

스낵바에 표시할 메시지

actionLabel?string | undefined

스낵바에 표시할 액션 버튼의 라벨

onAction?(() => void) | undefined

액션 버튼 클릭 시 호출되는 콜백

variant?"critical" | "default" | "positive" | undefined

Default

"default"

SnackbarAdapter.create Parameters (CreateSnackbarOptions)

Prop

Type

timeout?number | undefined

The duration the snackbar will be visible

Default

4000

removeDelay?number | undefined

The duration for the snackbar to kept alive before it is removed. Useful for exit transitions.

Default

200

onClose?(() => void) | undefined

Function called when the snackbar has been closed and removed

render() => React.ReactNode

The content to render in the snackbar region

strategy?"immediate" | "queued" | undefined

Override the provider-level strategy for this specific snackbar.

  • "immediate": Replace the current snackbar instantly.
  • "queued": Wait in the queue until the current one is dismissed.

SnackbarProvider

Prop

Type

pauseOnInteraction?boolean | undefined

Whether to pause the toast when interacted with

Default

true

strategy?"immediate" | "queued" | undefined

How to handle multiple snackbars.

  • "immediate": New snackbar replaces the current one instantly.
  • "queued": New snackbar waits in a queue until the current one is dismissed.

Default

"immediate"

childrenReact.ReactNode

Examples

Variants

Positive

Critical

Pause on Interaction

사용자가 Snackbar와 상호작용(hover 및 active) 하는 동안 Snackbar가 timeout으로 인해 dismiss되지 않도록 하려면 SnackbarProvider의 pauseOnInteraction을 true로 설정합니다.

기본값
  • @seed-design/[email protected]까지: false: 명시하지 않는 경우, 상호작용 여부와 관계없이 timeout이 지나면 dismiss됩니다.
  • 이후 버전: true: 명시하지 않는 경우, 사용자가 상호작용하는 동안 timeout이 멈춥니다.

Strategy

Snackbar가 이미 표시 중일 때 새로운 Snackbar를 생성하면, 기본적으로 기존 Snackbar를 즉시 교체합니다 (immediate). 큐에 넣고 순차적으로 보여주려면 strategy: "queued"를 사용합니다.

strategy는 SnackbarProvider에서 기본값을 설정하거나, create() 호출 시 개별적으로 지정할 수 있습니다.

Avoid Overlap

<SnackbarAvoidOverlap /> 컴포넌트를 사용하여 스낵바가 겹치지 않아야 하는 영역을 지정할 수 있습니다. <SnackbarAvoidOverlap />의 자식 컴포넌트는 forwardRef(~React 18) 혹은 ref prop(React 19~)으로 ref를 전달받아야 합니다. offset은 다음 상황에서 갱신됩니다.

  • SnackbarAvoidOverlap의 자식 컴포넌트가 mount될 때
  • SnackbarAvoidOverlap의 자식 컴포넌트가 unmount될 때
  • SnackbarAvoidOverlap의 자식 컴포넌트의 높이가 변경될 때
  • SnackbarRegion의 높이가 변경될 때
Snackbar가 이 영역과 겹치지 않게 조정됩니다. 스크롤은 무시합니다.

Last updated on 2026. 8. 2.