mirror of
https://github.com/material-components/material-web.git
synced 2024-09-11 13:46:10 +03:00
feat(textfield): add no-spinner
to remove number spin buttons
PiperOrigin-RevId: 595788647
This commit is contained in:
parent
553aaa6695
commit
3c6e55006b
@ -43,6 +43,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optionally remove number input's spinner
|
||||||
|
.no-spinner .input {
|
||||||
|
&::-webkit-inner-spin-button,
|
||||||
|
&::-webkit-outer-spin-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[type='number'] {
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:focus-within .input {
|
:focus-within .input {
|
||||||
caret-color: var(--_focus-caret-color);
|
caret-color: var(--_focus-caret-color);
|
||||||
}
|
}
|
||||||
|
@ -226,6 +226,11 @@ export abstract class TextField extends textFieldBaseClass {
|
|||||||
*/
|
*/
|
||||||
@property({type: Number}) minLength = -1;
|
@property({type: Number}) minLength = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true, hide the spinner for `type="number"` text fields.
|
||||||
|
*/
|
||||||
|
@property({type: Boolean, attribute: 'no-spinner'}) noSpinner = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A regular expression that the text field's value must match to pass
|
* A regular expression that the text field's value must match to pass
|
||||||
* constraint validation.
|
* constraint validation.
|
||||||
@ -514,6 +519,7 @@ export abstract class TextField extends textFieldBaseClass {
|
|||||||
'disabled': this.disabled,
|
'disabled': this.disabled,
|
||||||
'error': !this.disabled && this.hasError,
|
'error': !this.disabled && this.hasError,
|
||||||
'textarea': this.type === 'textarea',
|
'textarea': this.type === 'textarea',
|
||||||
|
'no-spinner': this.noSpinner,
|
||||||
};
|
};
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
Loading…
Reference in New Issue
Block a user