Announcement Bar
poyraz/announcement-barFreeComponent
Poyraz Soft Glass Announcement Bar with container-responsive layout and semantic tokens.
Install it
npx shadcn@latest add https://ui.poyrazavsever.com/r/announcement-bar.jsonSource
1"use client";23import * as React from "react";4import { cva, type VariantProps } from "class-variance-authority";5import { X } from "lucide-react";67import { cn } from "@/lib/utils";89/* ================================================================== */10/* ANNOUNCEMENT BAR — Dismissable top-of-page notification strip */11/* ================================================================== */1213const announcementBarVariants = cva(14 [15 "relative w-full",16 "text-sm font-medium tracking-wide",17 "border-b",18 "data-[state=open]:animate-poyraz-slide-in-from-top",19 "transition-colors duration-[var(--poyraz-motion-duration-fast)] ease-[var(--poyraz-motion-ease-out)]",20 ].join(" "),21 {22 variants: {23 variant: {24 default: "bg-inverted text-inverted-foreground border-inverted",25 info: "bg-info text-info-foreground border-info-border",26 success: "bg-success text-success-foreground border-success-border",27 warning: "bg-warning text-warning-foreground border-warning-border",28 danger: "bg-destructive text-destructive-foreground border-destructive",29 branded: "bg-primary text-primary-foreground border-primary-800",30 },31 },32 defaultVariants: {33 variant: "default",34 },35 },36);3738export interface AnnouncementBarProps39 extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof announcementBarVariants> {40 /** Allow users to dismiss the bar */41 dismissible?: boolean;42 /** Callback when dismissed */43 onDismiss?: () => void;44 /** Icon to show before the content */45 icon?: React.ReactNode;46 /** Action element (e.g. link or button) at the end */47 action?: React.ReactNode;48 /** Controlled visibility. Persistence belongs to the caller or optional hook. */49 open?: boolean;50 /** Initial visibility for uncontrolled usage. */51 defaultOpen?: boolean;52 /** Called whenever visibility changes. */53 onOpenChange?: (open: boolean) => void;54}5556const AnnouncementBar = React.forwardRef<HTMLDivElement, AnnouncementBarProps>(57 (58 {59 className,60 variant,61 dismissible = true,62 onDismiss,63 icon,64 action,65 open: controlledOpen,66 defaultOpen = true,67 onOpenChange,68 onAnimationEnd,69 onTransitionEnd,70 children,71 ...props72 },73 ref,74 ) => {75 const [internalOpen, setInternalOpen] = React.useState(defaultOpen);76 const open = controlledOpen ?? internalOpen;77 const [present, setPresent] = React.useState(open);78// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from poyraz
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | poyraz | Components | Free | 2 deps | |
| Alertalert | poyraz | Components | Free | 2 deps | |
| Autocompleteautocomplete | poyraz | Components | Free | 1 dep | |
| Avataravatar | poyraz | Components | Free | 2 deps | |
| Badgebadge | poyraz | Components | Free | 1 dep | |
| Bg Patternbg-pattern | poyraz | Components | Free | no deps | |
| Breadcrumbbreadcrumb | poyraz | Components | Free | 1 dep | |
| Buttonbutton | poyraz | Components | Free | 2 deps |
