bvaughn / react-highlight-words

React component to highlight words within a larger body of text
https://bvaughn.github.io/react-highlight-words/
MIT License
2.16k stars 170 forks source link

Take className for unhighlighted text chunks as a prop #25

Closed mdarens closed 7 years ago

mdarens commented 7 years ago

Currently there is no way to pass a custom className to the text chunks which aren't highlighted. My use case is that I have a highlight style with negative margins matching the padding as I want the background not to be flush with the glyph boundaries while also preventing reflow in a large collection as the highlight changes. Unfortunately, without the ability to set a block formatting context so that z-index will work on the plain children of the component, the source order controls their stacking and text before the highlight in the reading direction is hidden by its background.

From what I can see in the source, it seems pretty easy to add, but I can't think of a good name for the prop.

What do you think? Thanks!

bvaughn commented 7 years ago

Hi,

I'm not really using this lib anymore. If you'd like to create a PR that adds this feature, I'll review it. I don't really have any thoughts about it though. 😄

danvc commented 7 years ago

@mdarens there is a PR for this: https://github.com/bvaughn/react-highlight-words/pull/27

bvaughn commented 7 years ago

Released via 0.8.0