IconButton
#282
Replies: 1 comment
-
Yeah, we definitely want to support alignment and size. Some folks may just want a Button with just an icon too. Definitely see a lot of folks wanting some simpler solution here to make it easier to be consistent with this across apps. Wonder if we want to support icon sizes like FYI @JustinXinLiu as well for his thoughts. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Settings Expander
Problem Statement
Icon buttons are everywhere across Windows and other OSes. At the moment, it can be pretty painful to create a consistent IconButton that renders the Icon and Content appropriately - resulting in many different implementations and UX inconsistencies.
The challenge however, is that WinUI provides many different Button types:
Button
![image](https://user-images.githubusercontent.com/9866362/195559328-c9c1a27e-1e9c-4592-bb4b-fda2e0f7ef06.png)
ToggleButton
![image](https://user-images.githubusercontent.com/9866362/195561256-b4ec6854-cfc3-4b26-a37b-8494fead40bf.png)
DropDownButton
![image](https://user-images.githubusercontent.com/9866362/195564755-d8abd641-47e2-4f16-aaf3-e6e680cb2c70.png)
SplitButton
![image](https://user-images.githubusercontent.com/9866362/195558165-53270f44-e463-4540-9a10-02068bf3ac3f.png)
![image](https://user-images.githubusercontent.com/9866362/195559067-6489c5e3-8a0a-4f93-9d15-8de4d43245ac.png)
HyperLinkButton
![image](https://user-images.githubusercontent.com/9866362/195560082-1b4e1bda-2fef-41d8-adc4-4168e1e76f03.png)
Required XAML to currently do this:
As you can see, this can be quite verbose - not easy to re-use and prone to (layout) issues (like picking the wrong spacing).
Inspiration
Many community developers have worked on their own implementations of this control/pattern.
Proposed Solution
It'd be great to make it easy for developers to consistently add an icon to a specific button type. Ideally, we'd have IconButton, IconToggleButton, etc. controls - but for the sake of maintenance, I'm not sure if it makes sense to introduce new button types for all of these variants?
Alternatively, we could create a new helper control that can be set as the content of a Button type?
Properties that come to mind:
XAML markup:
results in:
![image](https://user-images.githubusercontent.com/9866362/195571138-dbf17d0e-122e-4e1b-9f81-c9e81b6b6dcd.png)
An additional benefit, is that you can quickly move this around in anything that takes an object, e.g.:
In a PivotItem.Header:
![image](https://user-images.githubusercontent.com/9866362/195566871-3f4b2fae-0c93-4211-8677-c57e1908286d.png)
ComboBoxItem.Content:
![image](https://user-images.githubusercontent.com/9866362/195569363-376c1719-192d-4a0f-ad10-276352467a55.png)
Open Questions
API Reference Docs
References
Windows Visual Library
Beta Was this translation helpful? Give feedback.
All reactions