tauri-ui
🦀 Create modern Tauri desktop apps in just a few simple steps with shadcn/ui. React, Next.js, Sveltekit.
Top Related Projects
Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Make any web page a desktop application
Create beautiful applications using Go
Portable and lightweight cross-platform desktop application development framework
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
Quick Overview
Tauri UI is a collection of user interface components and templates for Tauri applications. It provides a set of pre-built, customizable UI elements that can be easily integrated into Tauri projects, helping developers create attractive and functional desktop applications using web technologies.
Pros
- Offers a variety of ready-to-use UI components specifically designed for Tauri applications
- Helps streamline the development process by providing pre-built templates and layouts
- Supports customization and theming to match specific application designs
- Integrates well with Tauri's ecosystem and best practices
Cons
- Limited documentation and examples compared to more established UI libraries
- May have a steeper learning curve for developers new to Tauri or web-based desktop applications
- Potential for inconsistencies or bugs due to the project's relatively young age
- Smaller community and ecosystem compared to more popular UI frameworks
Code Examples
- Creating a basic button component:
#[derive(Clone, serde::Serialize)]
struct Payload {
message: String,
}
#[tauri::command]
fn greet(name: &str) -> Payload {
Payload {
message: format!("Hello, {}! You've been greeted from Rust!", name),
}
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
- Implementing a simple dialog:
import { dialog } from '@tauri-apps/api';
async function showDialog() {
const result = await dialog.confirm('Are you sure?', 'Confirmation');
if (result) {
console.log('User confirmed');
} else {
console.log('User cancelled');
}
}
- Creating a custom window:
import { WebviewWindow } from '@tauri-apps/api/window';
const webview = new WebviewWindow('my-window', {
url: 'path/to/page.html',
title: 'My Custom Window',
width: 800,
height: 600,
resizable: true,
});
webview.once('tauri://created', function () {
console.log('Window created');
});
Getting Started
To get started with Tauri UI, follow these steps:
- Install Tauri CLI:
npm install -g @tauri-apps/cli
- Create a new Tauri project:
npm init tauri-app my-tauri-ui-app
cd my-tauri-ui-app
- Install Tauri UI components:
npm install @tauri-ui/components
- Import and use Tauri UI components in your application:
import { Button } from '@tauri-ui/components';
function App() {
return (
<div>
<h1>My Tauri UI App</h1>
<Button onClick={() => console.log('Button clicked')}>
Click me!
</Button>
</div>
);
}
Competitor Comparisons
Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
Pros of Tauri
- Official framework with extensive documentation and community support
- More comprehensive feature set for building cross-platform desktop applications
- Active development and regular updates from the core team
Cons of Tauri
- Steeper learning curve for beginners
- Requires more setup and configuration compared to Tauri-UI
- Larger project size due to its full-featured nature
Code Comparison
Tauri (main.rs):
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Tauri-UI (main.rs):
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.setup(|app| {
let window = app.get_window("main").unwrap();
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
The code comparison shows that Tauri-UI provides a slightly more opinionated setup with a pre-configured window, while Tauri offers more flexibility in configuration.
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Pros of Electron
- Mature ecosystem with extensive documentation and community support
- Cross-platform compatibility with a single codebase
- Easier learning curve for web developers
Cons of Electron
- Larger application size due to bundled Chromium and Node.js
- Higher memory usage and slower performance compared to native apps
- 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)
Tauri-UI (src-tauri/src/main.rs):
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Tauri-UI offers a more lightweight alternative to Electron, with smaller app sizes and better performance due to its Rust backend. However, Electron benefits from a larger ecosystem and easier development for those familiar with web technologies. The code comparison shows the different approaches: Electron uses JavaScript for its main process, while Tauri-UI utilizes Rust for its core functionality.
Make any web page a desktop application
Pros of Nativefier
- Simpler setup and usage, requiring minimal configuration
- Supports a wider range of platforms, including older operating systems
- More established project with a larger community and extensive documentation
Cons of Nativefier
- Larger application size due to bundling Electron
- Less performant compared to native applications
- Limited customization options for the application's appearance and behavior
Code Comparison
Nativefier (JavaScript):
nativefier 'https://example.com' --name 'My App' --icon icon.png
Tauri UI (Rust):
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
Tauri UI focuses on creating native, lightweight applications using web technologies and Rust, while Nativefier wraps web applications in Electron for desktop use. Tauri UI offers better performance and smaller file sizes but requires more setup and coding knowledge. Nativefier provides a quick solution for creating desktop apps from websites but sacrifices performance and customization options.
Create beautiful applications using Go
Pros of Wails
- More mature and established project with a larger community
- Supports multiple backend languages (Go, Rust, C++)
- Offers built-in tooling for app packaging and distribution
Cons of Wails
- Larger bundle sizes compared to Tauri-UI
- Less focus on security features than Tauri-UI
- Steeper learning curve for developers new to Go
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)
}
Tauri-UI (Rust):
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
Both frameworks allow easy integration of backend functions with the frontend, but Wails uses Go while Tauri-UI uses Rust. Tauri-UI generally results in smaller bundle sizes and has a stronger focus on security, while Wails offers more language options and a more established ecosystem. The choice between them often depends on the developer's preferred language and specific project requirements.
Portable and lightweight cross-platform desktop application development framework
Pros of Neutralinojs
- Lighter weight and more minimal than Tauri-UI
- Supports a wider range of programming languages for backend development
- Simpler architecture with fewer dependencies
Cons of Neutralinojs
- Less robust security features compared to Tauri-UI's Rust-based backend
- Smaller community and ecosystem than Tauri-UI
- Fewer built-in UI components and design system options
Code Comparison
Neutralinojs:
const options = {
url: 'myapp://',
width: 800,
height: 600,
maximizable: false
};
Neutralino.window.setOptions(options);
Tauri-UI:
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
The code examples showcase the different approaches: Neutralinojs uses JavaScript for both frontend and backend, while Tauri-UI separates concerns with Rust for the backend and JavaScript/TypeScript for the frontend.
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
Pros of Revery
- Native performance with OCaml and Reason
- Cross-platform support for desktop and mobile
- Lightweight and fast rendering engine
Cons of Revery
- Smaller community and ecosystem compared to Tauri
- Steeper learning curve for developers unfamiliar with OCaml/Reason
- Less extensive documentation and examples
Code Comparison
Revery (OCaml/Reason):
let app = App.create();
let win = Window.create(
~createOptions=WindowCreateOptions.create(~width=800, ~height=600, ()),
app,
);
let element = <View style=Style.[width(100), height(100), backgroundColor(Colors.red)] />;
UI.start(win, element);
Tauri-UI (JavaScript/TypeScript):
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
// In App.vue
<template>
<div style="width: 100px; height: 100px; background-color: red;"></div>
</template>
Revery offers a more native approach with OCaml/Reason, while Tauri-UI leverages web technologies for UI development. Revery provides better performance but has a steeper learning curve, whereas Tauri-UI offers easier development with familiar web technologies but may have slightly lower performance. Both support cross-platform development, but Tauri-UI has a larger ecosystem and community support.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
updates soon
Create modern Tauri desktop apps in just a few simple steps. Tauri UI Templates is a starting point for building modern desktop applications with web technologies with using shadcn/ui, Tauri.
You can download pre-built final bundles from the Releases section.
Getting Started
Use create-tauri-ui to quickly scaffold a Tauri UI project.
pnpm create tauri-ui
npx create-tauri-ui@latest
pnpm create tauri-ui
npm create tauri-ui@latest
yarn create tauri-ui
Then follow the prompts!
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a Tauri-UI project, run:
# npm 7+, extra double-dash is needed:
npm create tauri-ui@latest my-tauri-app -- --template vite
# yarn
yarn create tauri-ui my-tauri-app --template next
# pnpm
pnpm create tauri-ui my-tauri-app --template sveltekit
You can use .
for the project name to scaffold in the current directory.
Or clone the repository
gh repo clone agmmnn/tauri-ui
cd tauri-ui/templates/<template>
pnpm i
pnpm tauri dev
pnpm tauri build
Features
- Components-based UI design with shadcn/ui. Radix UI for UI primitives.
- Native-looking window controls with tauri-controls.
- Support for dark and light modes.
- Lucide Icons, Radix Icons.
- Bundle size optimized
Cargo.toml
(.msi 2.5mb, .dmg 1.9mb, .deb 2mb) - Tauri GitHub Action, Cross-platform releases.
Update Components
shadcn/ui
Update all components:
npx shadcn-ui@latest add --overwrite
# press "a" to select all components
Update a specific component:
npx shadcn-ui@latest add dialog --overwrite
Acknowledgements
This project utilizes code from the following repository:
- vitejs/create-vite - Used in create-tauri-ui
- shadcn/ui - Used in Next.js and Vite templates
- huntabyte/shadcn-svelte - Used in SvelteKit template
Top Related Projects
Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Make any web page a desktop application
Create beautiful applications using Go
Portable and lightweight cross-platform desktop application development framework
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot