Skip to content

Commit 1d5cd4b

Browse files
feat(select): add required prop
1 parent 0030be8 commit 1d5cd4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/src/components/select/select.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ export class Select implements ComponentInterface {
196196
*/
197197
@Prop({ mutable: true }) value?: any | null;
198198

199+
/**
200+
* If `true`, the user must fill in a value before submitting a form.
201+
*/
202+
@Prop() required = false;
203+
199204
/**
200205
* Emitted when the value has changed.
201206
*
@@ -974,7 +979,7 @@ export class Select implements ComponentInterface {
974979
}
975980

976981
private renderListbox() {
977-
const { disabled, inputId, isExpanded } = this;
982+
const { disabled, inputId, isExpanded, required } = this;
978983

979984
return (
980985
<button
@@ -983,6 +988,7 @@ export class Select implements ComponentInterface {
983988
aria-label={this.ariaLabel}
984989
aria-haspopup="dialog"
985990
aria-expanded={`${isExpanded}`}
991+
aria-required={`${required}`}
986992
onFocus={this.onFocus}
987993
onBlur={this.onBlur}
988994
ref={(focusEl) => (this.focusEl = focusEl)}

0 commit comments

Comments
 (0)