BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fulldev/ui/banner

banner

fulldev-ui/banner
FreeComponent

fulldev/ui publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by fulldev/ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.full.dev/r/banner.json

Source

src/components/ui/banner/banner.astroui.full.dev/r/banner.json
1---
2import type { HTMLAttributes } from "astro/types"
3import { cva, type VariantProps } from "class-variance-authority"
4
5import { cn } from "@/lib/utils"
6
7type Props = HTMLAttributes<"aside"> &
8 VariantProps<typeof variants> & {
9 storageKey?: string
10 }
11
12const variants = cva("relative flex items-center py-2", {
13 variants: {
14 variant: {
15 default: "bg-foreground text-background w-full",
16 floating:
17 "bg-background mx-auto my-2 w-[calc(100%-2rem)] max-w-[calc(var(--container,1280px)-2rem)] overflow-hidden rounded-lg border shadow-sm",
18 },
19 },
20 defaultVariants: {
21 variant: "default",
22 },
23})
24
25const { class: className, variant, storageKey, ...props } = Astro.props
26---
27
28<aside
29 class={cn(variants({ variant }), className)}
30 data-slot="banner"
31 data-banner-storage-key={storageKey}
32 data-variant={variant}
33 {...props}
34>
35 <slot />
36</aside>
37
38<script is:inline>
39 const initializedKey = "fulldevBannerInitialized"
40
41 if (!document.documentElement.dataset[initializedKey]) {
42 document.documentElement.dataset[initializedKey] = "true"
43
44 const getStorageToken = (key) => `banner:${key}`
45
46 const syncBanners = () => {
47 document.querySelectorAll("[data-slot='banner']").forEach((banner) => {
48 if (!(banner instanceof HTMLElement)) return
49
50 const storageKey = banner.dataset.bannerStorageKey
51
52 if (
53 storageKey &&
54 sessionStorage.getItem(getStorageToken(storageKey)) === "hidden"
55 ) {
56 banner.hidden = true
57 }
58 })
59 }
60
61 syncBanners()
62
63 document.addEventListener("click", (event) => {
64 const target = event.target
65
66 if (!(target instanceof Element)) return
67
68 const closeButton = target.closest("[data-slot='banner-close']")
69
70 if (!(closeButton instanceof HTMLElement)) return
71
72 const banner = closeButton.closest("[data-slot='banner']")
73
74 if (!(banner instanceof HTMLElement)) return
75
76 banner.hidden = true
77
78 const storageKey = banner.dataset.bannerStorageKey
79
80 if (storageKey) {
81 sessionStorage.setItem(getStorageToken(storageKey), "hidden")
82 }
83 })
84 }
85</script>

What it pulls in

Other registry items

  • @fulldev/button
  • @fulldev/dropdown-menu
  • @fulldev/icon

Files it writes

  • src/components/ui/banner/banner.astro
  • src/components/ui/banner/banner-container.astro
  • src/components/ui/banner/index.ts

Facts

Registry
fulldev/ui
Type
registry:ui
Access
Free
Files written
3
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on fulldev/ui ui.full.dev fulldotdev/ui on GitHub Raw registry item This item as JSON

More from fulldev/ui

All 144 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionfulldev/uiComponentsFree1 dep · 5 files
alertalertfulldev/uiComponentsFreeno deps · 5 files
alert-dialogalert-dialogfulldev/uiComponentsFree1 dep · 13 files
avataravatarfulldev/uiComponentsFreeno deps · 7 files
badgebadgefulldev/uiComponentsFreeno deps · 3 files
breadcrumbbreadcrumbfulldev/uiComponentsFreeno deps · 8 files
buttonbuttonfulldev/uiComponentsFreeno deps · 3 files
cardcardfulldev/uiComponentsFreeno deps · 8 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex