Skip to content

Commit 3f46aef

Browse files
feat(checkbox): add required prop
1 parent 0030be8 commit 3f46aef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/src/components/checkbox/checkbox.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ export class Checkbox implements ComponentInterface {
9898
*/
9999
@Prop() alignment?: 'start' | 'center';
100100

101+
/**
102+
* If `true`, the user must fill in a value before submitting a form.
103+
*/
104+
@Prop() required = false;
105+
101106
/**
102107
* Emitted when the checked property has changed as a result of a user action such as a click.
103108
*
@@ -182,6 +187,7 @@ export class Checkbox implements ComponentInterface {
182187
name,
183188
value,
184189
alignment,
190+
required
185191
} = this;
186192
const mode = getIonMode(this);
187193
const path = getSVGPath(mode, indeterminate);
@@ -218,6 +224,7 @@ export class Checkbox implements ComponentInterface {
218224
onFocus={() => this.onFocus()}
219225
onBlur={() => this.onBlur()}
220226
ref={(focusEl) => (this.focusEl = focusEl)}
227+
required={required}
221228
{...inheritedAttributes}
222229
/>
223230
<div

0 commit comments

Comments
 (0)