Bus UI Evidence And Files

EvidencePreview chooses inline preview or fallback copy.

Use it for PDFs, images, or plain text snippets where the preview policy must stay explicit. The helper can fall back cleanly when the evidence is not embeddable.

Public API

EvidencePreview(p EvidencePreviewProps) gx.Node

The input model is EvidencePreviewProps, and the policy helper EvidencePreviewPolicy explains why a preview is inline or blocked.

When to use it

Use EvidencePreview when you want a single panel to show either the preview itself or a readable fallback, without letting ambiguous content-type or disposition rules leak into the page.

Live demo

Loading EvidencePreview demo...

Example

Go API

import (
  gx "github.com/busdk/bus-gx/pkg/gx"
  ui "github.com/busdk/bus-ui/pkg/ui"
)

node := ui.EvidencePreview(ui.EvidencePreviewProps{
  Title:              "Bank statement",
  PreviewURL:          "/modules/accounting/evidence/bank-statement.pdf",
  OpenURL:             "/modules/accounting/evidence/bank-statement.pdf",
  ContentType:         "application/pdf",
  ContentDisposition:  "inline",
  Fallback:            "Preview is unavailable.",
})

html, err := gx.RenderHTML(node)

.gx source

In .gx source, author the visible component state as GX markup. Keep the Go API block above for the package helper or render-boundary call.

package busuiexamples

import gx "github.com/busdk/bus-gx/pkg/gx"

func EvidencePreviewExample() gx.Node {
  return <figure class="evidence-preview">
  <img alt="Receipt preview" src="/evidence/receipt.png"></img>
  <figcaption><Text value={"Receipt preview"}></Text></figcaption>
</figure>
}

Use the public pkg/ui facade for this evidence preview surface.