I currently have a react-hook-form with some fields. One field is a <TextFields />
from mui/material (Link). This one is of type "number" and I want to hide the arrows from the number input.
Code
Code snippets from my DynamicFormComponent.tsx
file:
<TextField
name="my name"
label="my label"
defaultValue={0}
InputProps={{
type: "number",
}}
style={{
WebkitAppearance: "none",
appearance: "none",
MozAppearance: "none",
}}
/>
Problem / Question
I want to get rid of the arrows on the right side of the TextField but my approach so far doesn’t work.
I know that this pure html way works, but I can’t find a way to convert that to my ReactJS component.
<input type="number" value="5" style="-webkit-appearance: none;>
.
2
Answers
You can achieve this like so:
I would prefer to do it with
styled-component
as it makes application supper clean and easy to maintain. It would help you to override MUI base UI to transform it as you wishnow you can use it like