swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

How do we change the css styles of 'swagger-ui-react' library ?

Open stefinie123 opened this issue 4 years ago • 3 comments

Is your feature request related to a problem?

Currently I'm using swagger-ui-react library in my React application. I want to modify the look and feel of the swagger UI component to match with the theme of my app, but there seems to be no way of doing this with `swagger-ui-react' library

Describe the solution you'd like

Can you support this feature in the library. Or else is there any alternative way for this ?

stefinie123 avatar Feb 17 '21 19:02 stefinie123

@stefinie123, I didn't find any good way to modify the theming of the components available in swagger-ui. That is one of the reasons why we switched libraries to one like openapi explorer

wparad avatar Apr 04 '21 17:04 wparad

A solution could be to rewrite the swagger-ui-react css using css variables. This way users could easily override default style from swagger by overriding the variables locally using custom selectors.

Let me know if you're interested for a PR

RobinLallier avatar Sep 25 '23 17:09 RobinLallier

image

just like this :

=> tailwindcss

.swagger-ui * {
  @apply !font-[Onest];
}

=> native css

.swagger-ui * {
  font-family: 'Onest' !important;
}

don't forget to add !important

zaadevofc avatar May 26 '24 16:05 zaadevofc