Appearance
Embed the editor
component · /editorModelLabEditor is the complete authoring surface.
Basic embedding
tsx
import { ModelLabEditor } from '@taranjeetsinghh/model-lab/editor'
import '@taranjeetsinghh/model-lab/styles.css'
export function AssetStudio() {
return (
<main style={{ height: '100vh' }}>
<ModelLabEditor
dracoDecoderPath="/draco/"
onModelLoaded={(info) => console.log(info.stats)}
/>
</main>
)
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Controlled integration
Use the editor callbacks to persist working state in an application store:
tsx
<ModelLabEditor
initialConfig={savedDraft}
onConfigChange={(config) => saveDraft(config)}
onSequenceChange={(sequence) => saveTimeline(sequence)}
/>1
2
3
4
5
2
3
4
5
Load files programmatically
tsx
const editorRef = useRef<ModelLabEditorHandle>(null)
<input
type="file"
multiple
onChange={(event) => {
const files = Array.from(event.currentTarget.files ?? [])
editorRef.current?.loadFiles(files)
}}
/>
<ModelLabEditor ref={editorRef} />1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Read the export without downloading
ts
const preset = editorRef.current?.getPreset()
await savePresetToDatabase(preset)1
2
2
Privacy model
Local model files are read by the browser and mapped to object URLs. The editor does not require uploading them to a server. Your host application remains responsible for any persistence or network behavior it adds.