Skip to main content

Web Browser Component Examples

Basic Browser​

A simple browser displaying a website:

Documentation Browser
β‹―

Interactive Browser​

A fully interactive browser with navigation controls (try clicking the navigation buttons and changing the URL):

Interactive Browser
β‹―

Mock Content Browser​

Perfect for showing website previews without external dependencies:

Sample Website
β‹―

Welcome to Our Platform

Build amazing applications with our tools

Getting Started

Our platform provides everything you need to build modern web applications. Start with our comprehensive documentation and examples.

Features

Includes authentication, database integration, real-time updates, and deployment tools. Scale from prototype to production seamlessly.

Community

Join thousands of developers building with our platform. Get help, share ideas, and contribute to our open source projects.

Custom Content Browser​

Display custom React content inside the browser frame:

API Documentation
β‹―

API Reference

Authentication

POST /api/auth/login
Content-Type: application/json

{ "email": "user@example.com", "password": "securepassword" }

Response

{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user": { "id": 1, "email": "user@example.com", "name": "John Doe" } }

Mobile Browser​

Optimized for mobile viewing:

Mobile View
β‹―

Minimal Browser​

Clean browser without navigation controls:

Minimal Browser
β‹―

Direct Component Usage​

You can also use the component directly with custom props:

GitHub
β‹―

GitHub Clone

Where developers collaborate

Repositories

Host and manage your code repositories with version control.

Installation & Setup​

1. Component Files​

Create these files in your Docusaurus project:

src/
└── components/
β”œβ”€β”€ WebBrowser.js # Main browser component
β”œβ”€β”€ WebBrowser.module.css # Browser styles
└── BrowserExamples.js # Example components (optional)

2. Usage in MDX​

import WebBrowser from '@site/src/components/BrowserWindow/WebBrowser';
import { BasicBrowser, InteractiveBrowser } from '@site/src/components/BrowserWindow/BrowserExamples';

<WebBrowser url="https://example.com" height="500px" />
<BasicBrowser />
<InteractiveBrowser />

3. Props Reference​

PropTypeDefaultDescription
urlString"https://example.com"Initial URL to display
titleString"Web Browser"Browser window title
heightString"600px"Browser height
showNavigationBooleantrueShow navigation buttons
showAddressBarBooleantrueShow address bar
interactiveBooleanfalseEnable navigation controls
contentReact ElementnullCustom React content
mockDataObjectnullMock website data

4. Mock Data Structure​

const mockData = {
title: "Page Title",
subtitle: "Page subtitle",
sections: [
{
title: "Section Title",
content: "Section content...",
},
],
};

Use Cases​

  • Documentation: Show website examples and previews
  • Tutorials: Demonstrate web applications step-by-step
  • Design Systems: Display component galleries and style guides
  • API Docs: Show endpoint responses and UI examples
  • Mobile Examples: Demonstrate responsive designs

Features​

βœ… Realistic Browser UI - Complete with window controls and navigation
βœ… Interactive Navigation - Working back/forward/refresh buttons
βœ… Custom Content Support - Display React components or mock data
βœ… Responsive Design - Works on desktop and mobile
βœ… Theme Support - Adapts to light/dark themes
βœ… Iframe Support - Display external websites
βœ… Loading States - Animated loading indicators
βœ… Keyboard Navigation - Address bar with enter key support

Security Note​

When using iframe mode with external URLs, the component includes sandbox attributes for security. Some websites may not display due to X-Frame-Options headers. Use mockData or content props for guaranteed display.