Skip to main content

Highlighter

Highlighter is a component that highlights a target element using specified styles.

The DappletContextPicker feature uses this component under the hood to highlight the contexts that are available for selection.

Demos

tip

For examples and details on the usage of this React components, visit the feature demo page:

Picker

Basic usecase

You don't need to import the component. It's available in the NEAR Components through the Layout Managers.

<Highlighter target={target} isFirstTargetOnly={isFirstTargetOnly} />

Props

It takes in properties defined by THighlighterTask, including target, styles, icon, action, and an optional filled state.

NameTypeOptionalDescription
targetInjectableTargetThe target context to be highlighted
isFirstTargetOnlyboolean✔️If true, only the first visible context of the specified type on the page will be selected. If the page is scrolled, a new visible context will be selected.
stylesReact.CSSProperties✔️CSS styles for the highlighting. Can be set: position, backgroundColor, border, borderWidth, borderStyle, borderColor, borderRadius, zIndex, opacity, cursor
isFilledboolean✔️If true, a color overlay will be placed on the target context. You can add a click interaction to it using the action prop.
iconReactElement✔️The image that will be displayed in the center of the filled target context.
action() => void✔️A callback that will be called when a filled context is clicked.