Skip to content
ARC UI ARC Reactive Components
Docs Components Tokens Synthesizer
v2.1.0
Getting Started Frameworks Design Tokens Theming Theme Synthesizer Accessibility Browser Support Changelog Contributing All Components App ShellAspect GridAuth ShellCenterClusterContainerDashboard GridDockFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbar Anchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkSpeed DialStepper NavTabsTop BarTree View AccordionAspect RatioAvatarAvatar GroupCalloutCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageInfinite ScrollMarqueeScroll AreaSeparatorSkeletonSpinnerStackVirtual List Animated NumberBadgeComparisonCountdown TimerData TableDescription ListDiffKey ValueListMeterSparklineStatStepperTableTagTimelineValue Card BlockquoteCode BlockGradient TextHighlightKbdMarkdownNumber FormatProseTextTime AgoTruncateTypewriter ButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerFieldsetFile UploadFormHotkeyIcon ButtonInputInput GroupLabelMulti SelectNumber InputOTP InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSliderSortable ListSwitch GroupTextareaTheme ToggleTime PickerToggle AlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuDialogDropdown MenuGuided TourHover CardInline MessageLoading OverlayModalNotification PanelPopoverProgressProgress ToastSheetSnackbarSpotlightToastTooltip
Components Highlight
typography static
<arc-highlight>

Overview

Guidelines

When to use

  • Use Highlight in search result lists to show why each result matched
  • Pair with Search or CommandPalette to highlight the active query in results
  • Use in DataTable cells to highlight filtered column values
  • Update the query prop reactively as the user types for live highlighting

When not to use

  • Use Highlight for static emphasis — use <strong> or Text variant="label" instead
  • Pass HTML content as the text prop — it expects plain text only
  • Use Highlight on very long text (>10KB) without debouncing the query updates
  • Set both text and slot content — text prop takes precedence

Features

  • Automatic text splitting and mark wrapping at match boundaries
  • Case-insensitive matching by default, with case-sensitive option
  • Regex-safe query escaping — special characters matched literally
  • Themed mark styling with accent color background and underline
  • Zero-overhead for non-matching text — renders plain text without marks
  • CSS parts for mark and text segments for custom styling

Preview

Usage

<arc-highlight
  text="The quick brown fox jumps over the lazy dog"
  query="fox"
></arc-highlight>

<!-- Case-sensitive matching -->
<arc-highlight
  text="Hello World, hello world"
  query="Hello"
  case-sensitive
></arc-highlight>
import { Highlight } from '@arclux/arc-ui-react';

function SearchResults({ results, query }) {
  return results.map(r => (
    <Highlight key={r.id} text={r.title} query={query} />
  ));
}
<script setup>
import { ref } from 'vue';
import { Highlight } from '@arclux/arc-ui-vue';

const query = ref('');
const text = 'The quick brown fox jumps over the lazy dog';
</script>

<template>
  <input v-model="query" placeholder="Search..." />
  <Highlight :text="text" :query="query" />
</template>
<script>
  import { Highlight } from '@arclux/arc-ui-svelte';
  let query = '';
</script>

<input bind:value={query} placeholder="Search..." />
<Highlight text="The quick brown fox" {query} />
import { Component } from '@angular/core';
import { Highlight } from '@arclux/arc-ui-angular';

@Component({
  imports: [Highlight],
  template: `
    <input [(ngModel)]="query" placeholder="Search..." />
    <Highlight [text]="text" [query]="query" />
  `,
})
export class MyComponent {
  text = 'The quick brown fox jumps over the lazy dog';
  query = '';
}
import { Highlight } from '@arclux/arc-ui-solid';
import { createSignal } from 'solid-js';

const [query, setQuery] = createSignal('');

<input onInput={(e) => setQuery(e.target.value)} />
<Highlight text="The quick brown fox" query={query()} />
import { Highlight } from '@arclux/arc-ui-preact';
import { useState } from 'preact/hooks';

const [query, setQuery] = useState('');

<input onInput={(e) => setQuery(e.target.value)} />
<Highlight text="The quick brown fox" query={query} />
<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-highlight — requires highlight.css + tokens.css (or arc-ui.css) -->
<span class="arc-highlight">
  <span></span>
</span>
<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-highlight — self-contained, no external CSS needed -->
<span class="arc-highlight" style="display: inline">
  <span></span>
</span>

API

Prop Type Default Description
text string '' The full text to display and search within
query string '' The search query to highlight within the text
case-sensitive boolean false Whether matching should be case-sensitive

See Also