settings.Get("label", &label);
button.title = base::SysUTF8ToNSString(label);
+ std::string iconPosition = "left";
+ settings.Get("iconPosition", &iconPosition);
gfx::Image image;
if (settings.Get("icon", &image)) {
button.image = image.AsNSImage();
+ if (iconPosition == "overlay") {
+ button.imagePosition = NSImageOverlaps;
+ } else if (iconPosition == "right") {
+ button.imagePosition = NSImageRight;
+ } else {
+ button.imagePosition = NSImageLeft;
+ }
}
}
* `backgroundColor` String (optional) - Button background color in hex format,
i.e `#ABCDEF`.
* `icon` [NativeImage](native-image.md) (optional) - Button icon.
+ * `iconPosition` String - Can be `left`, `right` or `overlay`.
* `click` Function (optional) - Function to call when the button is clicked.
### Instance Properties
super()
if (config == null) config = {}
this.type = 'button'
- const {click, icon, label, backgroundColor} = config
+ const {click, icon, iconPosition, label, backgroundColor} = config
this._addLiveProperty('label', label)
this._addLiveProperty('backgroundColor', backgroundColor)
this._addLiveProperty('icon', icon)
+ this._addLiveProperty('iconPosition', iconPosition)
if (typeof click === 'function') {
this.onInteraction = () => {
config.click()