Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat and fix: NcCheckboxRadioSwitch required prop and input position fix #4488

Merged
merged 2 commits into from Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue
Expand Up @@ -414,6 +414,14 @@ export default {
default: false,
},

/**
* Required state
*/
required: {
type: Boolean,
default: false,
},

/**
* Loading state
*/
Expand Down Expand Up @@ -441,6 +449,7 @@ export default {
return {
checked: this.isChecked,
indeterminate: this.indeterminate,
required: this.required,
name: this.name,
}
},
Expand Down Expand Up @@ -609,13 +618,16 @@ export default {
<style lang="scss" scoped>
.checkbox-radio-switch {
display: flex;
align-items: center;

&__input {
position: absolute;
z-index: -1;
opacity: 0 !important; // We need !important, or it gets overwritten by server style
width: var(--icon-size);
height: var(--icon-size);
// Same as label padding
margin: 4px $icon-margin;
}

&__input:focus-visible + label {
Expand Down