Platform-Adaptive Native Theme
I’d like to refine the original idea based on the feedback in this discussion.
Instead of creating a separate set of "NativeButton", "NativeInput", "NativeDialog", etc., I think this could fit better into the existing "Theme" system.
The goal is to allow the existing "gpui-component" components to automatically feel native to the platform they are running on.
For example:
Button::new("Save")
could use an appropriate macOS/Cupertino-style presentation on macOS and Fluent/Windows-style presentation on Windows, without requiring developers to maintain separate platform-specific components.
This could cover more than colors, including:
- Typography and spacing
- Control sizes and corner radii
- Focus, hover and pressed states
- Menus, dialogs and toolbars
- Keyboard shortcuts and platform conventions
- Accessibility and interaction behavior
The important distinction is that I don't mean wrapping actual AppKit or WinUI widgets. The components could remain GPUI-rendered while following the conventions of the host platform.
I also agree that prefixing every component with "Native" isn't ideal. The existing component API should remain unchanged, with the platform-adaptive behavior provided through the theme/platform layer.
Why this could be useful
This could give GPUI Kit a simple way to build applications that:
- Use one cross-platform component API
- Automatically adapt to macOS and Windows conventions
- Avoid duplicated platform-specific components
- Still allow developers to customize or use the existing themes when they want a consistent design across platforms
I think it would be interesting to explore whether the existing "Theme" system can support this cleanly, rather than introducing another parallel component library.
Would this be a direction worth considering for "gpui-component"?
Source: longbridge/gpui-component