tauri-ui

repository·master·Indexed 24 days ago

https://github.com/agmmnn/tauri-ui

A scaffolding tool for building Tauri desktop applications with shadcn/ui frontends. It provides 'desktop-ready' defaults such as startup flash prevention, external link handling, and disabled overscroll. The create-tauri-ui CLI allows users to scaffold new projects with various framework templates (vite, next, start, react-router, astro) and manage 'batteries'—composable features like a development-only Debug Panel, starter dashboards, and GitHub release workflows.

Tokens
11.8K
Snippets
44
Records
81
Agent score
78%

What's inside tauri-ui

  1. Overview of tauri-ui

    master

    tauri-ui is a scaffolding tool designed to build modern Tauri desktop applications. It combines the official shadcn/ui CLI with create-tauri-app and layers in desktop-ready defaults that are typically added manually later in the development process.

    Key features include:

    • Upstream-first approach: Avoids maintaining a large local template tree, staying in sync with official tools.
    • Desktop-aware defaults: Handles window behavior, startup flash prevention, scrolling, and selection out of the box.
    • Practical batteries: Provides small, composable defaults focused on real-world application setup.
  2. Explore @tauri-ui/docs project structure

    master

    The @tauri-ui/docs application is built using Next.js and Fumadocs. Key files and routes include:

    • lib/source.ts: Contains the code for the content source adapter. Use the loader() interface to access your content.
    • lib/layout.shared.tsx: Contains shared options for layouts.
    • app/(home): Route group for the landing page and other top-level pages.
    • app/docs: The documentation layout and pages.
    • app/api/search/route.ts: The Route Handler responsible for search functionality.
  3. Supported framework templates in tauri-ui

    master

    When using tauri-ui, you can choose from several framework adapters (templates). While they all follow an upstream-first philosophy, the specific patch surface applied to your project will vary depending on the framework you select.

    Supported Frameworks and Stability

    TemplateStatus
    Vitesmoke-tested end to end
    Next.jsstable
    React Routerstable
    Astrostable
    Startexperimental (validate carefully after changes)
  4. Available batteries in tauri-ui

    master

    The tauri-ui ecosystem provides several 'batteries'—composable features that can be included during scaffolding or added later via the CLI.

    Default batteries (included by default)

    • startup flash prevention: Prevents visual flashing during app startup.
    • external link guard: Manages how external links are handled.
    • desktop scroll behavior: Configures standard desktop scrolling.
    • desktop selection behavior: Configures standard desktop text/element selection.
    • debug panel: A development-only desktop inspector.

    Optional batteries (can be added/removed)

    • starter dashboard: A pre-built dashboard UI.
    • invoke example: Example code for Tauri invokes.
    • GitHub release workflow: GitHub Actions setup for package releases and smoke builds.
    • size optimization: Tuning Tauri release profiles for smaller binaries.
  5. Understand framework differences in tauri-ui templates

    master

    When using tauri-ui templates, certain core features remain consistent across all supported frameworks, while others vary based on the specific template adapter.

    Consistent Features

    • shadcn/ui setup: Always uses the official CLI.
    • Native shell: Provided by create-tauri-app.
    • Batteries: Applied automatically after the scaffolding process is complete.

    Framework-Specific Variations

    Depending on the template you choose, the following implementation details will change:

    • Mount points: Where the UI is attached to the DOM.
    • Root layout patching: How the framework's base layout is modified.
    • Route/app shell integration: How the application shell interacts with the routing system.
    • Development helpers: How development-only tools are mounted within the framework's lifecycle.
  6. Use the Debug Panel

    master

    The tauri-ui scaffold includes a built-in Debug Panel accessible via Cmd / Ctrl + D.

    This tool is for development only and has zero production impact. It allows you to:

    • Inspect app state, routes, windows, tracked invokes, runtime events, plugin logs, and system paths.
    • View live host diagnostics including theme & a11y, locale, display, input, and network.
    • Click on fields to copy the source snippet with a web or tauri origin chip.
  7. Install, upgrade, or remove the Debug panel

    master

    If you need to add the debug panel to an existing project, upgrade it, or uninstall it, use the create-tauri-ui CLI.

    • To install the debug panel: bunx create-tauri-ui@latest add debug-panel
    • To upgrade the debug panel in place: bunx create-tauri-ui@latest update debug-panel (this is idempotent and preserves existing wiring like mount points and plugin registrations).
    • To uninstall the debug panel: bunx create-tauri-ui@latest remove debug-panel
    bunx create-tauri-ui@latest add debug-panel       # install
    bunx create-tauri-ui@latest update debug-panel    # upgrade in place
    bunx create-tauri-ui@latest remove debug-panel    # uninstall
  8. Common first checks for new projects

    master

    When running your application for the first time, perform these checks to ensure the environment is correctly configured:

    • Startup Flash: Confirm the window opens smoothly without a visual flash.
    • External Links: Click an external link to verify it opens correctly in the system browser.
    • Debug Panel: Toggle the development debug panel using Cmd/Ctrl + D.
    • Production Build: Run a production build once to verify the project structure is stable before committing changes.