PrintButton
SM, under 950B gzippedA button that prints the page.
- Category
- Media & layout
- Budget
- sm, single-purpose control
- Runtime deps
- None
Preview
This is the exact fixture the conformance suite renders in CI. Switch the language to see the component mirror and reformat.
Install
npx shadcn@latest add https://kata-ui-rho.vercel.app/r/print-button.jsonCopies the source into your project. Pulls in 1 primitive: cn.
Source
import { cn } from "../lib/cn";
/** Prints the page. A tiny component, included because `window.print()` needs no framework — just a button that calls it. */
export function PrintButton({ label = "Print", className }: { label?: string; className?: string }) {
return (
<button
type="button"
onClick={() => window.print()}
className={cn(
"rounded-md border border-neutral-300 px-3 py-1.5 text-sm hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 dark:border-neutral-700 dark:hover:bg-neutral-800",
className,
)}
>
{label}
</button>
);
}
What CI checks
- Bundled, minified and gzipped against its tier budget
- Audited by axe in the state previewed above
- Rendered through react-dom/server with no browser globals
- Scanned for network calls, dangerous sinks, and unguarded animation