Menus & navigation JS behaviour

Promo bar

An announcement strip with a rotated sticker badge and an arrow link; dismissing folds it away (grid 1fr → 0fr) and is remembered for the session by default.

Real scenarios

The component as it is used in a product — not a specimen grid.

The autumn sale strip

Close it: the strip folds away in one motion and stays gone for this session (persist is the default). The reset button clears that memory.

The one that always comes back

persist="false" drops the memory — right for maintenance banners that must survive every reload. badge={false} removes the sticker.

Important props

Important props
Prop Type Default What it does
id string promo A unique id for remembering the dismissal (the sessionStorage key).
badge string null The rotated sticker beside the message; false removes it.
href / link-label string null The arrow link at the end of the message and its text.
persist bool true false brings it back on every reload.
nx-dismiss event — Fired on dismiss so the server knows.

Snippet

<x-nx::promo-bar id="shop-launch" badge="جدید" href="/components" link-label="دیدن تخفیف‌ها"
    x-on:nx-dismiss="$wire.ping('بسته شد')">حراج پاییزه — تا ۷۰٪ روی همهٔ قالب‌ها</x-nx::promo-bar>