Skip to content

Commit e89a618

Browse files
committed
feat(switch): allow custom label markup with default slot
1 parent 2365895 commit e89a618

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

components/switch/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ var vm = new Vue({
1515
})
1616
```
1717

18+
> or use default slot for label
19+
20+
```html
21+
<mdc-switch v-model="checked">{{Label}}</mdc-switch>
22+
```
23+
1824
### props
1925

2026
| props | Type | Default | Description |

components/switch/mdc-switch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div class="mdc-switch__knob"></div>
1010
</div>
1111
</div>
12-
<label :for="_uid" v-if="label">{{ label }}</label>
12+
<label ref="label" :for="_uid"><slot>{{label}}</slot></label>
1313
</div>
1414
</template>
1515

0 commit comments

Comments
 (0)