UNPKG

react-highlighter-ts

Version:

a TypeScript rewrite of the package react-highlighter

43 lines (42 loc) 1.32 kB
import { CSSProperties } from "react"; export interface HighlightProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "css"> { /** * The string of text (or Regular Expression) to highlight */ search?: string | RegExp; /** * Determine whether string matching should be case-sensitive. Not applicable * to regular expression searches. Defaults to `false`. */ caseSensitive?: boolean; /** * Determine whether string matching should ignore diacritics. Defaults to * `false`. */ ignoreDiacritics?: boolean; /** * if `ignoreDiacritics` is true, then the characters supplied in this string * are treated as a list of diacritics to _not_ ignore. */ diacriticsBlacklist?: string; /** * HTML tag name to wrap around highlighted text. Defaults to `mark`. */ matchElement?: string | (() => JSX.Element); /** * HTML class to wrap around highlighted text. Defaults to `highlight`. */ matchClass?: string; /** * Custom style for the match element around highlighted text. */ matchStyle?: CSSProperties; /** * The children passed to `<Highlight>` */ children?: React.ReactNode; /** * Optional ref for the parent `<span>` */ ref?: React.Ref<HTMLElement>; }