Mark

Marks a fragment of text, such as a search hit or something to notice.

Searching for “ spice ” found 3 results; volume three of Spice and Wolf mentions the spice most often.

<script setup lang="ts">
  import { Mark, Text } from '@hina-ui/vue'
</script>

<template>
  <Text class="max-w-lg">
    Searching for “
    <Mark>spice</Mark>
    ” found 3 results; volume three of Spice and Wolf mentions the
    <Mark>spice</Mark>
    most often.
  </Text>
</template>
vue

Usage

import { Mark } from '@hina-ui/vue'
ts

The component renders a native mark element with a tinted background and a very small radius. The text colour is unchanged, so reading is not interrupted.

In this sentence the marked words carry a background.

<script setup lang="ts">
  import { Mark, Text } from '@hina-ui/vue'
</script>

<template>
  <Text class="max-w-lg">
    In this sentence
    <Mark>the marked words</Mark>
    carry a background.
  </Text>
</template>
vue

Examples

Marks in body content

Prose applies the same styling to native mark elements inside it, so rendered Markdown and rich text need no tag replacement.

A mark tag in body content needs no separate component.

<script setup lang="ts">
  import { Prose } from '@hina-ui/vue'
</script>

<template>
  <Prose class="max-w-lg">
    <p>
      A
      <mark>mark</mark>
      tag in body content needs no separate component.
    </p>
  </Prose>
</template>
vue

Accessibility

  • The component renders a native mark element, and some screen readers announce where the mark begins and ends.
  • The background only guides the eye and carries no state, so there are no tones.

API

Props

Prop
Type
Default
Description
class
string
—
Classes appended to the root

Slots

Slot
Description
default
The marked text