Load these demo styles alongside the package stylesheet for the same layout and surfaces.
.docs-banner-stack {
gap: var(--space-3);
}
HTML markup
Initial rendered HTML only. React handlers and portalled content require the JSX example; static HTML does not reproduce those interactions.
Dismissible
JSX usage
Install this example’s dependencies, load the package stylesheet from Setup, and add Example CSS where shown. The snippet includes its local helpers.
bun add @kongmy-dev/sapphire-ui react react-dom
"use client";
import { useRef } from "react";
import { Button } from "@kongmy-dev/sapphire-ui/button";
import { Banner, type BannerRef } from "@kongmy-dev/sapphire-ui/banner";
function BannerDismissible() {
const banner = useRef<BannerRef>(null);
return (
<div className="sp-stack">
<Banner ref={banner}>
New features are available.{' '}
<a href="#release-notes">Read release notes</a>
</Banner>
<Button onClick={() => banner.current?.show()}>Show announcement</Button>
</div>
);
}
export default BannerDismissible;
Example CSS
Load these demo styles alongside the package stylesheet for the same layout and surfaces.
.docs-banner-stack {
gap: var(--space-3);
}
HTML markup
Initial rendered HTML only. React handlers and portalled content require the JSX example; static HTML does not reproduce those interactions.
Props
Generated from the current public TypeScript signatures, including composed behaviour props. “—” means no default is declared in the local signature; forwarded behaviour defaults are not inferred.