UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

39 lines (26 loc) 840 B
# SecurePdfViewer ## Overview PDF viewer with secure defaults and dynamic worker setup. Uses `react-pdf` with automatic worker URL and responsive sizing. --- ## Props | Prop | Type | Default | Description | | --- | --- | --- | --- | | `url` | `string` | | PDF URL to load | | `initialPage` | `number` | `1` | Starting page number | | `className` | `string` | `""` | Additional wrapper classes | --- ## Behavior - Dynamically imports `react-pdf` and sets `pdfjs` worker src - Measures container width to render pages responsively - Provides basic pagination controls (prev/next) - Shows loading and error placeholders --- ## Example ```tsx import { SecurePdfViewer } from "laif-ds"; export function InvoiceViewer() { return ( <SecurePdfViewer url="/docs/invoice.pdf" initialPage={1} className="h-[700px]" /> ); } ```