adit-firdaus

Notice Bar

Buttons

About

A full-width, dismissible system banner for transient status messages (recording, connection, alerts) with an optional measured text marquee for long messages.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Notice Bar to your project and fits it to your theme.

Code

How Notice Bar is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import * as React from "react";
import { NoticeBar } from "@/components/ui/notice-bar";
import { IoFlashOutline } from "react-icons/io5";

function Screen({ children }: { children: React.ReactNode }) {
  return (
    <div
      style={{
        maxWidth: 420,
        width: "100%",
        borderRadius: "var(--may-radius-sheet)",
        overflow: "hidden",
        background: "var(--may-color-surface)",
      }}
    >
      {children}
    </div>
  );
}

export default function NoticeBarDismissibleDemo() {
  const [open, setOpen] = React.useState(true);

  return (
    <div className="w-full h-screen flex items-center justify-center bg-[var(--may-color-bg,#f2f2f7)] p-6">
      <div
        className="flex flex-col gap-4"
        style={{ maxWidth: 420, width: "100%" }}
      >
        <Screen>
          {open && (
            <NoticeBar
              tone="warning"
              icon={<IoFlashOutline aria-hidden />}
              marquee
              onClose={() => setOpen(false)}
              closeLabel="Dismiss battery notice"
              action={
                <button
                  type="button"
                  style={{
                    color: "inherit",
                    background: "none",
                    border: 0,
                    font: "inherit",
                    cursor: "pointer",
                  }}
                >
                  Settings
                </button>
              }
            >
              Battery health has degraded. Peak performance capability may be
              limited to prevent unexpected shutdowns.
            </NoticeBar>
          )}
        </Screen>
        {!open && (
          <button
            type="button"
            onClick={() => setOpen(true)}
            style={{
              alignSelf: "flex-start",
              padding: "var(--may-space-2) var(--may-space-4)",
              borderRadius: "var(--may-radius-full)",
              background: "var(--may-color-fill-secondary)",
              color: "var(--may-color-text)",
              border: 0,
              font: "inherit",
              cursor: "pointer",
            }}
          >
            Show the notice again
          </button>
        )}
      </div>
    </div>
  );
}

Dependencies

More by adit-firdaus

View all
  • Steps

    Steps

    46
  • Popover

    Popover

    4
  • Adaptive Sheet

    Adaptive Sheet

    2
  • Adaptive Card

    Adaptive Card

  • Box

    Box

  • Pagination

    Pagination

  • Label

    Label

  • Kbd

    Kbd

More in Buttons

View all
  • Button

    Button

    20
  • Button

    Button

    3
  • Button Group

    Button Group

    18
  • Button

    Button

    149
  • Icon Label Subtext Button

    Icon Label Subtext Button

    69
  • Button

    Button

    9
  • Button

    Button

    37
  • Texture Button

    Texture Button

    113