# Page Banner
URL: /lynx/components/page-banner
Source: https://github.com/daangn/seed-design/blob/dev/docs/content/lynx/components/page-banner.mdx
A top-level message component that communicates overall status or important messages at the top of the page.
Lynx Engine 최소 버전: 3.6
사용 가능 버전: @seed-design/lynx-react@0.6.0, @seed-design/lynx-css@0.10.0
## Preview
```tsx
import "./styles";
import { useState } from "@lynx-js/react";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
const [open, setOpen] = useState(true);
function handleTap() {
"background only";
}
function handleDismiss() {
"background only";
setOpen(false);
}
return (
);
}
```
## Installation
- npm: npx @seed-design/cli@latest add ui:page-banner
- pnpm: pnpm dlx @seed-design/cli@latest add ui:page-banner
- yarn: yarn dlx @seed-design/cli@latest add ui:page-banner
- bun: bun x @seed-design/cli@latest add ui:page-banner
## Props
### `PageBanner`
### `PageBannerButton`
### `ActionablePageBanner`
### `DismissiblePageBanner`
## Usage
The installed snippet provides a basic banner, a banner with the entire area tappable, and a dismissible banner.
```tsx
import { PageBanner } from "@/components/ui/page-banner";
export function App() {
return ;
}
```
If low-level composition is needed, you can use the compound API from `@seed-design/lynx-react` directly.
```tsx
import { PageBanner } from "@seed-design/lynx-react";
export function App() {
return (
Notice
Check out the latest news.
);
}
```
## Examples
### With Button
By passing `PageBannerButton` to the `suffix` of `PageBanner`, you can place a button next to the message.
```tsx
import "./styles";
import { useSeedClassName } from "@seed-design/lynx-react";
import { PageBanner, PageBannerButton } from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
자세히 보기}
/>
);
}
```
### Tones and Variants
`tone` supports `neutral`, `positive`, `informative`, `warning`, `critical`, `magic`. `variant` supports `weak` and `solid`. The default combination is `neutral` and `weak`.
#### Neutral
```tsx
import "./styles";
import IconExclamationmarkCircleFill from "@karrotmarket/lynx-monochrome-icon/IconExclamationmarkCircleFill";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
PageBannerButton,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
);
}
```
#### Positive
```tsx
import "./styles";
import IconExclamationmarkCircleFill from "@karrotmarket/lynx-monochrome-icon/IconExclamationmarkCircleFill";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
PageBannerButton,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
);
}
```
#### Informative
```tsx
import "./styles";
import IconExclamationmarkCircleFill from "@karrotmarket/lynx-monochrome-icon/IconExclamationmarkCircleFill";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
PageBannerButton,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
);
}
```
#### Warning
```tsx
import "./styles";
import IconExclamationmarkCircleFill from "@karrotmarket/lynx-monochrome-icon/IconExclamationmarkCircleFill";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
PageBannerButton,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
);
}
```
#### Critical
```tsx
import "./styles";
import IconExclamationmarkCircleFill from "@karrotmarket/lynx-monochrome-icon/IconExclamationmarkCircleFill";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
PageBannerButton,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
suffix={등록하기}
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
bindtap={handleTap}
accessibility-label="미노출, 사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
}
title="미노출"
description="사업자 정보를 등록해주세요."
/>
);
}
```
#### Magic
`tone="magic"` can only be used with `variant="weak"`.
```tsx
import "./styles";
import IconSparkle2 from "@karrotmarket/lynx-multicolor-icon/IconSparkle2";
import { useSeedClassName } from "@seed-design/lynx-react";
import {
ActionablePageBanner,
DismissiblePageBanner,
PageBanner,
PageBannerButton,
} from "@/components/ui/page-banner";
export default function Example() {
const seedClassName = useSeedClassName({ colorMode: "system" });
function handleTap() {
"background only";
}
return (
}
title="새로운 기능"
description="마법 같은 소식이 도착했어요!"
suffix={둘러보기}
/>
}
title="새로운 기능"
description="마법 같은 소식이 도착했어요!"
bindtap={handleTap}
accessibility-label="새로운 기능, 마법 같은 소식이 도착했어요!"
/>
}
title="새로운 기능"
description="마법 같은 소식이 도착했어요!"
/>
);
}
```
## Action and Dismiss
To use the entire banner as an action, pass `bindtap` and `accessibility-label` to `ActionablePageBanner`. When managing the closed state directly, use `open` and `onDismiss` from `DismissiblePageBanner`.
## Web Version Differences
| Area | React Web | Lynx |
| -------------------- | -------------------------- | --------------------------------------------------------------------- |
| Native element | `div`, `span`, `button` | `view`, `text` |
| Event | `onClick` | `bindtap`, `main-thread:bindtap` |
| Accessibility | HTML semantics, ARIA | `accessibility-*` |
| Polymorphism | `asChild` supported | Not supported |
| Interaction feedback | focus ring, scale feedback | pressed background, body Content Scale, Button·CloseButton Root Scale |
Actionable Root applies Content Scale, which maintains the background and shrinks only the inner content. `PageBannerButton` and CloseButton each apply Root Scale, which shrinks their own area. Pressing individual buttons does not run the body action together or double-shrink. `PageBannerButton`, actionable Root, and CloseButton use button trait by default.
CloseButton must be placed as a direct child of Root or inside a Fragment to be separated from the body shrink area. Wrapping it in a custom component includes it in the body shrink area.
## Unsupported Lynx Features
- `asChild`: Lynx does not have DOM Slot-based polymorphic rendering. `PageBannerButton` is rendered as a Lynx `text` element.
- Web focus ring: Lynx does not use the web keyboard focus model.
- HTML attribute and ARIA prop: Use the corresponding Lynx native prop and `accessibility-*`.