You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/xplat/src/content/en/components/inputs/highlight.mdx
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,10 @@ import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro'
18
18
19
19
## Usage
20
20
21
-
To use the <ApiLinktype="Highlight" /> component, all you need to do is wrap its tags around the content you want to search through. The component searches through the content of all nested elements within the <PlatformBlockfor="WebComponents">`<igc-highlight>`</PlatformBlock><PlatformBlockfor="React">`<IgrHighlight>`</PlatformBlock> tags, and highlights all matches of the specified string.
21
+
To use the <ApiLinktype="Highlight" /> component, all you need to do is wrap its tags around the content you want to search. The component searches the content of all nested elements within the <PlatformBlockfor="WebComponents">`<igc-highlight>`</PlatformBlock><PlatformBlockfor="React">`<IgrHighlight>`</PlatformBlock> tags, and highlights all matches of the specified string.
22
22
23
23
<DocsAsidetype="note">
24
-
The <ApiLinktype="Highlight" /> component searches only through DOM text nodes. It does not search through input values or content set via the CSS `content` property.
24
+
The <ApiLinktype="Highlight" /> component searches only DOM text nodes. It does not search input values or content set via the CSS `content` property.
25
25
</DocsAside>
26
26
27
27
First, you need to install the {ProductName} by running the following command:
@@ -78,13 +78,13 @@ The `<igc-highlight>` tags wrap the content in which you want to highlight the s
78
78
The `<IgrHighlight>` tags wrap the content in which you want to highlight the specific string.
79
79
</PlatformBlock>
80
80
81
-
The text to be highlighted is set through the <ApiLinktype="Highlight"member="searchText"label="search-text"/> attribute. In the example above, the word "dolor" will be highlighted.
81
+
The text to be highlighted is set via the <ApiLinktype="Highlight"member="searchText"label="search-text"/> attribute. In the example above, the word "dolor" will be highlighted.
The <ApiLinktype="Highlight" /> component also exposes a <ApiLinktype="Highlight"member="caseSensitive"label="case-sensitive"/> attribute. Its default value is `false`, which returns case-insensitive matches. By setting it to `true` you can enable case-sensitive matching.
87
+
The <ApiLinktype="Highlight" /> component also exposes a <ApiLinktype="Highlight"member="caseSensitive"label="case-sensitive"/> attribute. Its default value is `false`, which enables case-insensitive matching. By setting it to `true`, you can enable case-sensitive matching.
88
88
89
89
The following snippet:
90
90
@@ -104,22 +104,22 @@ The following snippet:
104
104
```
105
105
</PlatformBlock>
106
106
107
-
Returns 0 matches because the search text "lorem" is in lowercase, while the text in the content is **Lorem** with an uppercase **L**.
107
+
This returns 0 matches because the search text "lorem" is in lowercase, while the text in the content is **Lorem** with an uppercase **L**.
108
108
109
109
### Using Highlight with a Search Input
110
110
111
111
The most common use case is binding the <ApiLinktype="Highlight" /> component to a search <ApiLinktype="Input" /> component, so that search matches are highlighted in real time as the user types.
112
112
113
-
To bind the two together you can listen to the `igcInput` event of the <ApiLinktype="Input" /> component and set the <ApiLinktype="Highlight"member="searchText"label="search-text"/> attribute of the <ApiLinktype="Highlight" /> component to the input value every time the event is fired (you can also use the standard `input` event).
113
+
To bind the two together, you can listen to the `igcInput` event of the <ApiLinktype="Input" /> component and set the <ApiLinktype="Highlight"member="searchText"label="search-text"/> attribute of the <ApiLinktype="Highlight" /> component to the input value every time the event is fired (you can also use the standard `input` event).
114
114
115
115
<PlatformBlockfor="WebComponents">
116
-
First you need to access the <ApiLinktype="Highlight" /> component so you can manipulate its properties:
116
+
First, you need to access the <ApiLinktype="Highlight" /> component to manipulate its properties:
First you need to access the <ApiLinktype="Highlight" /> component so you can manipulate its properties, the easiest way to do that is through a reference:
143
+
First, you need to access the <ApiLinktype="Highlight" /> component to manipulate its properties. The easiest way to do this is via a reference:
Then create a function that will update the status of the search, which will be called every time the value of the search input changes through the `igcInput` event:
159
+
Then, create a function that updates the search text, called every time the `igcInput` event fires:
The component also exposes two methods that allow you to navigate through the matches of the searched text. The <ApiLinktype="Highlight"member="next"label="next()"/> method will navigate to the next match, while the <ApiLinktype="Highlight"member="previous"label="previous()"/> method will navigate to the previous match.
174
+
The component also exposes two methods for navigating the search matches. The <ApiLinktype="Highlight"member="next"label="next()"/> method moves to the next match, while the <ApiLinktype="Highlight"member="previous"label="previous()"/> method moves to the previous one.
175
175
176
-
With them we can make the search more interactive by creating two buttons that will allow you to navigate through the matches:
176
+
With them, we can make the search more interactive by adding two buttons to navigate between matches:
Both the <ApiLinktype="Highlight"member="previous"label="previous()" /> and <ApiLinktype="Highlight"member="next"label="next()" /> methods accept a <ApiLinktype="Highlight"member="preventScroll" /> option that prevents the page from scrolling to the active match during navigation. By default, the option is set to `false`.
244
+
Both the <ApiLinktype="Highlight"member="previous"label="previous()" /> and <ApiLinktype="Highlight"member="next"label="next()" /> methods accept a <ApiLinktype="Highlight"member="preventScroll" /> option that prevents the page from scrolling to the active match during navigation. By default, it is set to `false`.
245
245
246
246
<PlatformBlockfor="WebComponents">
247
247
```ts
@@ -304,7 +304,7 @@ const updateStatus = () => {
304
304
```
305
305
</PlatformBlock>
306
306
307
-
Then we can call the `updateStatus()`function every time the value of the search input changes and every time the user clicks on the next or previous buttons:
307
+
We can then call `updateStatus()` every time the input value changes or the user clicks the next or previous buttons:
0 commit comments