Lynx

Page Banner

A top-level message component that communicates overall status or important messages at the top of the page.

Engine ≥ 3.6
Available since@seed-design/lynx-react@0.6.0, @seed-design/lynx-css@0.10.0
Loading Lynx example…

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

The installed snippet provides a basic banner, a banner with the entire area tappable, and a dismissible banner.

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

export function App() {
  return <PageBanner title="Notice" description="Check out the latest news." />;
}

If low-level composition is needed, you can use the compound API from @seed-design/lynx-react directly.

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

export function App() {
  return (
    <PageBanner.Root tone="informative">
      <PageBanner.Content>
        <PageBanner.Body>
          <PageBanner.Title>Notice</PageBanner.Title>
          <PageBanner.Description>Check out the latest news.</PageBanner.Description>
        </PageBanner.Body>
      </PageBanner.Content>
    </PageBanner.Root>
  );
}

Examples

With Button

By passing PageBannerButton to the suffix of PageBanner, you can place a button next to the message.

Loading Lynx example…

Tones and Variants

tone supports neutral, positive, informative, warning, critical, magic. variant supports weak and solid. The default combination is neutral and weak.

Neutral

Loading Lynx example…

Positive

Loading Lynx example…

Informative

Loading Lynx example…

Warning

Loading Lynx example…

Critical

Loading Lynx example…

Magic

tone="magic" can only be used with variant="weak".

Loading Lynx example…

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

AreaReact WebLynx
Native elementdiv, span, buttonview, text
EventonClickbindtap, main-thread:bindtap
AccessibilityHTML semantics, ARIAaccessibility-*
PolymorphismasChild supportedNot supported
Interaction feedbackfocus ring, scale feedbackpressed 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-*.

Table of contents