API Reference
About This Reference
Section titled “About This Reference”This is the complete API reference for Wails v3. It documents every public type, method, and option available in the framework.
Organisation:
- Application - Core application APIs
- Window - Window creation and management
- Menu - Application, context, and system tray menus
- Events - Event system and built-in events
- Dialogs - File and message dialogs
- Frontend Runtime - Frontend runtime APIs
- CLI - Command-line interface
API Conventions
Section titled “API Conventions”Go API Conventions - For developers new to Go
Naming
Section titled “Naming”- Types: PascalCase (e.g.,
WebviewWindow) - Methods: PascalCase (e.g.,
SetTitle()) - Options: PascalCase structs (e.g.,
WindowOptions) - Constants: PascalCase (e.g.,
WindowStartStateMaximised)
Error Handling
Section titled “Error Handling”Most methods that can fail return error as the last return value:
window, err := app.Window.New()if err != nil { log.Fatal(err)}Context
Section titled “Context”Methods that may block or need cancellation accept context.Context:
err := app.RunWithContext(ctx)Options Pattern
Section titled “Options Pattern”Configuration uses option structs:
app := application.New(application.Options{ Name: "My App", Description: "A demo application", Services: []application.Service{ application.NewService(&MyService{}), },})JavaScript API Conventions
Section titled “JavaScript API Conventions”Naming
Section titled “Naming”- Functions: camelCase (e.g.,
setTitle()) - Constants: SCREAMING_SNAKE_CASE (e.g.,
WINDOW_EVENT_FOCUS)
Async by Default
Section titled “Async by Default”All Go method calls return Promises:
// Async/await (recommended)const result = await MyService.DoSomething()
// Promise chainMyService.DoSomething() .then(result => console.log(result)) .catch(error => console.error(error))Error Handling
Section titled “Error Handling”Go errors become JavaScript exceptions:
try { await MyService.MightFail()} catch (error) { console.error('Go error:', error)}Type Safety
Section titled “Type Safety”TypeScript definitions are auto-generated:
// Fully typedimport { Greet } from './bindings/GreetService'
const message: string = await Greet("World")Package Structure
Section titled “Package Structure”github.com/wailsapp/wails/v3/pkg/├── application/ # Core application package│ ├── application.go # Application type│ ├── webview_window.go # Window management│ ├── menu.go # Menu types│ ├── events.go # Event system│ └── dialogs.go # dialog APIs├── events/ # Event constants└── services/ # Built-in services ├── badge/ # Badge service ├── notifications/ # Notifications service └── sqlite/ # SQLite serviceImport Paths
Section titled “Import Paths”import ( "github.com/wailsapp/wails/v3/pkg/application" "github.com/wailsapp/wails/v3/pkg/events")JavaScript
Section titled “JavaScript”// Auto-generated bindingsimport { MyMethod } from './bindings/MyService'
// Runtime APIsimport { Events, Window } from '@wailsio/runtime'Type Reference
Section titled “Type Reference”Common Types
Section titled “Common Types”// Applicationtype Application struct { /* ... */ }type Options struct { /* ... */ }
// Windowtype WebviewWindow struct { /* ... */ }type WebviewWindowOptions struct { /* ... */ }
// Menutype Menu struct { /* ... */ }type MenuItem struct { /* ... */ }
// Eventstype Event struct { /* ... */ }type EventListener func(*Event)
// Dialogstype OpenDialogOptions struct { /* ... */ }type SaveDialogOptions struct { /* ... */ }// Window runtimeinterface WindowOptions { title?: string width?: number height?: number // ...}
// Eventstype EventCallback = (data: any) => void
// Bindings (auto-generated)export function MyMethod(arg: string): Promise<string>Platform Differences
Section titled “Platform Differences”Some APIs behave differently on different platforms:
| Feature | Windows | macOS | Linux |
|---|---|---|---|
| Application Menu | Window menu bar | Global menu bar | Window menu bar |
| System Tray | Notification area | Menu bar | System tray |
| Dock | N/A | ✅ Available | N/A |
| File dialogs | Native | Native | Native (GTK) |
| Transparency | ✅ Full | ✅ Full | ⚠️ Limited |
Platform-specific behaviour is documented in each API section.
Versioning
Section titled “Versioning”Wails v3 follows semantic versioning:
- Major (v3.x.x): Breaking changes
- Minor (v3.x.x): New features, backwards-compatible
- Patch (v3.x.x): Bug fixes, backwards-compatible
Current status: Alpha (API stable, refinements ongoing)
Deprecation Policy
Section titled “Deprecation Policy”When APIs are deprecated:
- Marked in docs with deprecation notice
- Alternative provided with migration guide
- Maintained for 1 major version before removal
- Compiler warnings (where possible)
API Stability
Section titled “API Stability”Stable APIs ✅
Section titled “Stable APIs ✅”These APIs are stable and safe for production use:
- Core application APIs
- Window management
- Menu system
- Event system
- File dialogs
- Service bindings
Unstable APIs ⚠️
Section titled “Unstable APIs ⚠️”These APIs may change before final release:
- Some advanced window options
- Platform-specific features
- Experimental features
Unstable APIs are marked in documentation.
Getting Help
Section titled “Getting Help”API Questions
Section titled “API Questions”- Check this reference - Complete API documentation
- Check examples - GitHub examples
- Search Discord - Discord server
- Ask the community - Discord #help channel
Reporting API Issues
Section titled “Reporting API Issues”Found a bug or inconsistency?
- Check existing issues - GitHub issues
- Create detailed report - Include code, error, platform
- Provide reproduction - Minimal example that demonstrates issue
Related Documentation
Section titled “Related Documentation”- Tutorials - Learn by building real applications
- Guides - Task-oriented guides for common scenarios
- Features - Feature-by-feature documentation
- Examples - Working code examples on GitHub
Browse the API: Use the navigation on the left to explore specific APIs.