Lynx

Page Banner

페이지 상단에서 전체 상태나 중요한 메시지를 전달하는 상위 레벨 메시지 컴포넌트입니다.

Engine ≥ 3.6
사용 가능 버전@seed-design/lynx-react@0.6.0, @seed-design/lynx-css@0.10.0
Lynx 예제를 불러오는 중입니다.

Installation

npx @seed-design/cli@latest add ui:page-banner

Props

PageBanner

Prop

Type

prefixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
title?React.ReactNode
descriptionReact.ReactNode
suffix?React.ReactNode
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined
style?CSSProperties | undefined
className?string | undefined

PageBannerButton

Prop

Type

style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined

ActionablePageBanner

Prop

Type

prefixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
title?React.ReactNode
descriptionReact.ReactNode
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined
style?CSSProperties | undefined
className?string | undefined

DismissiblePageBanner

Prop

Type

prefixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
title?React.ReactNode
descriptionReact.ReactNode
dismissLabel?string | undefined
open?boolean | undefined
defaultOpen?boolean | undefined
onDismiss?(() => void) | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined
style?CSSProperties | undefined
className?string | undefined

Usage

설치한 snippet은 기본 배너와 전체 영역을 탭할 수 있는 배너, 닫을 수 있는 배너를 제공합니다.

import { PageBanner } from "@/components/ui/page-banner";

export function App() {
  return <PageBanner title="알림" description="새로운 소식을 확인해 보세요." />;
}

저수준 조합이 필요하면 @seed-design/lynx-react의 compound API를 직접 사용할 수 있습니다.

import { PageBanner } from "@seed-design/lynx-react";

export function App() {
  return (
    <PageBanner.Root tone="informative">
      <PageBanner.Content>
        <PageBanner.Body>
          <PageBanner.Title>알림</PageBanner.Title>
          <PageBanner.Description>새로운 소식을 확인해 보세요.</PageBanner.Description>
        </PageBanner.Body>
      </PageBanner.Content>
    </PageBanner.Root>
  );
}

Examples

With Button

PageBannersuffixPageBannerButton을 전달하면 메시지 옆에 버튼을 배치할 수 있습니다.

Lynx 예제를 불러오는 중입니다.

Tones and Variants

toneneutral, positive, informative, warning, critical, magic을 지원합니다. variantweaksolid를 지원합니다. 기본 조합은 neutralweak입니다.

Neutral

Lynx 예제를 불러오는 중입니다.

Positive

Lynx 예제를 불러오는 중입니다.

Informative

Lynx 예제를 불러오는 중입니다.

Warning

Lynx 예제를 불러오는 중입니다.

Critical

Lynx 예제를 불러오는 중입니다.

Magic

tone="magic"variant="weak"과만 함께 사용할 수 있습니다.

Lynx 예제를 불러오는 중입니다.

Action and Dismiss

전체 배너를 액션으로 사용하려면 ActionablePageBannerbindtapaccessibility-label을 전달하세요. 닫기 상태를 직접 관리할 때는 DismissiblePageBanneropenonDismiss를 사용합니다.

Web Version Differences

영역React WebLynx
Native elementdiv, span, buttonview, text
EventonClickbindtap, main-thread:bindtap
AccessibilityHTML semantics, ARIAaccessibility-*
PolymorphismasChild 지원미지원
Interaction feedbackfocus ring, scale feedbackpressed 배경색, 본문 Content Scale, Button·CloseButton Root Scale

Actionable Root는 배경을 유지하고 내부 콘텐츠만 축소하는 Content Scale을 적용합니다. PageBannerButton과 CloseButton은 각각 자신의 영역을 축소하는 Root Scale을 적용합니다. 개별 버튼을 누르면 본문 액션이 함께 실행되거나 중복 축소되지 않습니다. PageBannerButton, actionable Root, CloseButton은 기본적으로 button trait를 사용합니다.

CloseButton은 Root의 직접 자식 또는 Fragment 안에 배치해야 본문 축소 영역에서 분리됩니다. 사용자 정의 컴포넌트로 감싸면 본문 축소 영역에 포함됩니다.

Unsupported Lynx Features

  • asChild: Lynx에는 DOM Slot 기반 다형 렌더링이 없습니다. PageBannerButton은 Lynx text 요소로 렌더링됩니다.
  • 웹 focus ring: Lynx는 웹 키보드 포커스 모델을 사용하지 않습니다.
  • HTML attribute와 ARIA prop: 대응하는 Lynx native prop과 accessibility-*를 사용하세요.

Last updated on

목차