Banner

An announcement bar for the top of a site, above the Navbar: an icon, a message and a link, with a button that closes it.

Your announcement goes here.Link

import { Banner } from "@produkto/ui/Banner";
import { Megaphone01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const Example = () => (
  <Banner
    dismissible
    icon={<Icon icon={Megaphone01Icon} />}
    link={{ label: "Link", link: "#" }}
    message="Your announcement goes here."
  />
);

export default Example;

Usage

import { Banner } from "@produkto/ui/Banner";
<Banner
  appearance="solid | soft | outline"
  icon={<Megaphone01Icon />}
  message="Your announcement goes here."
  link={{ label: "Link", link: "#" }}
  action={{ label: "Action", link: "#" }}
  dismissible
  onDismiss={() => {}}
  sticky
/>

Examples

Appearances

appearance paints the bar: solid for the announcement that matters most, soft, or outline, the page with a line under it.

Your announcement goes here.Link

Your announcement goes here.Link

Your announcement goes here.Link

import { Banner, type BannerAppearance } from "@produkto/ui/Banner";
import { Megaphone01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const appearances: BannerAppearance[] = ["solid", "soft", "outline"];

const Example = () => (
  <div className="flex flex-col gap-6">
    {appearances.map((appearance) => (
      <Banner
        key={appearance}
        appearance={appearance}
        dismissible
        icon={<Icon icon={Megaphone01Icon} />}
        link={{ label: "Link", link: "#" }}
        message="Your announcement goes here."
      />
    ))}
  </div>
);

export default Example;

Action

action sets a small Button after the message, turned over on the solid appearance so it stands out from the bar.

Your announcement goes here.

Action

Your announcement goes here.

Action
import { Banner } from "@produkto/ui/Banner";
import type { BlockAction } from "@produkto/ui/Section";
import { GiftIcon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const action: BlockAction = { label: "Action", link: "#" };

const Example = () => (
  <div className="flex flex-col gap-6">
    <Banner
      action={action}
      appearance="solid"
      icon={<Icon icon={GiftIcon} />}
      message="Your announcement goes here."
    />
    <Banner
      action={action}
      align="start"
      appearance="soft"
      dismissible
      icon={<Icon icon={GiftIcon} />}
      message="Your announcement goes here."
    />
  </div>
);

export default Example;

Dismissible

dismissible adds the close button. Left alone the bar hides itself; with open and onDismiss the page keeps the state, to remember the choice or bring the bar back.

Your announcement goes here.Link

import { Banner } from "@produkto/ui/Banner";
import { Button } from "@produkto/ui/Button";
import { Megaphone01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import { useState } from "react";

const Example = () => {
  const [open, setOpen] = useState(true);

  return (
    <div className="flex min-h-32 flex-col gap-6">
      <Banner
        appearance="solid"
        dismissible
        icon={<Icon icon={Megaphone01Icon} />}
        link={{ label: "Link", link: "#" }}
        message="Your announcement goes here."
        onDismiss={() => setOpen(false)}
        open={open}
      />
      <div className="flex justify-center px-6">
        <Button
          appearance="outline"
          disabled={open}
          onClick={() => setOpen(true)}
        >
          Show the banner
        </Button>
      </div>
    </div>
  );
};

export default Example;

Sticky

sticky keeps the bar at the top of the page while it scrolls under it. Scroll the frame to see it hold.

Your announcement goes here.Link

Title

Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
import { Banner } from "@produkto/ui/Banner";
import { Megaphone01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import { ScrollArea } from "@produkto/ui/ScrollArea";

const lines: string[] = [
  "Line 1",
  "Line 2",
  "Line 3",
  "Line 4",
  "Line 5",
  "Line 6",
  "Line 7",
  "Line 8",
];

const Example = () => (
  <ScrollArea className="h-80">
    <Banner
      appearance="solid"
      dismissible
      icon={<Icon icon={Megaphone01Icon} />}
      link={{ label: "Link", link: "#" }}
      message="Your announcement goes here."
      sticky
    />
    <div className="mx-auto flex max-w-6xl flex-col gap-4 p-6">
      <h3 className="heading-xl">Title</h3>
      {lines.map((line) => (
        <div
          key={line}
          className="rounded-xl border border-border bg-card p-6 description-base"
        >
          {line}
        </div>
      ))}
    </div>
  </ScrollArea>
);

export default Example;

Moving line

marquee repeats the message across the bar on the kit's Marquee, slowly, pausing under the pointer and standing still for anyone who asks for less motion, while its link stays at the end.

Your announcement goes here.
import { Banner } from "@produkto/ui/Banner";
import { Megaphone01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const Example = () => (
  <Banner
    appearance="solid"
    icon={<Icon icon={Megaphone01Icon} />}
    link={{ label: "Link", link: "#" }}
    message="Your announcement goes here."
    marquee
  />
);

export default Example;

API Reference

Banner

BannerProps · blocks/Banner/Banner.types.ts
PropTypeDefault
messageReactNode-
iconReactNode-
linkBlockLink-
actionBlockAction-
appearanceBannerAppearance"solid" | "soft" | "outline""outline"
alignSectionAlign"start" | "center" | "end""center"
widthSectionWidth"narrow" | "base" | "wide""base"
stickybooleanfalse
marqueebooleanfalse
dismissiblebooleanfalse
openboolean-
defaultOpenbooleantrue
onDismiss() => void-

BlockLink

used by link
PropTypeDefault
labelrequiredstring-
linkrequiredstring-

BlockAction

used by action
PropTypeDefault
appearanceButtonAppearance"solid" | "soft" | "outline" | "transparent"-
toneButtonTone"neutral" | "accent" | "destructive" | "success" | "warning" | "info"-
iconReactNode-
iconOnlyboolean-
borderRadiusBlockActionBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl" | "full"-
labelrequiredstring-
linkrequiredstring-

It also takes the props of <div>.