Desktop-only API
Edit pageLast modified: 17 December 2024You can use Compose Multiplatform to create macOS, Linux, and Windows desktop applications. This page gives a short overview of the desktop-specific components and events. Each section includes a link to a detailed tutorial.
Components
The system tray
You can use the Tray
composable to send notifications to users in the system tray:
Tray(state = trayState, icon = TrayIcon, menu = { Item(
{...}
There are three types of notifications:
notify
, a simple notification.warn
, a warning notification.error
, an error notification.
You can also add an application icon to the system tray.
For more information, see the Menu, tray, and notifications tutorial.
Menu bar
You can use the MenuBar
composable to create and customize the menu bar for a particular window:
Window(MenuBar { Menu(
{...}
For more information, see the Menu, tray, and notifications tutorial.
Events
Tabbing navigation between components
You can set up navigation between components with the Tab keyboard shortcut for the next component and ⇧ + Tab for the previous one.
By default, the tabbed navigation allows you to move between focusable components in the order of their appearance. Focusable components include TextField
, OutlinedTextField
, and BasicTextField
composables, as well as components that use Modifier.clickable
, such as Button
, IconButton
, and MenuItem
.
For example, here's a window where users can navigate between five text fields using standard shortcuts:
Column() { for (x in 1..5) { OutlinedTextField(
{...}
You can also make a non-focusable component focusable, customize the order of tabbing navigation, and put components into focus.
For more information, see the Tabbing navigation and keyboard focus tutorial.
What's next
Complete the Compose Multiplatform desktop application tutorial.
Learn how to create unit tests for your Compose Multiplatform desktop project.
Learn how to create native distributions, installers, and packages for desktop platforms.
Set up interoperability with Swing and migrate your Swing applications to Compose Multiplatform.
Learn about accessibility support on different platforms.
Thanks for your feedback!