1

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

Riya Yadav
  • 157
  • 2
  • 12

6 Answers6

1

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

Akshay Kumar
  • 875
  • 13
  • 29
0

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 :)

Phil
  • 435
  • 2
  • 9
  • 28
0

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',
          },
        })}
      />
Akhil
  • 411
  • 4
  • 13
0

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

0

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;
}
jimihenrik
  • 247
  • 1
  • 2
  • 13
0

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;
}
victommasi
  • 339
  • 3
  • 10