Back to all questions

How can I change input focus styles?

Last updated

Change focus styles of a single input

To change the focus styles of a single input, use Styles API. Note that in order for this to work correctly with all inputs, you need to use the :focus-within pseudo-class instead of :focus:

.input {
  &:focus-within {
    outline: rem(2px) solid var(--mantine-primary-color-filled);
  }
}

Change focus styles of all inputs

To change the focus styles of all inputs, use Styles API with the Input component in the theme object:

.input {
  &:focus-within {
    outline: rem(2px) solid var(--mantine-primary-color-filled);
  }
}