Convert Figma logo to code with AI

gabrielbull logoreact-desktop

React UI Components for macOS High Sierra and Windows 10

9,516
462
9,516
36

Top Related Projects

113,668

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

81,614

Build smaller, faster, and more secure desktop applications with a web frontend.

A framework for building native Windows apps with React.

24,320

Create beautiful applications using Go

Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀

Quick Overview

React Desktop is a JavaScript library that provides React components for creating native-looking desktop applications using web technologies. It aims to replicate the look and feel of macOS and Windows UI elements, allowing developers to build cross-platform desktop apps with a familiar interface.

Pros

  • Provides a consistent, native-like UI across different desktop platforms
  • Easy integration with existing React applications
  • Customizable components to match specific design requirements
  • Reduces development time for desktop-style interfaces

Cons

  • Limited set of components compared to full-fledged native UI frameworks
  • May not perfectly replicate all native behaviors and interactions
  • Potential performance overhead compared to truly native applications
  • Dependency on web technologies may limit access to some system-level features

Code Examples

Creating a macOS-style window:

import React from 'react';
import { Window, TitleBar, Text } from 'react-desktop/macOs';

export default function App() {
  return (
    <Window
      chrome
      height="300px"
      padding="10px"
    >
      <TitleBar title="My App" controls />
      <Text>Hello, World!</Text>
    </Window>
  );
}

Creating a Windows-style button:

import React from 'react';
import { Button } from 'react-desktop/windows';

export default function MyButton() {
  return (
    <Button push>
      Click me!
    </Button>
  );
}

Using a progress circle component:

import React from 'react';
import { ProgressCircle } from 'react-desktop/macOs';

export default function LoadingIndicator() {
  return (
    <ProgressCircle
      size={30}
      color="blue"
      hidden={false}
    />
  );
}

Getting Started

To use React Desktop in your project, first install it via npm:

npm install react-desktop

Then, import and use the components in your React application:

import React from 'react';
import { Window, TitleBar } from 'react-desktop/macOs';

function App() {
  return (
    <Window
      chrome
      height="300px"
      padding="10px"
    >
      <TitleBar title="My Desktop App" controls />
      {/* Add your app content here */}
    </Window>
  );
}

export default App;

Make sure to import components from either react-desktop/macOs or react-desktop/windows depending on the desired platform look.

Competitor Comparisons

113,668

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

Pros of Electron

  • Cross-platform development for desktop applications using web technologies
  • Large ecosystem with extensive documentation and community support
  • Access to native OS APIs and features

Cons of Electron

  • Larger application size due to bundled Chromium and Node.js
  • Higher memory usage compared to native applications
  • Potential security concerns due to full system access

Code Comparison

Electron (main process):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

React Desktop:

import React from 'react';
import { Window, TitleBar, Text } from 'react-desktop/macOs';

export default function App() {
  return (
    <Window chrome height="300px" padding="10px">
      <TitleBar title="My App" controls />
      <Text>Hello World</Text>
    </Window>
  );
}

React Desktop focuses on providing native-looking UI components for React applications, while Electron offers a complete framework for building cross-platform desktop applications using web technologies. Electron provides more flexibility and access to system resources, but comes with increased resource usage and security considerations. React Desktop is lighter and more focused on UI, but may have limitations in terms of native functionality and cross-platform support.

81,614

Build smaller, faster, and more secure desktop applications with a web frontend.

Pros of Tauri

  • Cross-platform support for Windows, macOS, and Linux
  • Smaller app size and better performance due to native system bindings
  • Flexibility to use any web-based frontend framework (React, Vue, Svelte, etc.)

Cons of Tauri

  • Steeper learning curve, especially for developers new to Rust
  • Less mature ecosystem compared to Electron-based solutions
  • Requires separate compilation for each target platform

Code Comparison

React Desktop:

import { Window, TitleBar, Text } from 'react-desktop/macOs';

<Window
  chrome
  height="300px"
  padding="10px"
>
  <TitleBar title="React Desktop Example" />
  <Text>Hello World</Text>
</Window>

Tauri:

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

While React Desktop focuses on providing pre-built UI components with native look and feel, Tauri offers a more flexible approach by allowing developers to use any web technologies for the frontend while leveraging Rust for backend operations and native system integration.

A framework for building native Windows apps with React.

Pros of React Native Windows

  • Officially supported by Microsoft, ensuring long-term maintenance and updates
  • Provides access to native Windows APIs and components for better performance
  • Supports development for multiple Windows platforms (UWP, WPF, Win32)

Cons of React Native Windows

  • Steeper learning curve due to its complexity and Windows-specific features
  • Requires more setup and configuration compared to React Desktop
  • Limited to Windows development, not cross-platform like React Desktop

Code Comparison

React Native Windows:

import { View, Text } from 'react-native-windows';

const App = () => (
  <View>
    <Text>Hello, Windows!</Text>
  </View>
);

React Desktop:

import { View, Text } from 'react-desktop/windows';

const App = () => (
  <View>
    <Text>Hello, Windows!</Text>
  </View>
);

Both libraries aim to provide native-like UI components for Windows applications using React. React Native Windows offers deeper integration with the Windows ecosystem and native APIs, while React Desktop focuses on cross-platform compatibility and ease of use. The choice between them depends on the specific requirements of your project, such as the need for native Windows features or cross-platform support.

24,320

Create beautiful applications using Go

Pros of Wails

  • Supports multiple programming languages (Go, JavaScript, HTML, CSS) for building desktop applications
  • Provides a native look and feel across different operating systems
  • Offers better performance due to Go's efficiency and native compilation

Cons of Wails

  • Steeper learning curve for developers not familiar with Go
  • Smaller community and ecosystem compared to React-based solutions
  • Limited to desktop applications, unlike React Desktop's web compatibility

Code Comparison

Wails (Go):

package main

import "github.com/wailsapp/wails/v2/pkg/runtime"

func (a *App) Greet(name string) string {
    return fmt.Sprintf("Hello %s!", name)
}

React Desktop (JavaScript):

import React from 'react';
import { Button } from 'react-desktop/windows';

export default function MyButton() {
  return <Button>Click me</Button>;
}

Summary

Wails offers a native approach to building desktop applications using Go and web technologies, providing better performance and a native look. React Desktop, on the other hand, focuses on creating React components that mimic native UI elements, making it more suitable for web-based applications with a desktop-like interface. The choice between the two depends on the developer's familiarity with Go vs. React and the specific requirements of the project.

Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀

Pros of react-nodegui

  • Better performance due to native rendering
  • Supports cross-platform development (Windows, macOS, Linux)
  • Closer to native look and feel

Cons of react-nodegui

  • Smaller community and ecosystem compared to react-desktop
  • Steeper learning curve due to Qt framework integration
  • Less mature and potentially less stable

Code Comparison

react-desktop:

import { Button, TitleBar, Window } from 'react-desktop/macOs';

function App() {
  return (
    <Window chrome>
      <TitleBar title="My App" controls />
      <Button color="blue">Click me</Button>
    </Window>
  );
}

react-nodegui:

import { Button, Window } from "@nodegui/react-nodegui";

function App() {
  return (
    <Window windowTitle="My App">
      <Button text="Click me" />
    </Window>
  );
}

Both libraries aim to create native-looking desktop applications using React, but react-nodegui leverages the Qt framework for better performance and cross-platform support. react-desktop focuses on mimicking native UI components using web technologies, which may be easier for web developers to adopt but potentially less performant. The code examples show similar syntax, with react-nodegui requiring slightly different component imports and prop names.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

React Desktop

Build Status Code Climate GitHub license GitHub stars npm downloads npm version Gitter

React UI Components for macOS High Sierra and Windows 10.

npm install react-desktop --save

Demo

Help wanted!

I am looking for developers to help me develop this project. Please submit some ideas in the issues section or some PRs to get this project going. If you are interested, you can become a collaborator on the project. Thanks.

Contributing

This library has been created to bring a native desktop experience to the web. It works extremely well with tools such as node-webkit or Electron.js!

Everyone is welcome to contribute and add more components/documentation whilst following the contributing guidelines.

Documentation

Guides on installation, components and advanced usage are found in the documentation.

Contributors

NPM DownloadsLast 30 Days