Skip to content

Commit 2e65e4c

Browse files
committed
feat(QFab): when labels are external, show it on the main QFab only when it's opened; this behavior is overridable
1 parent ded45be commit 2e65e4c

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

docs/src/examples/QFab/NonExpandable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="q-pa-md">
33
<q-layout view="lhh LpR lff" container style="height: 300px" class="shadow-2 rounded-borders">
4-
<q-header reveal class="bg-black">
4+
<q-header class="bg-black">
55
<q-toolbar>
66
<q-btn flat round dense icon="menu" />
77
<q-toolbar-title>Header</q-toolbar-title>

docs/src/pages/vue-components/floating-action-button.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ When the labels are internal and your QFab opens up vertically (up or down) then
4545

4646
<q-badge label="v1.9+" />
4747

48+
By default, when the label is external on the main QFab (not the sub-actions), it gets shown only when QFab is opened. However, you can override that by setting a Boolean value for `hide-label` prop.
49+
4850
<doc-example title="External label" file="QFab/ExternalLabel" />
4951

5052
<doc-example title="Custom styled external label" file="QFab/ExternalLabelStyled" />

ui/src/components/fab/QFab.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export default Vue.extend({
3333
icon: String,
3434
activeIcon: String,
3535

36+
hideLabel: {
37+
default: null
38+
},
39+
3640
direction: {
3741
type: String,
3842
default: 'right',

ui/src/mixins/fab.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,34 @@ export default {
4343
},
4444

4545
labelProps () {
46-
return this.externalLabel === true
47-
? {
46+
if (this.externalLabel === true) {
47+
const hideLabel = this.hideLabel === null
48+
? this.showing === false
49+
: this.hideLabel
50+
51+
return {
4852
action: 'push',
4953
data: {
5054
staticClass: `q-fab__label q-tooltip--style q-fab__label--external` +
5155
` q-fab__label--external-${this.labelPosition}` +
52-
(this.hideLabel === true ? ' q-fab__label--external-hidden' : ''),
56+
(hideLabel === true ? ' q-fab__label--external-hidden' : ''),
5357
style: this.labelStyle,
5458
class: this.labelClass
5559
}
5660
}
57-
: {
58-
action: [ 'left', 'top' ].includes(this.labelPosition)
59-
? 'unshift'
60-
: 'push',
61-
data: {
62-
staticClass: `q-fab__label q-fab__label--internal q-fab__label--internal-${this.labelPosition}` +
63-
(this.hideLabel === true ? ' q-fab__label--internal-hidden' : ''),
64-
style: this.labelStyle,
65-
class: this.labelClass
66-
}
61+
}
62+
63+
return {
64+
action: [ 'left', 'top' ].includes(this.labelPosition)
65+
? 'unshift'
66+
: 'push',
67+
data: {
68+
staticClass: `q-fab__label q-fab__label--internal q-fab__label--internal-${this.labelPosition}` +
69+
(this.hideLabel === true ? ' q-fab__label--internal-hidden' : ''),
70+
style: this.labelStyle,
71+
class: this.labelClass
6772
}
73+
}
6874
}
6975
}
7076
}

0 commit comments

Comments
 (0)