Skip to content

Commit d85404e

Browse files
committed
feat: QField should allow to set icon color quasarframework#1577
1 parent be833b6 commit d85404e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/field/QField.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default {
1818
warningLabel: String,
1919
helper: String,
2020
icon: String,
21+
iconColor: String,
2122
dark: Boolean,
2223
orientation: {
2324
type: String,
@@ -103,6 +104,13 @@ export default {
103104
return this.isVertical
104105
? `col-xs-12`
105106
: (this.isHorizontal ? 'col' : 'col-xs-12 col-sm')
107+
},
108+
iconProps () {
109+
const prop = { name: this.icon }
110+
if (this.iconColor && !this.hasError && !this.hasWarning) {
111+
prop.color = this.iconColor
112+
}
113+
return prop
106114
}
107115
},
108116
provide () {
@@ -137,7 +145,7 @@ export default {
137145
}, [
138146
this.icon
139147
? h(QIcon, {
140-
props: { name: this.icon },
148+
props: this.iconProps,
141149
staticClass: 'q-field-icon q-field-margin'
142150
})
143151
: (this.insetIcon ? h('div', { staticClass: 'q-field-icon' }) : null),

0 commit comments

Comments
 (0)