I want to remove the blue outline and box-shadow when the input tag is active.

- 157
- 2
- 12
-
"the blue outline" you mean the cursor? – Giovanni Esposito Jul 30 '21 at 12:03
-
the cursor which is black in color is within the blue outlined box – Riya Yadav Jul 30 '21 at 12:07
6 Answers
The box shadow is introduced by @tailwindcss/forms
plugin.
Default strategy for the forms plugin is to globally apply styles on form elements.
You can change this by specifying a different strategy for the plugin in tailwind.config.js
file.
plugins: [
...
require('@tailwindcss/forms')({
strategy: 'class',
}),
]
But now you would have to apply form-[inputType]
classes on all form elements you want styled with @tailwindcss/forms
plugin.
Here's more on this: https://github.com/tailwindlabs/tailwindcss-forms#using-only-global-styles-or-only-classes

- 875
- 13
- 29
-
1
-
1I could do this with: input[id^="react-select-"] { @apply focus:outline-none focus:border-transparent focus:ring-0; } – victommasi May 05 '23 at 15:30
You need to pass custom styles prop.
Something like this
const customStyles = {
control: (base, state) => ({
...base,
height: "100%",
minHeight: "100%",
border: 0,
boxShadow: "none",
}),
dropdownIndicator: (base, state) => {
return {
...base,
};
},
placeholder: (base, state) => ({
...base,
}),
singleValue: (base, state) => ({
...base,
}),
option: (base, state) => ({
...base,
}),
};
return (
<Select
//REST OF YOUR PROPS
styles={customStyles}
isSearchable={false} //This gets rid of the default cursor
/>
)
Try playing around with the customStyles
object to style it further :)

- 435
- 2
- 9
- 28
-
-
Create a minimum reproducible question in code sandbox , I will edit it for you :) – Phil Jul 31 '21 at 12:54
The default styles are derived from a theme object, which you can mutate like styles.
The theme object is available for the styles functions as well.
<Select
label="Single select"
options={user}
theme={theme => ({
...theme,
borderRadius: 'none',
colors: {
...theme.colors,
primary25: 'primary',
primary: 'neutral5',
},
})}
/>

- 411
- 4
- 13
const style = { control: base => ({ ...base, border: 0, boxShadow: 'none' }) };

- 1
- 1
Old question but the blue outline is a drop-shadow on the input field itself (at least was in my case), I ended up just adding a custom class to the select field like
<ReactSelect
title = { __( 'Title', 'lang' ) }
className = { 'your-custom-class' }
...
and then styling it out with
.your-custom-class input {
box-shadow: none;
}

- 247
- 1
- 2
- 13
Another approach of Akshay Kumar's awnser that worked for me (tailwind):
input[id^="react-select-"] {
@apply focus:outline-none focus:border-transparent focus:ring-0;
}

- 339
- 3
- 10