Skip to content

Commit a8bab51

Browse files
authored
Merge pull request #12 from nodegui/button-iconprop
Added icon prop for Button
2 parents d213413 + d4ac24b commit a8bab51

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/Button/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { registerComponent } from "../config";
2-
import { QPushButton } from "@nodegui/nodegui";
2+
import { QPushButton, QIcon } from "@nodegui/nodegui";
33
import { ViewProps, setProps as setViewProps } from "../View";
44

55
interface ButtonProps extends ViewProps {
66
text?: string;
77
isFlat?: boolean;
8+
icon?: string;
89
}
910

1011
const setProps = (
@@ -18,6 +19,10 @@ const setProps = (
1819
},
1920
set isFlat(isFlat: boolean) {
2021
widget.setFlat(isFlat);
22+
},
23+
set icon(iconUrl: string) {
24+
const icon = new QIcon(iconUrl);
25+
widget.setIcon(icon);
2126
}
2227
};
2328
Object.assign(setter, newProps);

0 commit comments

Comments
 (0)