Skip to content

Commit 28eb51c

Browse files
committed
feat(CFormCheck): add a reverse property to allow put checkboxes and radios to the opposite side
1 parent 9fad9d2 commit 28eb51c

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

packages/coreui-vue/src/components/form/CFormCheck.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ const CFormCheck = defineComponent({
8383
type: [Boolean, String],
8484
value: undefined,
8585
},
86+
/**
87+
* Put checkboxes or radios on the opposite side.
88+
*
89+
* @sinve 4.8.0
90+
*/
91+
reverse: Boolean,
8692
/**
8793
* Display validation feedback in a styled tooltip.
8894
*
@@ -126,6 +132,7 @@ const CFormCheck = defineComponent({
126132
'form-check',
127133
{
128134
'form-check-inline': props.inline,
135+
'form-check-reverse': props.reverse,
129136
'is-invalid': props.invalid,
130137
'is-valid': props.valid,
131138
},

packages/docs/forms/checkbox.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ Group checkboxes on the same horizontal row by adding `inline` boolean property
7373
<CFormCheck inline id="inlineCheckbox3" value="option3" label="3 (disabled)" disabled/>
7474
```
7575

76+
## Reverse
77+
78+
Put your checkboxes on the opposite side by adding `reverse` boolean property.
79+
80+
::: demo
81+
<CFormCheck reverse id="reverseCheckbox1" value="option1" label="Reverse checkbox"/>
82+
<CFormCheck reverse id="reverseCheckbox2" value="option2" label="Disabled reverse checkbox" disabled/>
83+
:::
84+
```vue
85+
<CFormCheck reverse id="reverseCheckbox1" value="option1" label="Reverse checkbox"/>
86+
<CFormCheck reverse id="reverseCheckbox2" value="option2" label="Disabled reverse checkbox" disabled/>
87+
```
88+
7689
## Without labels
7790

7891
Remember to still provide some form of accessible name for assistive technologies (for instance, using `aria-label`).

packages/docs/forms/radio.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ Group radios on the same horizontal row by adding `inline` boolean property to a
6363
<CFormCheck inline type="radio" name="inlineRadioOptions" id="inlineCheckbox3" value="option3" label="3 (disabled)" disabled/>
6464
```
6565

66+
## Reverse
67+
68+
Put your radios on the opposite side by adding `reverse` boolean property.
69+
70+
::: demo
71+
<CFormCheck reverse type="radio" id="reverseOption1" value="option1" label="Reverse radio"/>
72+
<CFormCheck reverse type="radio" id="reverseOption2" value="option2" label="Disabled reverse radio" disabled/>
73+
:::
74+
```vue
75+
<CFormCheck reverse type="radio" id="reverseOption1" value="option1" label="Reverse radio"/>
76+
<CFormCheck reverse type="radio" id="reverseOption2" value="option2" label="Disabled reverse radio" disabled/>
77+
```
78+
6679
## Without labels
6780

6881
Remember to still provide some form of accessible name for assistive technologies (for instance, using `aria-label`).

0 commit comments

Comments
 (0)