Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Overlays

  • Dialog
  • Modal
  • AlertDialog
  • Drawer
  • Popover
  • Tooltip
  • HoverCard
  • Glimpse
  • HeroVideoDialog
  • ElementSelectionOverlay

Messages

  • Alert
  • InterceptCard
  • Callout
  • Banner
  • Toast
  • Notification
  • ServiceMessage
  • Result
  • GiftFeed
  • FloatingReactions
  • Popconfirm

Loading and Progress

  • Spin
  • Spinner
  • Progress

Guidance

  • Tour

Banner

banner

Displays a full-width announcement with tone, action, and dismissal support.

Usage

Basic usage

Banner announcement bar, the leading icon is automatically colored with tone, and is centered in a single line by default.

New version 2.0 has been released, including 8 new components
tsx
<Banner icon={<Info />}>New version 2.0 has been released, including 8 new components</Banner>

Six tone

tone offers neutral / info / brand / success / warning / danger.

Deployment successful, service has been switched to the new version
Your membership will expire in 3 days
The system will be shut down for maintenance at 23:00
tsx
<>
  <Banner tone="success" icon={<Rocket />}>The deployment was successful and the service has been switched to the new version</Banner>
  <Banner tone="warning" icon={<TriangleAlert />}>Your membership will expire in 3 days</Banner>
  <Banner tone="danger" icon={<TriangleAlert />}>The system will be shut down for maintenance at 23:00</Banner>
</>

Solid color fill

variant="solid" uses a solid color base, which is more eye-catching and suitable for promotions/major announcements.

Limited time offer: Upgrade to Pro and enjoy 20% off
tsx
<Banner variant="solid" tone="brand" icon={<Sparkles />} align="center">
  Limited time offer: Upgrade to Pro and enjoy 20% off
</Banner>

Operation + Can be closed

Put the action slot on the right side of the operation and pass the onClose rendering close button.

We have updated our privacy policy
tsx
<Banner
  tone="neutral"
  icon={<Megaphone />}
  align="start"
  action={<Button size="sm" variant="outline">Learn more</Button>}
  onClose={() => setOpen(false)}
>
  We have updated our privacy policy
</Banner>

Rolling marquee

scrollable allows long copy to scroll seamlessly in a single line (hover pauses).

Welcome to use Hulian UI · Fully domestically produced design token · Dark mode available out of the box · Continuously updated
Welcome to use Hulian UI · Fully domestically produced design token · Dark mode available out of the box · Continuously updated
Welcome to use Hulian UI · Fully domestically produced design token · Dark mode available out of the box · Continuously updated
tsx
<Banner variant="solid" tone="info" icon={<Megaphone />} scrollable>
  Welcome to use Hulian UI · Fully domestically produced design token · Dark mode available out of the box · Continuously updated
</Banner>

When to use

Use Banner for a global announcement spanning the top of a container, such as maintenance, a promotion, or a release update. Use Alert for a static message inside a local section, Toast for transient imperative feedback, or Notification for a rich corner notification.

Import

ts
import { Banner } from "@hulianui/ui"

Props

NameTypeDefaultDescription
tone"neutral"|"info"|"brand"|"success"|"warning"|"danger""info"Semantic tone. brand uses the primary colour, info uses the dedicated info colour (same as Alert; the two stopped being identical in 0.8.0).
variant"soft"|"solid""soft"Light background or prominent solid fill.
align"start"|"center""center"Content alignment.
scrollablebooleanfalseScrolls long copy on one continuous CSS marquee line and pauses on hover.
closeLabelstring"\u5173\u95ed"Close-button accessible label. The built-in Chinese copy means “Close.”
classNamestring-Additional class name.

Events

EventTypeDescription
onClose() => voidWhen provided, renders a close button and reports activation.

Slots

SlotTypeDescription
iconReactNodeLeading SVG icon colored from the tone.
childrenReactNodeAnnouncement copy.
actionReactNodeTrailing link or button.

Example

tsx
<Banner tone="success" icon={<Rocket />}>Deployment completed; traffic now uses the new release.</Banner>

<Banner variant="solid" tone="brand" icon={<Sparkles />} action={<Link href="#" className="text-current underline">View offer</Link>} onClose={() => setOpen(false)}>
  The seasonal promotion is live across all components.
</Banner>

Usage guidelines

  • onClose reports intent but does not manage visibility; remove the banner from caller state. Without it, no close control renders.
  • scrollable is a one-line CSS marquee that pauses on hover. Do not use it for multiline content.
  • In a solid banner, give links in action text-current so they follow the fill's foreground instead of hard-coding a color.

Related

Alert · Toast · Notification · ServiceMessage · Result · GiftFeed

Playground

This is a full-width announcement strip
<Banner onClose={() => {}}>Announcement Content</Banner>
PreviousCalloutFeedbackNextToast

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage guidelines
    • Related
  • Playground