Welcome to the Micrio Integration Templates repository! This project is designed to provide you with a collection of easy-to-use starter templates for integrating the powerful Micrio viewer into your web projects.
- Micrio Templates
- Overview
- Contents
- What is Micrio?
- Available Examples
- Prerequisites
- Finding Your Micrio IDs (Image, Marker, Tour)
- Getting Started / Installation
- Quick Start Guide (Simplest Path: HTML/JS Example)
- Detailed Usage Instructions
- In-Depth Customization Options
- Deployment Instructions
- Troubleshooting
- Contributing
- License
- Acknowledgements & Further Links
Jumpstart your Micrio integration! This repository offers a collection of ready-to-use templates designed to get you embedding the powerful Micrio Client into your web projects quickly and easily. Explore different patterns, learn best practices, and leverage support for popular web technologies like plain HTML/JS, Next.js/React, and SvelteKit. Save time, learn by example, and choose the setup that fits your needs.
Whether you're a developer looking for a solid foundation for your React or Svelte project, or someone less technical wanting to embed Micrio content with minimal code using simple HTML/JS, these templates are designed for you. Get your Micrio viewer running in minutes!
Micrio is a cutting-edge platform for creating, publishing, and exploring ultra-high-resolution images and immersive virtual tours. It allows you to bring incredible detail and interactivity to your visual content.
Learn more at the Micrio website and check out the core client library at the Q42/Micrio.Client GitHub repository.
This repository currently offers the following integration patterns:
-
FloatingIntro:- Description: A simple example featuring a Micrio viewer with an introductory screen overlaid on top. This screen provides basic information or context and can be easily clicked away to reveal the full Micrio experience underneath.
- Stacks:
FloatingIntro/html-js/: Plain HTML, CSS, and JavaScript.FloatingIntro/nextjs-react/: Next.js (React).FloatingIntro/svelte/: Svelte (SvelteKit).
-
MinimizablePanel:- Description: Shows how to replace the standard Micrio menu with a custom, minimizable panel. This compact panel provides quick shortcuts to specific markers or tours within the Micrio image, offering a streamlined navigation experience.
- Stacks:
MinimizablePanel/nextjs-react/: Next.js (React).MinimizablePanel/svelte/: Svelte (SvelteKit).
-
CustomStyling:- Description: Illustrates how to customize the Micrio viewer's appearance using Micrio's CSS variables. This example shows a basic HTML/JS setup demonstrating changes to various UI elements.
- Stacks:
CustomStyling/html-js/: Plain HTML, CSS, and JavaScript.
-
CustomSerialTour:- Description: Illustrates how to customize the Micrio player's appearance to show a multi-image tour styled like a video with multiple segments shown as chapters. This example shows a basic HTML/JS setup demonstrating how this mechanism works.
- Stacks:
CustomSerialTour/html-js/: Plain HTML, CSS, and JavaScript.
Coming Soon:
- Examples using Vue.js.
- A Micrio Account: You'll need a Micrio account to host your images and get your Image IDs. If you don't have one, you can sign up at Micrio.
- Text Editor (Optional but Recommended): A simple text editor like Notepad (Windows), TextEdit (Mac), or a more advanced one like VS Code will be helpful for making small changes (like updating the Micrio Image ID).
- Node.js and npm: Required for the Next.js/React and Svelte examples. Download Node.js (which includes npm) from nodejs.org.
- Git (Optional): Useful for cloning the repository. Alternatively, you can download the project as a ZIP file.
- Basic Web Technology Familiarity: A basic understanding of HTML, CSS, JavaScript, and (if applicable) React or Svelte will be beneficial.
To use these templates with your own Micrio content, you'll need the specific IDs for your images, and optionally, for any markers or tours you wish to feature.
- Log in to Micrio: Go to your Micrio dashboard at https://dash.micr.io/.
- Finding an Image ID:
- Navigate to your list of images/projects.
- Open or select an image. The Image ID is typically part of the URL in your browser's address bar when viewing the image directly (e.g.,
https://i.micr.io/YOUR_IMAGE_ID). - Alternatively, from the list view in your Micrio dashboard (
https://dash.micr.io/), click the three dots (︙) context menu next on the image's card. The Image ID will be the first item listed; clicking it copies the ID directly to your clipboard.
- Finding a Marker or Tour ID (for programmatic use):
- The example templates (especially Svelte/React) may use specific alphanumeric IDs (looking like
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) to refer to markers or tours in their configuration files (e.g.,content.ts). - Important: These specific alphanumeric IDs are generally not directly visible in the Micrio v3 dashboard editor UI's properties panels.
- How to get them:
- Primary Method (Editor URL): The easiest way is often directly from the Micrio Editor. When you select a specific marker or tour step within the editor interface (
https://dash.micr.io/), look at your browser's address bar. The URL will contain the ID you need. For example, a marker URL might look likehttps://dash.micr.io/micrio-shared/micriotemplates/@YOUR_IMAGE_ID/en/content/markers/MARKER_ID_HERE. Copy the long alphanumeric string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) which is the Marker or Tour ID. - Secondary Method (Developer Console): For developers needing programmatic access or bulk retrieval, you can inspect the Micrio instance in your browser's developer console. After an image is loaded in a
<micr-io>element, you can access its data. Run this one-liner in the console:console.log(document.querySelector('micr-io').$current.$data)This will output the image data, including arraysmarkersandtours, where each object has anidproperty containing the required alphanumeric ID. You can identify the specific marker/tour by itsi18n.en.title(which is visible in the editor) and then retrieve itsid. Consult the Micrio Client JS API Documentation for more details. - Note on Deep Links: The Micrio viewer also updates the browser URL with human-readable names (slugs) for the current marker or tour (e.g.,
https://i.micr.io/IMAGE_ID/en/tour-slug/marker-slug). While these slugs are useful for direct linking, they are not the same as the alphanumeric IDs needed for configuration in these templates.
- Primary Method (Editor URL): The easiest way is often directly from the Micrio Editor. When you select a specific marker or tour step within the editor interface (
- If you are unsure how to obtain the correct ID for a template, please check the specific template's documentation or consider opening an issue in this repository for guidance.
- The example templates (especially Svelte/React) may use specific alphanumeric IDs (looking like
Note: The Micrio dashboard UI may change. For the most up-to-date instructions, please refer to the official Micrio Knowledge Base.
Follow these steps to get a template running:
1. Get the Templates:
-
Option A: For Non-Technical Users (Recommended - Download ZIP):
- Go to the GitHub Repository Page.
- Click the green "Code" button.
- Select "Download ZIP".
- Extract the downloaded ZIP file to a folder on your computer.
-
Option B: For Technical Users (Clone with Git):
git clone git@github.com:Q42/Micrio.Templates.git cd Micrio.Templates
2. Choose Your Example:
- Navigate into the folder of the example and technology stack you want to use. For instance, go to
FloatingIntro/html-js, either using your file explorer or terminal.
Let's get your first Micrio project running in just 3 steps using the html-js example!
(Ensure you have your Micrio Image ID ready - see section "Finding Your Micrio IDs" above.)
-
Navigate:
- Open the
FloatingIntro/html-js/folder
- Open the
-
Configure:
- Open the
index.htmlfile in a text editor. - Look for a line similar to this (the ID
ffoTBWjis an example):<micr-io id="ffoTBWj" lang="en" class="micrio-viewer"></micr-io>
- Replace
ffoTBWj(or the existing ID) with your actual Micrio Image ID within theidattribute. For example:<micr-io id="YOUR_MICRIO_IMAGE_ID" lang="en" class="micrio-viewer"></micr-io>
- Open the
-
View:
- Save the changes to
index.html. - Open the
index.htmlfile in your web browser (usually by double-clicking it). - You should now see your Micrio image!
- Save the changes to
HTML/JS Examples (e.g., FloatingIntro/html-js/ or CustomStyling/html-js/)
-
Running:
- Simply open the
index.htmlfile from the example's folder (e.g.,FloatingIntro/html-js/index.htmlorCustomStyling/html-js/index.html) in your web browser.
- Simply open the
-
Customization:
- Micrio Image ID: Edit the
index.htmlfile. Locate the<micr-io>HTML tag and change itsidattribute to your Micrio image ID. (See "Quick Start Guide" for details). - Appearance: Modify the corresponding
style.cssfile (e.g.,FloatingIntro/html-js/style.cssorCustomStyling/html-js/style.css) to change colors, fonts, popup styling, etc. - Text/Content: Edit the
index.htmlfile for any text or structural HTML changes. - Behavior: Modify the
script.jsfile (e.g.,FloatingIntro/html-js/script.jsorCustomStyling/html-js/script.js) for JavaScript-driven interactions.
- Micrio Image ID: Edit the
Next.js/React Examples (e.g., FloatingIntro/nextjs-react/)
-
Installation:
- Navigate to the example directory:
cd FloatingIntro/nextjs-react - Install dependencies:
npm install
- Navigate to the example directory:
-
Running:
npm run dev- This usually opens the project at
http://localhost:3000.
-
Customization:
- Micrio IDs (Image, Markers, Tours):
- Edit the
src/shared/content.tsfile (e.g.,FloatingIntro/nextjs-react/src/shared/content.ts). - Change the
imageIdconstant to your Micrio Image ID. - If the example uses specific markers or tours, you might find other constants like
startMarkerIdortourId. Update these with your IDs. - (For instructions on how to find these IDs in your Micrio dashboard, please refer to the "Finding Your Micrio IDs" section above.)
- Edit the
- Main Page Structure and Text Content: Modify files like
src/app/page.tsx(e.g.,FloatingIntro/nextjs-react/src/app/page.tsx). - Micrio Component Logic: The core Micrio integration logic is often in
src/components/MicrioViewer.tsx(e.g.,FloatingIntro/nextjs-react/src/components/MicrioViewer.tsx). - Other Components: Specific UI elements like panels might have their own component files (e.g.,
MinimizablePanel/nextjs-react/src/components/MinimizablePanel.tsx). - Global Styles: Edit
src/app/globals.css(e.g.,FloatingIntro/nextjs-react/src/app/globals.css). - Component-Specific Styles: Often found in
.cssfiles alongside components (e.g.,FloatingIntro/nextjs-react/src/components/micrio.css) or using CSS Modules/Styled Components if the example is set up for it.
- Micrio IDs (Image, Markers, Tours):
Svelte (SvelteKit) Examples (e.g., FloatingIntro/svelte/)
-
Installation:
- Navigate to the example directory:
cd FloatingIntro/svelte - Install dependencies:
npm install
- Navigate to the example directory:
-
Running:
npm run dev- This usually opens the project at
http://localhost:5173.
-
Customization:
- Micrio IDs (Image, Markers, Tours):
- Edit the
src/lib/shared/content.tsfile (e.g.,FloatingIntro/svelte/src/lib/shared/content.ts). - Change the
imageIdconstant to your Micrio Image ID. - If the example uses specific markers or tours, you might find other constants like
startMarkerIdortourId. Update these with your IDs. - (For instructions on how to find these IDs in your Micrio dashboard, please refer to the "Finding Your Micrio IDs" section above.)
- Edit the
- Main Page Structure: Modify files like
src/routes/+page.svelte(e.g.,FloatingIntro/svelte/src/routes/+page.svelte). - Micrio Component Logic: The core Micrio integration logic is often in
src/lib/components/MicrioViewer.svelte(e.g.,FloatingIntro/svelte/src/lib/components/MicrioViewer.svelte). - Other Components: Specific UI elements like panels might have their own component files (e.g.,
MinimizablePanel/svelte/src/lib/components/MinimizablePanel.svelte). - Global Styles: Edit
src/app.css(e.g.,FloatingIntro/svelte/src/app.css). - Component-Specific Styles: Often found within the
<style>tags of.sveltefiles or in dedicated.cssfiles (e.g.,FloatingIntro/svelte/src/lib/components/micrio.css).
- Micrio IDs (Image, Markers, Tours):
Beyond changing the Micrio content ID, you can customize these templates further:
-
Changing Micrio Content (Recap):
- Image ID: As detailed above, change in
index.html(for HTML/JS) orcontent.ts(for React/Svelte). - Marker and Tour IDs: In React/Svelte examples, check the
content.tsfiles for constants likestartMarkerId,tourId, etc., and update them with IDs from your Micrio dashboard if you want to point to different markers/tours within your image.
- Image ID: As detailed above, change in
-
Theming & Styling:
- CSS: All examples use CSS for styling. Modify the
.cssfiles (e.g.,style.css,app.css,globals.css, component-specific CSS files) to match your brand or desired look. Use your browser's developer tools (F12) to inspect elements and identify their classes for targeted styling. - Micrio CSS Variables: Micrio provides CSS variables for easy customization of common elements like menus and popups. Refer to the "Styling a Micrio embed using CSS" guide for available variables and examples.
- Step-by-Step Tutorial: For a detailed tutorial on styling the Micrio UI, including CSS variables and targeting Micrio-specific elements, see the Micrio CSS Styling Tutorial.
- Tailwind CSS (Next.js/Svelte): The Next.js and Svelte examples integrate Tailwind CSS. Component styles (e.g., for the main page structure, text content, or custom panels) are often applied using Tailwind utility classes directly in the
.tsxor.sveltefiles, alongside traditional CSS files. - Micrio Runtime Attributes: Micrio offers a range of runtime attributes that control the viewer's behavior and appearance (e.g.,
data-show-info="false"). Configure these directly as HTML attributes on the<micr-io>element.- For a complete list and detailed explanations, see the official Micrio Client Runtime Settings Documentation.
- CSS: All examples use CSS for styling. Modify the
-
Modifying Text and Layout:
- Text: Directly edit the text content within HTML files (
.html), TSX files (.tsx), or Svelte files (.svelte). - Layout: Adjust HTML structure or CSS properties (like Flexbox, Grid, positioning, margins, padding) to change the layout.
- Text: Directly edit the text content within HTML files (
Once you've customized your template, here's how to deploy it:
- HTML/JS examples are static sites and can be hosted on any static web host.
- Next.js/React and SvelteKit examples typically require a build process and can be deployed to platforms that support Node.js applications or modern JavaScript frameworks.
- Any Static Host: (e.g., Netlify, Vercel, GitHub Pages, AWS S3, traditional web hosting). Simply upload the entire contents of your chosen
html-jsexample folder (e.g.,FloatingIntro/html-js/). - GitHub Pages (Step-by-step):
- Create a new GitHub repository or use an existing one.
- Push the contents of your chosen
html-jsexample folder (e.g.,FloatingIntro/html-js/) to the repository. - Go to your repository's "Settings" tab, then click on "Pages" in the left sidebar.
- Under "Build and deployment", select "Deploy from a branch" as the Source.
- Choose the branch (e.g.,
main) and the folder (usually/ (root)if you pushed the example's contents directly, or/docsif you placed them there) and click "Save". - Your site will be available at
https://your-username.github.io/your-repository-name/.
- Netlify / Vercel (Drag & Drop):
- Log in to your Netlify or Vercel account.
- Simply drag the
html-jsexample folder (e.g.,FloatingIntro/html-js/) from your computer onto the Netlify/Vercel dashboard's deployment area (often labeled "Sites" or "Projects").
- Vercel (Recommended for Next.js):
- Push your project (the specific
nextjs-reactexample folder, e.g.,FloatingIntro/nextjs-react/) to a Git repository (GitHub, GitLab, Bitbucket). - Sign up or log in to Vercel.
- Connect your Git provider to Vercel.
- Import the project from Vercel. Vercel typically auto-detects Next.js settings.
- Configure environment variables if needed.
- Click "Deploy".
- Push your project (the specific
- Netlify:
- Push your project to a Git provider.
- Sign up or log in to Netlify.
- Connect your Git provider and import the project.
- Netlify usually detects Next.js.
- Build command:
npm run build(ornext build) - Publish directory:
.next(oroutif you're using static exportnext export)
- Build command:
- Deploy.
- Docker:
- You'll need a
Dockerfiletailored for Next.js. Refer to the official Next.js Docker deployment documentation for guidance on creating one.
- You'll need a
- Self-hosting (Node.js server):
- Run
npm run buildin your project directory. - Then run
npm run startto start the production server. - Ensure your server environment is set up for Node.js applications and can serve the application (e.g., using PM2 or similar process managers).
- Run
-
Vercel / Netlify (Adapters Recommended):
-
Ensure your SvelteKit project uses an appropriate adapter in its
svelte.config.js.@sveltejs/adapter-auto(default) works well for Vercel, Netlify, and Cloudflare Pages. For specific platforms, you can use adapters like@sveltejs/adapter-vercelor@sveltejs/adapter-netlify.// Example: svelte.config.js import adapter from '@sveltejs/adapter-auto'; // Or adapter-vercel, adapter-netlify /** @type {import('@sveltejs/kit').Config} */ const config = { kit: { adapter: adapter() }, }; export default config;
-
Install the chosen adapter if you are not using
@sveltejs/adapter-auto:npm install -D @sveltejs/adapter-vercel(example). -
Push your project (the specific
svelteexample folder) to a Git provider. -
Connect and import on Vercel or Netlify. They usually auto-detect SvelteKit settings based on the adapter.
-
-
Docker:
- You'll typically use
@sveltejs/adapter-nodeto build a Node.js server. - Create a
Dockerfileto copy your built application and run the Node.js server. Refer to SvelteKit documentation onadapter-nodeand Dockerizing Node applications.
- You'll typically use
-
Self-hosting (Node.js server with
adapter-node):- Ensure
@sveltejs/adapter-nodeis configured in yoursvelte.config.js(e.g.,FloatingIntro/svelte/svelte.config.js). - Run
npm run build. This will create abuilddirectory (or as configured by the adapter). - Deploy the contents of the
builddirectory to your server and run the Node.js server (e.g.,node build/index.js). Use a process manager like PM2 for production.
- Ensure
- "My Micrio image isn't loading!"
- Check Image ID: Double-check that the Micrio Image ID you've entered is correct and that the image is published and publicly accessible in your Micrio dashboard. Try visiting
https://i.micr.io/YOUR_IMAGE_ID(replacingYOUR_IMAGE_IDwith your actual ID) directly in your browser – you should see your image load. - Internet Connection: Verify your internet connection.
- Browser Console: Open your browser's developer console (usually by pressing F12) and look for any error messages in the "Console" tab. These can provide clues about what's going wrong.
- Check Image ID: Double-check that the Micrio Image ID you've entered is correct and that the image is published and publicly accessible in your Micrio dashboard. Try visiting
- Build Errors (for Next.js/Svelte projects):
- Dependencies: Ensure
npm installcompleted without errors. If you see errors, try deletingnode_modulesandpackage-lock.jsonand running the install command again. - Node.js Version: Check that your Node.js version is compatible with the project. The
.nvmrcfile specifies the recommended Node.js version.
- Dependencies: Ensure
- Refer to Official Documentation:
- For issues related to the Micrio viewer itself, consult the Micrio Knowledge Base.
We welcome contributions to improve these templates!
- Reporting Issues: If you find a bug or have a suggestion, please open an issue on the GitHub Issues page.
- Pull Requests: If you'd like to contribute code, please fork the repository, make your changes on a new branch, and submit a pull request.
- Code Style: This project uses Prettier for code formatting. Please ensure your code is formatted before submitting a pull request. You can usually format by running
npm run formatif a script is configured inpackage.json, or by using a Prettier extension in your code editor. Check the.prettierrcfile for configuration.
This project is licensed under the MIT License. See the LICENSE file for details.
- Micrio Official Website: https://micr.io
- Micrio Client JS API Documentation: https://doc.micr.io/client/v5/js-api.html
- Micrio Client Runtime Settings (Attributes): https://doc.micr.io/client/v5/settings.html
- Styling a Micrio embed using CSS: https://doc.micr.io/client/v5/styling.html
We hope these templates help you create amazing Micrio integrations!