Highlighter

Demo

Components

Flexible Components

Templates

Composable Templates

Themes

Customizable Themes

Alocite UI

Build fast, accessible, and beautiful interfaces.

HighlightGroup Props

NameTypeDescription
childrenReact.ReactNodeThe child elements to be rendered inside the HighlightGroup.
classNamestringOptional CSS class for custom styling.
refreshbooleanIf true, the component recalculates its size and reinitializes on demand.

HighlighterItem Props

NameTypeDescription
childrenReact.ReactNodeThe content to be displayed inside the HighlighterItem.
lightbooleanIf true, applies a light-themed highlight effect.
borderbooleanIf true, adds a border highlight effect.
wrapperbooleanIf true, wraps the children in an additional div with optional styling.
wrapperClassNamestringOptional CSS class for the wrapper div.
classNamestringOptional CSS class for custom styling.

Implementation Details

  • HighlightGroup: Manages a collection of items and tracks mouse movement to create interactive highlight effects.
  • HighlighterItem: Individual item that reacts to mouse movement within the HighlightGroup. It offers options for different styles of highlights, such as light-themed or border effects.

The components use the useMousePosition hook to track the mouse's position relative to the items and apply dynamic styles based on the mouse's location.

Styles

Both components use utility classes for styling, which can be customized via the classNames prop. Specific style classes include:

  • For HighlightGroup: className applies to the main container.
  • For HighlighterItem: className and wrapperClassName apply to the item and its optional wrapper, respectively. The component also uses pseudo-elements for interactive highlight effects.