Code Viewer
retab-ui/code-viewerFreeComponent
A fixed-line code and log viewer with line numbers, custom virtualization, source-line highlights, retry, zoom, and download.
Install it
npx shadcn@latest add https://ui.retab.com/r/code-viewer.jsonSource
1"use client";23import * as React from "react";45import type { ViewerResource } from "@/lib/viewer-resource";67import { CodeViewerFallback } from "./code-viewer-chrome";8import { CodeViewerContent } from "./code-viewer-content";9import type { CodeViewerHandle, CodeViewerProps } from "./code-viewer-types";10import { PlainTextViewerFrame } from "./plain-text-viewer-frame";1112export type {13 CodeDocumentSource,14 CodeLineRange,15 CodeViewerHandle,16 CodeViewerProps,17} from "./code-viewer-types";1819export type CodeResourceContentProps = Omit<CodeViewerProps, "source"> & {20 resource: ViewerResource;21};2223export const CodeViewer = React.forwardRef<CodeViewerHandle, CodeViewerProps>(24 function CodeViewer(props, ref) {25 return (26 <PlainTextViewerFrame27 props={props}28 forwardedRef={ref}29 clientFallbackPolicy="always"30 contentResetPolicy="inline-retry"31 Fallback={CodeViewerFallback}32 Content={CodeViewerContent}33 />34 );35 },36);3738export const CodeResourceContent = React.forwardRef<39 CodeViewerHandle,40 CodeResourceContentProps41>(function CodeResourceContent({ resource, ...props }, ref) {42 return (43 <PlainTextViewerFrame44 props={props}45 resource={resource}46 forwardedRef={ref}47 clientFallbackPolicy="always"48 contentResetPolicy="inline-retry"49 Fallback={CodeViewerFallback}50 Content={CodeViewerContent}51 />52 );53});
What it pulls in
npm packages
Other registry items
Files it writes
More from retab-ui
All 130 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | retab-ui | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | retab-ui | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | retab-ui | Components | Free | no deps | |
| Attachment Sidebarattachment-sidebar | retab-ui | Components | Free | 1 dep | |
| Autocompleteautocomplete | retab-ui | Components | Free | 2 deps | |
| Calendarcalendar | retab-ui | Components | Free | 2 deps | |
| Commandcommand | retab-ui | Components | Free | 2 deps | |
| CSV source adaptercsv-source | retab-ui | Components | Free | no deps |
