Tailwind prefixes with Search UI React components

Hello,

I’m working on a search experience using the built-in Search UI React components (<SearchBar />, <ResultsCount />, <Vertical Results />, <Pagination />, etc.) and I want to be able to leverage all all the base tailwind styling that’s included by default in these components.

In my tailwind configuration I’ve added a prefix according to this documentation: Configuration - Tailwind CSS. This prefix isn’t being passed through to the React components so none of the styling is being applied.

I know I can pass custom CSS classes to these components to override the styling, but there are some elements in these components that I can’t customize through that prop (especially with the <SearchBar /> component and the autocomplete result classes). For example, the div with this text “When autocomplete results are available, use up and down arrows to review and enter to select.” doesn’t have an custom CSS class prop.

I was wondering what the best way to handle tailwind prefixes would be?

Hi Rohit,

Passing a tailwind prefix to the components isn’t currently supported out of the box. But, you can import the CSS bundle for search-ui-react (import '@yext/search-ui-react/bundle.css) to get all the default styling for the components.

Best,
Nidhi

1 Like