Lynx

Callout

사용자에게 중요한 정보나 팁을 시각적으로 강조하여 전달하는 메시지 컴포넌트입니다.

사용 가능 버전@seed-design/[email protected], @seed-design/[email protected]
Lynx 예제를 불러오는 중입니다.

Installation

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

Props

Callout

Prop

Type

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

ActionableCallout

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

DismissibleCallout

Prop

Type

prefixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
title?React.ReactNode
descriptionReact.ReactNode
linkProps?SeedCallout.LinkProps | undefined
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은 기본 Callout, 전체 영역을 탭할 수 있는 ActionableCallout, 닫을 수 있는 DismissibleCallout을 export합니다.

import { Callout } from "@/components/ui/callout";

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

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

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

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

Prefix Icon

메시지의 의미를 보조하는 아이콘은 prefixIcon에 전달합니다. Lynx monochrome icon을 사용하면 PrefixIcon wrapper가 tone에 맞는 색상과 크기를 자동으로 적용합니다.

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

저수준 compound API에서는 Callout.Root의 첫 번째 child로 PrefixIcon을 배치하세요.

import IconBellFill from "@karrotmarket/lynx-monochrome-icon/IconBellFill";
import { Callout, PrefixIcon } from "@seed-design/lynx-react";

<Callout.Root tone="informative">
  <PrefixIcon icon={<IconBellFill />} />
  <Callout.Content>
    <Callout.Title>알림</Callout.Title>
    <Callout.Description>새로운 소식을 확인해 보세요.</Callout.Description>
  </Callout.Content>
</Callout.Root>;

Tones

toneneutral, informative, positive, warning, critical, magic을 지원합니다. 기본값은 neutral입니다.

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

Actionable Callout

전체 Callout을 액션으로 사용할 때는 bindtap을 전달합니다. 내부에 별도의 Link를 함께 두지 마세요.

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

Dismissible Callout

DismissibleCallout과 저수준 Callout.Rootopen, defaultOpen, onDismiss를 지원합니다. 닫기 버튼에는 현지화된 dismissLabel 또는 accessibility-label을 제공하세요.

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

Web Version Differences

영역React WebLynx
Native elementdiv, span, buttonview, text
EventonClickbindtap, main-thread:bindtap
AccessibilityHTML semantics, ARIAaccessibility-*
PolymorphismasChild 지원미지원
Link underlinetext-decorationLynx preset 제약으로 border 기반 표현

Lynx에서는 actionable Root가 터치되는 동안 pressed recipe variant를 적용합니다. Callout.Link는 기본적으로 accessibility-traits="link", actionable Root와 CloseButton은 button trait를 사용합니다.

Unsupported Lynx Features

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

Last updated on

목차