Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/feedback

FilePreviewModal

Vista previa de un archivo —imagen, PDF o descarga— con acciones de bajar y de abrir aparte.

Seguir leyendo — 2 párrafos más

Generic file preview modal supporting images, PDFs, and downloadable files.

Framework-agnostic — no tRPC, no Next.js router. Consumers resolve the URL and pass it via url. Use isLoading while the URL is being fetched.

1 sitio de import en 1 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.

  • TheCharterPanel

El componente, montado

Cargando el espécimen…

Cómo se usa

import { FilePreviewModal } from '@solu30/ui-kit/feedback'

Props

8 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
namesístringFile name to display in header
urlopcionalstringURL to the file (resolved externally)
isImageopcionalbooleanWhether the file is an image
isPdfopcionalbooleanWhether the file is a PDF
isLoadingopcionalbooleanShow loading state when url is not yet resolved
onDownloadopcional() => voidCalled when user clicks download
onOpenExternalopcional() => voidCalled when user clicks "open in new tab"
onClosesí() => voidClose handler

Ejemplo del paquete

<FilePreviewModal
  name="contract.pdf"
  url={resolvedUrl}
  isPdf
  onDownload={() => window.open(resolvedUrl)}
  onOpenExternal={() => window.open(resolvedUrl, '_blank')}
  onClose={() => setOpen(false)}
/>

Del @example del JSDoc de @solu30/ui-kit, sin editar: son 65 de los 541 símbolos. La sangría y los renglones en blanco son los del paquete.