Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding input spinner using styled-component

There are lot of solutions out there to hide the input spinner using css. One of them being:

input::-webkit-inner-spin-button, input::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    -moz-appearance:textfield !important;
}

I want to know how I can implement it in styled-component? Thanks

like image 207
blankface Avatar asked Dec 07 '22 12:12

blankface


1 Answers

Declare like this:

const Input = styled.input`
    ::-webkit-inner-spin-button{
        -webkit-appearance: none; 
        margin: 0; 
    }
    ::-webkit-outer-spin-button{
        -webkit-appearance: none; 
        margin: 0; 
    }    
`;

Use like this:

<Input type="number">

like image 116
Bruno Monteiro Avatar answered Dec 28 '22 18:12

Bruno Monteiro