Menu

Banner

Page-wide announcement. 5 types.

Eid sale: 15% off every gift box until Friday.

Installation

$ npx uix-ui@latest add banner

This copies the file into components/ui/banner.tsx in your project. npx shadcn@latest add @uix/banner works too.

Usage

banner.tsx
import { Banner } from "@/components/ui/banner";

<div style={{ width: "100%" }}>
  <Banner type="brand" action={<Button size="sm" variant="outline">See the list</Button>}>Eid sale: 15% off every gift box until Friday.</Banner>
</div>

Props

PropTypeDefaultDescription
typebrand | info | success | warning | error"brand"
actionReact.ReactNode–Link or text shown after the message, underlined.
onClose() => void–Shows a close button and calls this when it is pressed.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close