Skip to content

Commit 1e2859c

Browse files
committed
chore(NcCheckboxRadioSwitch): deprecate button variant in favor of NcRadioGroup
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 8e85f44 commit 1e2859c

File tree

1 file changed

+68
-61
lines changed

1 file changed

+68
-61
lines changed

src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue

Lines changed: 68 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ export default {
5353
</script>
5454
```
5555

56+
### Standard checkbox set
57+
```vue
58+
<template>
59+
<div>
60+
<NcCheckboxRadioSwitch v-model="sharingPermission" value="r" name="sharing_permission" disabled>Permission read</NcCheckboxRadioSwitch>
61+
<NcCheckboxRadioSwitch v-model="sharingPermission" value="w" name="sharing_permission">Permission write</NcCheckboxRadioSwitch>
62+
<NcCheckboxRadioSwitch v-model="sharingPermission" value="d" name="sharing_permission">Permission delete</NcCheckboxRadioSwitch>
63+
<NcCheckboxRadioSwitch v-model="sharingPermission" value="x" name="sharing_permission">Permission execute</NcCheckboxRadioSwitch>
64+
<br>
65+
sharingPermission: {{ sharingPermission }}
66+
</div>
67+
</template>
68+
<script>
69+
export default {
70+
data() {
71+
return {
72+
sharingPermission: ['r', 'd'],
73+
}
74+
}
75+
}
76+
</script>
77+
```
78+
5679
### Standard radio set
5780
```vue
5881
<template>
@@ -78,7 +101,47 @@ export default {
78101
</script>
79102
```
80103

81-
### Standard radio set with alternative button style
104+
### Standard switch
105+
```vue
106+
<template>
107+
<div>
108+
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">Enable sharing</NcCheckboxRadioSwitch>
109+
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">Enable sharing (v-model)</NcCheckboxRadioSwitch>
110+
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch" disabled>Enable sharing (disabled)</NcCheckboxRadioSwitch>
111+
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">
112+
Enable sharing. This can contain a long multiline text, that will be wrapped in a second row. It is generally not advised to have such long text inside of an element
113+
</NcCheckboxRadioSwitch>
114+
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch" description="Instead you can use a description as a prop which can also be a long multiline text, that will be wrapped in a second row.">
115+
Enable sharing.
116+
</NcCheckboxRadioSwitch>
117+
118+
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">
119+
Enable sharing.
120+
<template #description>
121+
Or you can use a description as slot which can also be a <strong>long multiline text</strong>, that will be wrapped in a second row.
122+
</template>
123+
</NcCheckboxRadioSwitch>
124+
<br>
125+
sharingEnabled: {{ sharingEnabled }}
126+
</div>
127+
</template>
128+
<script>
129+
export default {
130+
data() {
131+
return {
132+
sharingEnabled: true,
133+
}
134+
},
135+
}
136+
</script>
137+
```
138+
139+
### Deprecated button variants
140+
⚠️ Warning the button variant is deprecated ⚠️
141+
The button variant does not provide proper grouping,
142+
to overcome this and other limitations we now provide `NcRadioGroup` instead.
143+
144+
#### Standard radio set with alternative button style
82145
```vue
83146
<template>
84147
<div>
@@ -138,7 +201,7 @@ export default {
138201
</script>
139202
```
140203

141-
### Radio set with button style and icons
204+
#### Radio set with button style and icons
142205
```vue
143206
<template>
144207
<div>
@@ -207,65 +270,6 @@ export default {
207270
}
208271
</script>
209272
```
210-
211-
### Standard checkbox set
212-
```vue
213-
<template>
214-
<div>
215-
<NcCheckboxRadioSwitch :disabled="true" v-model="sharingPermission" value="r" name="sharing_permission">Permission read</NcCheckboxRadioSwitch>
216-
<NcCheckboxRadioSwitch v-model="sharingPermission" value="w" name="sharing_permission">Permission write</NcCheckboxRadioSwitch>
217-
<NcCheckboxRadioSwitch v-model="sharingPermission" value="d" name="sharing_permission">Permission delete</NcCheckboxRadioSwitch>
218-
<NcCheckboxRadioSwitch v-model="sharingPermission" value="x" name="sharing_permission">Permission execute</NcCheckboxRadioSwitch>
219-
<br>
220-
sharingPermission: {{ sharingPermission }}
221-
</div>
222-
</template>
223-
<script>
224-
export default {
225-
data() {
226-
return {
227-
sharingPermission: ['r', 'd'],
228-
}
229-
}
230-
}
231-
</script>
232-
```
233-
234-
### Standard switch
235-
```vue
236-
<template>
237-
<div>
238-
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">Enable sharing</NcCheckboxRadioSwitch>
239-
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">Enable sharing (v-model)</NcCheckboxRadioSwitch>
240-
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch" :disabled="true">Enable sharing (disabled)</NcCheckboxRadioSwitch>
241-
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">
242-
Enable sharing. This can contain a long multiline text, that will be wrapped in a second row. It is generally not advised to have such long text inside of an element
243-
</NcCheckboxRadioSwitch>
244-
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch" description="Instead you can use a description as a prop which can also be a long multiline text, that will be wrapped in a second row.">
245-
Enable sharing.
246-
</NcCheckboxRadioSwitch>
247-
248-
<NcCheckboxRadioSwitch v-model="sharingEnabled" type="switch">
249-
Enable sharing.
250-
<template #description>
251-
Or you can use a description as slot which can also be a <strong>long multiline text</strong>, that will be wrapped in a second row.
252-
</template>
253-
</NcCheckboxRadioSwitch>
254-
<br>
255-
sharingEnabled: {{ sharingEnabled }}
256-
</div>
257-
</template>
258-
<script>
259-
export default {
260-
data() {
261-
return {
262-
sharingEnabled: true,
263-
}
264-
},
265-
}
266-
</script>
267-
```
268-
269273
</docs>
270274

271275
<template>
@@ -414,6 +418,8 @@ export default {
414418
415419
/**
416420
* Toggle the alternative button style
421+
*
422+
* @deprecated - Use `NcRadioGroup` instead
417423
*/
418424
buttonVariant: {
419425
type: Boolean,
@@ -425,6 +431,7 @@ export default {
425431
* If so they will be grouped horizontally or vertically
426432
*
427433
* @type {'no'|'horizontal'|'vertical'}
434+
* @deprecated - Use `NcRadioGroup` instead
428435
*/
429436
buttonVariantGrouped: {
430437
type: String,

0 commit comments

Comments
 (0)