Skip to main content

react

Functions​

AnimationToggle()​

function AnimationToggle(__namedParameters): Element | null;

Play/pause for MaterialX <time>/<frame> nodes; renders nothing unless the document uses them.

Parameters​

ParameterType
__namedParametersAnimationToggleProps

Returns​

Element | null


InfoPanel()​

function InfoPanel(__namedParameters): Element;

Parameters​

ParameterType
__namedParametersInfoPanelProps

Returns​

Element


LogPanel()​

function LogPanel(__namedParameters): Element;

Parameters​

ParameterType
__namedParametersLogPanelProps

Returns​

Element


MaterialSelect()​

function MaterialSelect(__namedParameters): Element | null;

Floating material picker for the top of a viewer frame; renders nothing for single-material documents.

Parameters​

ParameterType
__namedParametersMaterialSelectProps

Returns​

Element | null


MaterialViewTabs()​

function MaterialViewTabs(__namedParameters): Element;

Shared shadcn/ui tabs. Keep the preview mounted to preserve its scene and camera.

Parameters​

ParameterType
__namedParameters{ preview: ReactNode; graph: ReactNode; className?: string; }
__namedParameters.previewReactNode
__namedParameters.graphReactNode
__namedParameters.className?string

Returns​

Element


MaterialViewer()​

function MaterialViewer(__namedParameters): Element;

React wrapper for <material-viewer>, with the same attributes and optional callbacks.

Parameters​

ParameterType
__namedParametersMaterialViewerProps

Returns​

Element


ValidityChecks()​

function ValidityChecks(__namedParameters): Element;

Parameters​

ParameterType
__namedParametersDiagnosticInput

Returns​

Element


ViewerSettingsPanel()​

function ViewerSettingsPanel(__namedParameters): Element;

Gear button in the viewer's bottom-right corner that opens a popover of viewer controls; closes on X, Escape or a click outside.

Parameters​

ParameterType
__namedParametersViewerSettingsPanelProps

Returns​

Element


cn()​

function cn(...inputs): string;

Parameters​

ParameterType
...inputsClassValue[]

Returns​

string

Interfaces​

AnimationToggleProps​

Properties​

PropertyType
viewerViewer | null
mode?AnimationMode
className?string

MaterialSummary​

Structural subset of mtlx-core's MaterialXSummary, so this package needs no mtlx-core dependency.

Properties​

PropertyType
version?string
colorspace?string
nodeGraphCountnumber
topLevelNodeCountnumber
materialsobject[]
nodesobject[]
referencedTexturesstring[]

MaterialAsset​

Structural subset of mtlx-core's MaterialXAsset.

Properties​

PropertyType
pathstring
bytes?number

InfoPanelProps​

Properties​

PropertyTypeDescription
fileName?string-
fileSize?number-
summary?MaterialSummary-
assets?MaterialAsset[]Root document first, then every dependency; sizes are uncompressed.
issuesValidationIssue[]-
parseError?string-
viewerError?string | null-
preview?PreviewReport-
localFile?boolean-
resourcesChecked?boolean-

LogPanelProps​

Extends​

  • ComponentProps<"div">

Properties​

PropertyType
linesstring[]

MaterialSelectProps​

Properties​

PropertyType
namesstring[]
valuestring
onChange(name) => void

MaterialViewerProps​

Properties​

PropertyTypeDescription
ref?Ref<MaterialViewerElement>Access the custom-element API, including toBlob().
src?string-
alt?stringAccessible description announced for the focusable material preview.
model?string-
ibl?string-
geometry?string-
camera-orbit?string-
camera-target?string-
field-of-view?string | number-
material?string-
rotate?"true" | "false"-
bloom?"true" | "false"-
ao?"true" | "false"-
background?"none" | "white" | "environment"-
tone-mapping?string-
exposure?number-
intensity?number-
environment-rotation?number-
animation?"false" | "play" | "pause"-
settings-panel?"open" | "closed" | "hidden"-
errors?"silent"-
id?string-
className?string-
style?CSSProperties-
children?ReactNodeChildren may include an empty or custom slot="progress-bar" element.
onProgress?(progress) => void-
onLoad?() => voidThe preview is ready, after downloading and initializing the renderer.
onCameraChange?(settings) => void-
onError?(message) => void-

ViewerSettingsPanelProps​

Extends​

  • Omit<ComponentProps<"div">, "onChange">

Properties​

PropertyTypeDescription
settingsViewerSettings-
onChange(patch) => void-
geometries?SettingsOption[]-
ibls?SettingsOption[]-
rotating?booleanEffective rotation shown in the checkbox (e.g. forced off by reduced-motion preferences).
rotateDisabled?boolean-

References​

MaterialProgress​

Re-exports MaterialProgress


MaterialViewerProgress​

Re-exports MaterialViewerProgress


GEOMETRY_OPTIONS​

Re-exports GEOMETRY_OPTIONS


IBL_OPTIONS​

Re-exports IBL_OPTIONS


SettingsOption​

Re-exports SettingsOption


ScreenshotOptions​

Re-exports ScreenshotOptions


MaterialViewerElement​

Re-exports MaterialViewerElement

Type Aliases​

ValidityChecksProps​

type ValidityChecksProps = DiagnosticInput;