{"id":13534329,"url":"https://github.com/felixmariotto/three-mesh-ui","last_synced_at":"2025-05-14T23:07:03.440Z","repository":{"id":37380712,"uuid":"257950931","full_name":"felixmariotto/three-mesh-ui","owner":"felixmariotto","description":"⏹ Make VR user interfaces for Three.js","archived":false,"fork":false,"pushed_at":"2023-12-03T22:11:05.000Z","size":17223,"stargazers_count":1387,"open_issues_count":72,"forks_count":148,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-11T05:35:00.189Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://felixmariotto.github.io/three-mesh-ui/#basic_setup","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felixmariotto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-22T16:01:31.000Z","updated_at":"2025-05-06T01:14:34.000Z","dependencies_parsed_at":"2024-01-03T04:06:11.395Z","dependency_job_id":"74430bc5-79ed-4ac2-8f86-5bee65b07982","html_url":"https://github.com/felixmariotto/three-mesh-ui","commit_stats":{"total_commits":970,"total_committers":13,"mean_commits":74.61538461538461,"dds":0.2824742268041237,"last_synced_commit":"f70d77d8df6d92c6258bfccb839d57053a392b9a"},"previous_names":[],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixmariotto%2Fthree-mesh-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixmariotto%2Fthree-mesh-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixmariotto%2Fthree-mesh-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixmariotto%2Fthree-mesh-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixmariotto","download_url":"https://codeload.github.com/felixmariotto/three-mesh-ui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243362,"owners_count":22038046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:01:30.590Z","updated_at":"2025-05-14T23:07:03.395Z","avatar_url":"https://github.com/felixmariotto.png","language":"JavaScript","funding_links":[],"categories":["Libraries"],"sub_categories":["JavaScript"],"readme":"# three-mesh-ui\n\n\u003ca href=\"https://three-mesh-ui.herokuapp.com/#interactive_button\"\u003e\n  \u003cimg alt=\"buttons example\" target=\"_blank\" src=\"https://felixmariotto.s3.eu-west-3.amazonaws.com/three-mesh-ui-teasers/buttons_opti.gif\" width=\"45%\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://three-mesh-ui.herokuapp.com/#hidden_overflow\"\u003e\n  \u003cimg alt=\"tuto example\" target=\"_blank\" src=\"https://felixmariotto.s3.eu-west-3.amazonaws.com/three-mesh-ui-teasers/hidden_overflow_opti.gif\" width=\"45%\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://three-mesh-ui.herokuapp.com/#nested_blocks\"\u003e\n  \u003cimg alt=\"big text example\" target=\"_blank\" src=\"https://felixmariotto.s3.eu-west-3.amazonaws.com/three-mesh-ui-teasers/nested_layout_opti.gif\" width=\"45%\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://three-mesh-ui.herokuapp.com/#keyboard\"\u003e\n  \u003cimg alt=\"big text example\" target=\"_blank\" src=\"https://felixmariotto.s3.eu-west-3.amazonaws.com/three-mesh-ui-teasers/keyboard_opti.gif\" width=\"45%\"\u003e\n\u003c/a\u003e\n\n## [Examples (live)](https://felixmariotto.github.io/three-mesh-ui/) \u0026nbsp;|\t\u0026nbsp;[NPM](https://www.npmjs.com/package/three-mesh-ui)\t\u0026nbsp;|\t\u0026nbsp;[Documentation](https://github.com/felixmariotto/three-mesh-ui/wiki)\t\u0026nbsp;|\t\u0026nbsp;[Contributing](https://github.com/felixmariotto/three-mesh-ui/wiki/Roadmap-\u0026-Contributions)\n\n📢 7.x.x is in evaluation, check it out here https://github.com/felixmariotto/three-mesh-ui/pull/223\n\n# What is it ?\n\n**three-mesh-ui** is a small library for building VR user interfaces. The objects it creates are [three.object3Ds](https://github.com/mrdoob/three.js/blob/dev/src/core/Object3D.js), usable directly in a [three.js](https://threejs.org) scene like any other Object3D.    \n        \n**It is not a framework**, but a minimalist library to be used with the last version of three.js. It has no dependency but three.js.\n\n# Why ?\n\nIn a normal three.js workflow, the common practice is to build user interfaces with HTML/CSS.\n\nIn immersive VR, it is impossible, therefore this library was created.\n\n# Quick Start\n\n## Try it now\n\nGive it a try in [this jsFiddle](https://jsfiddle.net/felixmariotto/y81rf5t2/44/)\n\nUsing react-three-fiber ? Here is a [codesandbox](https://codesandbox.io/s/react-three-mesh-ui-forked-v7n0b?file=/src/index.js) to get started.\n\n## Import\n### JSM\n#### With NPM \n`npm install three-mesh-ui`\n*:warning: It requires three as peer dependency*\n\n##### ES6 ([codesandbox demo](https://codesandbox.io/s/npm-package-demo-2onzpo))\n\n```javascript\nimport ThreeMeshUI from 'three-mesh-ui'\n```\n\n##### CommonJS   \n```javascript\nconst ThreeMeshUI = require('three-mesh-ui');\n```\n\n##### HTML \u0026lt;script\u0026gt; tag ([codesandbox demo](https://codesandbox.io/s/module-build-demo-bkmfi8?file=/index.html:281-913))\n```html\n \u003c!-- Defines the import map --\u003e\n\u003cscript async src=\"https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"importmap\"\u003e\n{\n    \"imports\": {\n        \"three\": \"https://unpkg.com/three@0.132.2/build/three.module.js\",\n        \"three-mesh-ui\": \"https://unpkg.com/three-mesh-ui@6.4.0/build/three-mesh-ui.module.js\"\n    }\n}\n\u003c/script\u003e\n\n\u003c!-- Then we can code our app --\u003e\n\u003cscript type=\"module\"\u003e\n    import * as THREE from \"three\";\n    import * as ThreeMeshUI from \"three-mesh-ui\";\n\n    // code goes here ...\n\u003c/script\u003e\n```\n:muscle: *You can use the minified version named __three-mesh-ui.module.min.js__ ([codesandbox demo](https://codesandbox.io/s/module-build-demo-minified-pm6jwx))*\n\n\n### JS\n#### HTML \u0026lt;script\u0026gt; tag ([codesandbox demo](https://codesandbox.io/s/js-build-demo-061eku))\n```html\n\u003c!-- As three-mesh-ui has a peer dependency on three.js --\u003e\n\u003c!-- Be sure to load three before three-mesh-ui --\u003e\n\u003cscript src=\"https://unpkg.com/three@0.132.2/build/three.js\"\u003e\u003c/script\u003e\n\n\u003cscript src=\"https://unpkg.com/three-mesh-ui@6.4.1/build/three-mesh-ui.js\"\u003e\u003c/script\u003e\n\n\u003c!-- Then we can code our app --\u003e\n\u003cscript\u003e\n    /* global THREE, ThreeMeshUI */\n\n    // code goes here ...\n\u003c/script\u003e\n```\n:muscle: *You can use the minified version named __three-mesh-ui.min.js__ ([codesandbox demo](https://codesandbox.io/s/js-build-demo-minified-onh8zi))*    \n:warning: *Although this would theorically allows you to build 'something', loading js libraries instead of using jsm, might restrict the global features you would have. This is true for both three and three-mesh-ui libraries.*\n\n\n## Font files\n\nIn order to display some text with three-mesh-ui, you will need to provide font files.   \nYou can use the two files named `Roboto-msdf` in [this directory](https://github.com/felixmariotto/three-mesh-ui/tree/master/examples/assets), or [create your own font files](https://github.com/felixmariotto/three-mesh-ui/wiki/Creating-your-own-fonts)\n\n## API\n\nHere is an example of basic three-mesh-ui usage : \n\n```javascript\nconst container = new ThreeMeshUI.Block({\n width: 1.2,\n height: 0.7,\n padding: 0.2,\n fontFamily: './assets/Roboto-msdf.json',\n fontTexture: './assets/Roboto-msdf.png',\n});\n\n//\n\nconst text = new ThreeMeshUI.Text({\n content: \"Some text to be displayed\"\n});\n\ncontainer.add( text );\n\n// scene is a THREE.Scene (see three.js)\nscene.add( container );\n\n// This is typically done in the render loop :\nThreeMeshUI.update();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixmariotto%2Fthree-mesh-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixmariotto%2Fthree-mesh-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixmariotto%2Fthree-mesh-ui/lists"}