Notice Bar

An announcement bar with notice cycling, overflow scrolling, fixed actions and controlled visibility.

Notice Bar

Default

Short text stays stationary; overflow scrolls automatically.

Colors and tone

Use type for a semantic tone and color for a brand accent. Per-item tones work in notice lists.

Variants

Choose a soft, solid or plain surface independently of geometry. text-color can adjust custom solid foregrounds.

Shape

Rounded and square geometry use the shared shape configuration.

Size

The shared small, default and large scale changes text, spacing and controls together.

Overflow scrolling

Only overflowing content scrolls. speed uses px/s; duration keeps its seconds unit. Hover/focus, paused and system motion preferences control playback. Offscreen and hidden pages pause automatic activity.

Multiple notices

items accepts strings or notice objects. Bind active-index, use built-in navigation, or let autoplay advance. The interval is in milliseconds; long scrolling messages finish a reading cycle before advancing. Controls and actions stay fixed.

Wrapping and truncation

Use wrapable to show the entire message. scrollable=false keeps a single stationary line with an ellipsis and native title.

Content can be a native link or clickable button. Fixed prefix, suffix and actions slots remain separate from scrolling text and the close control. Content slots are best for text and lightweight decoration; put interactive controls in actions.

Controlled visibility

Use v-model to show a previously closed notice again. close reports the close request; closed reports the completed exit.

Before close

Use before-close to wait for a choice, save a preference or complete other asynchronous work before closing. Resolve the Promise to approve; reject to keep the notice visible. The example uses Dialog to choose temporary or permanent dismissal, with the application saving the preference in localStorage. Reset clears this example’s saved preference.

The built-in button, slot close() and instance close() use the hook. Direct changes to v-model remain controlled by the owner. Waiting pauses automatic motion and disables duplicate button requests; closePending is available on the instance and in slot scopes. Handle close-error when rejected reasons need feedback.

API

PROPS

Property
Type
Values
Description
default
Example
More
content
String
text
Text used without a content/default slot.
—
items
Array<string | >
string | NoticeBarItem
Notices to cycle; each item may supply content, type, icon, href, target and disabled.
[]
v-model
Boolean
true | false
Two-way visibility binding.
—
v-model:active-index
Number
zero-based integer
Two-way current-notice binding.
—
type
info | primary | success | warning | warn | danger
Default tone. Per-item type overrides it; warn aliases warning.
info
color
String
primary | success | danger | warn | warning | dark | text | light | secondary | RGB | RGBA | HEX | HSL | HSLA
Custom surface accent; overrides the type color.
—
text-color
String
primary | success | danger | warn | warning | dark | text | light | secondary | RGB | RGBA | HEX | HSL | HSLA
Custom foreground, useful with a custom solid surface.
—
variant
String
soft | solid | plain
Surface treatment.
soft
shape
rounded | square
Geometry; inherits ConfigProvider/install defaults when omitted.
rounded
size
small | medium | large
Density; inherits the shared size configuration.
—
icon
String | false
icon name | false
Custom leading icon name; false hides the built-in bell. The icon slot takes precedence.
—
closable
Boolean
true | false
Display an independent close control.
false
before-close
() => Promise<void>
—
Async approval for the built-in close button, slot close() and instance close(). Fulfillment permits closing; rejection or throwing retains the notice and emits close-error. Pending requests merge and pause autoplay.
—
scrollable
Boolean
true | false
Permit horizontal scrolling only when content overflows. Short notices remain stationary.
true
duration
Number
seconds
Marquee cycle duration in seconds; speed takes precedence when supplied.
12
speed
Number
pixels per second
Constant marquee speed in pixels per second.
—
delay
Number
milliseconds
Initial marquee delay, in milliseconds.
1000
gap
Number
pixels
Spacing between repeated notice text.
32
wrapable
Boolean
true | false
Show full wrapped content and disable marquee.
false
autoplay
Boolean
true | false
Automatically advance when there is more than one notice.
true
interval
Number
millisecondsminimum 500
Time between notices. Overflowing text gets at least its initial delay plus one full marquee cycle.
3000
loop
Boolean
true | false
Wrap navigation/autoplay around the notice list; false stops at its ends.
true
paused
Boolean
true | false
Pause marquee and automatic notice changes.
false
pause-on-hover
Boolean
true | false
Pause automatic motion while the pointer is over the bar.
true
pause-on-focus
Boolean
true | false
Pause automatic motion while focus is inside the bar; manual navigation stays available.
true
reduced-motion
Boolean
true | false
Override the system preference. Reduced motion disables autoplay/marquee and wraps the full text.
—
show-navigation
Boolean
true | false
Show previous/next controls for multiple notices.
false
show-indicator
Boolean
true | false
Show the current/total counter for multiple notices.
false
href
String
URL
Native link for the content area. Per-item href takes precedence.
—
target
String
_self | _blank
Link target; blank links include noopener noreferrer.
_self
clickable
Boolean
true | false
Use a keyboard-operable content button when there is no link. Keep interactive controls in actions.
false
live
String
off | polite | assertive
Announcement policy. Single notices default to polite, lists to off; role=alert defaults to assertive.
—

EVENTS

Event
Type
Description
default
Example
More
update:modelValue
Boolean
Visibility request.
—
—
update:activeIndex
Number
Current-index request.
—
—
change
(index: number, item: ) => void
Current notice index changed; receives the selected item.
—
—
click
MouseEvent
Click on the bar/content; reserved controls and actions stop propagation.
—
—
close
—
An approved close request; not emitted while awaiting approval or after rejection.
—
—
close-error
(reason: unknown) => void
Close approval rejected, threw or returned a non-Promise; receives the original reason.
—
closed
—
Exit animation completed.
—
—
scroll-end
—
One full marquee cycle completed.
—
—

SLOTS

Slot
Scope
Description
default
Example
More
default
Notice content fallback.
—
content
Scoped current-notice content; takes precedence over default.
—
icon
Leading icon; retains its fixed region.
—
prefix
Fixed content before the message.
—
suffix
Fixed decorative content after the message.
—
actions
Fixed interactive actions; their clicks do not trigger the bar click event.
—
navigation
Replace the notice navigation area using next/prev scope callbacks.
—
close-icon
Replace only the close artwork; the native accessible close button remains.
—

EXPOSES

Method
Type
Description
default
Example
More
open
() => void
Request visibility.
—
—
close
() => Promise<boolean>
Request guarded closing; resolves true after approval or false after rejection/cancellation. closed reports the completed exit animation.
—
closePending
Boolean
Close approval is pending; also available in every slot scope.
—
next
() => void
Next notice, respecting loop.
—
—
prev
() => void
Previous notice, respecting loop.
—
—
goTo
(index: number) => void
Request a zero-based index; clamps invalid bounds.
—
—
pause
() => void
Pause automatic activity manually.
—
—
resume
() => void
Release manual pause; other pause conditions still apply.
—
—
reset
() => void
Return to the first notice and restart the marquee/autoplay timing.
—
—
visible
Boolean
Effective visibility.
—
—
activeIndex
Number
Effective current index.
—
—
paused
Boolean
Effective playback pause state.
—
—
scrolling
Boolean
Whether overflowing text uses marquee.
—
—
Last Updated: 2026-10-28, 06:17:56 UTC
Copied