Set the measure first
Long lines tire the eye, so readers lose their place on the way back. Keep body text at 45 to 75 characters per line, give it a line height near 1.5, and let headings sit closer to the text they introduce than to the one above.
A highlight that draws behind inline text from four directions: in view, on hover or focus, on mount, or on command. Solid, marker, underline, or gradient.
Long lines tire the eye, so readers lose their place on the way back. Keep body text at 45 to 75 characters per line, give it a line height near 1.5, and let headings sit closer to the text they introduce than to the one above.
Long lines tire the eye, so readers lose their place on the way back. Keep body text at 45 to 75 characters per line, give it a line height near 1.5, and let headings sit closer to the text they introduce than to the one above.
Long lines tire the eye, so readers lose their place on the way back. Keep body text at 45 to 75 characters per line, give it a line height near 1.5, and let headings sit closer to the text they introduce than to the one above.
Long lines tire the eye, so readers lose their place on the way back. Keep body text at 45 to 75 characters per line, give it a line height near 1.5, and let headings sit closer to the text they introduce than to the one above.
Long lines tire the eye, so readers lose their place on the way back. Keep body text at
<article class="text-base leading-7 text-muted">
<h3 class="text-lg font-semibold text-ink">Set the measure first</h3>
<p class="mt-2">Long lines tire the eye, so readers lose their place on the way back. Keep body text at <x-markas.text-highlighter>45 to 75 characters</x-markas.text-highlighter> per line, give it a <x-markas.text-highlighter :delay="400">line height near 1.5</x-markas.text-highlighter>, and let headings sit <x-markas.text-highlighter :delay="800">closer to the text they introduce</x-markas.text-highlighter> than to the one above.</p>
</article><ul class="grid gap-3 text-base font-medium text-ink">
<li><a href="#" class="rounded-sm focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary"><x-markas.text-highlighter trigger="hover" :duration="400">Left to right</x-markas.text-highlighter></a></li>
<li><a href="#" class="rounded-sm focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary"><x-markas.text-highlighter trigger="hover" direction="rtl" color="success" :duration="400">Right to left</x-markas.text-highlighter></a></li>
<li><a href="#" class="rounded-sm focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary"><x-markas.text-highlighter trigger="hover" direction="ttb" color="danger" :duration="400">Top to bottom</x-markas.text-highlighter></a></li>
<li><a href="#" class="rounded-sm focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary"><x-markas.text-highlighter trigger="hover" direction="btt" color="primary" :duration="400">Bottom to top</x-markas.text-highlighter></a></li>
</ul>Before you publish, check that the title fits in 60 characters, every image has alt text, and the summary answers one clear question.
Before you publish, check that the title fits in 60 characters, every image has alt text, and the summary answers one clear question.
Before you publish, check that the title fits in 60 characters, every image has alt text, and the summary answers one clear question.
Before you publish, check that the title fits in 60 characters, every image has alt text, and the summary answers one clear question.
Before you publish, check that the
<div x-data class="grid gap-4">
<p class="text-base leading-7 text-muted">Before you publish, check that the <x-markas.text-highlighter trigger="manual">title fits in 60 characters</x-markas.text-highlighter>, every image has <x-markas.text-highlighter trigger="manual" color="success" :delay="250">alt text</x-markas.text-highlighter>, and the summary answers <x-markas.text-highlighter trigger="manual" color="danger" :delay="500">one clear question</x-markas.text-highlighter>.</p>
<div class="flex gap-2">
<button type="button" class="inline-flex h-9 items-center rounded-lg bg-primary px-3 text-sm font-medium text-on-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary" x-on:click="$dispatch('markas-highlight')">Highlight</button>
<button type="button" class="inline-flex h-9 items-center rounded-lg border border-line bg-surface px-3 text-sm font-medium text-ink hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary" x-on:click="$dispatch('markas-highlight-reset')">Reset</button>
</div>
</div>One set of components for Blade, React, and Vue, with tokens your team already knows.
One set of components for Blade, React, and Vue, with tokens your team already knows.
One set of components for Blade, React, and Vue, with tokens your team already knows.
One set of components for Blade, React, and Vue, with tokens your team already knows.
One set of components for Blade, React, and Vue, with tokens your team already knows.
<div class="py-4 text-center">
<h2 class="text-4xl leading-tight font-semibold tracking-tight text-ink">Ship your <x-markas.text-highlighter variant="marker" :duration="900">design system</x-markas.text-highlighter> before the next sprint</h2>
<p class="mx-auto mt-4 max-w-sm text-base leading-7 text-muted">One set of components for Blade, React, and Vue, with tokens your team already knows.</p>
</div><ul class="grid gap-3 text-base leading-7 text-muted">
<li>A <x-markas.text-highlighter>solid block</x-markas.text-highlighter> for quotes worth saving.</li>
<li>A <x-markas.text-highlighter variant="marker" color="success" :delay="150">marker stroke</x-markas.text-highlighter> for notes in the margin.</li>
<li>A <x-markas.text-highlighter variant="underline" color="danger" :delay="300">thick underline</x-markas.text-highlighter> for terms to remember.</li>
<li>A <x-markas.text-highlighter variant="gradient" :delay="450">two tone gradient</x-markas.text-highlighter> for the headline idea.</li>
</ul>npx markasui@latest add text-highlighterpnpm dlx markasui@latest add text-highlighteryarn dlx markasui@latest add text-highlighterbunx --bun markasui@latest add text-highlighternpm install alpinejsresources/views/components/markas/text-highlighter.blade.php.src/components/markas/TextHighlighter.tsx.src/components/markas/TextHighlighter.vue.src/lib/components/markas/TextHighlighter.svelte.src/components/markas/TextHighlighter.astro.src/app/markas/text-highlighter.component.ts.<p>Keep body text at <x-markas.text-highlighter>45 to 75 characters</x-markas.text-highlighter> per line, with a <x-markas.text-highlighter variant="marker" :delay="400">line height near 1.5</x-markas.text-highlighter>.</p>
<a href="/docs"><x-markas.text-highlighter trigger="hover" direction="rtl" color="success">Read the docs</x-markas.text-highlighter></a>
<div x-data>
<x-markas.text-highlighter trigger="manual">Ready to publish</x-markas.text-highlighter>
<button type="button" x-on:click="$dispatch('markas-highlight', { direction: 'ltr' })">Highlight</button>
<button type="button" x-on:click="$dispatch('markas-highlight-reset')">Reset</button>
</div>import { useRef } from "react";
import {
TextHighlighter,
type TextHighlighterHandle,
} from "@/components/markas/TextHighlighter";
const highlight = useRef<TextHighlighterHandle>(null);
<p>
Keep body text at <TextHighlighter>45 to 75 characters</TextHighlighter> per
line, with a{" "}
<TextHighlighter variant="marker" delay={400}>
line height near 1.5
</TextHighlighter>
.
</p>
<TextHighlighter ref={highlight} trigger="manual">Ready to publish</TextHighlighter>
<button type="button" onClick={() => highlight.current?.animate("rtl")}>Highlight</button>
<button type="button" onClick={() => highlight.current?.reset()}>Reset</button><script setup lang="ts">
import { ref } from "vue";
import TextHighlighter from "@/components/markas/TextHighlighter.vue";
const active = ref(false);
</script>
<template>
<p>
Keep body text at <TextHighlighter>45 to 75 characters</TextHighlighter> per
line, with a
<TextHighlighter variant="marker" :delay="400"
>line height near 1.5</TextHighlighter
>.
</p>
<TextHighlighter trigger="manual" :active="active"
>Ready to publish</TextHighlighter
>
<button type="button" @click="active = !active">Toggle</button>
</template><script lang="ts">
import TextHighlighter from "$lib/components/markas/TextHighlighter.svelte";
let active = $state(false);
</script>
<p>
Keep body text at <TextHighlighter>45 to 75 characters</TextHighlighter> per line,
with a
<TextHighlighter variant="marker" delay={400}
>line height near 1.5</TextHighlighter
>.
</p>
<TextHighlighter trigger="manual" {active}>Ready to publish</TextHighlighter>
<button type="button" onclick={() => (active = !active)}>Toggle</button>---
import TextHighlighter from "@/components/markas/TextHighlighter.astro";
---
<p>
Keep body text at <TextHighlighter>45 to 75 characters</TextHighlighter> per
line, with a{" "}
<TextHighlighter variant="marker" delay={400}>line height near 1.5</TextHighlighter>.
</p>
<TextHighlighter trigger="manual">Ready to publish</TextHighlighter>
<button
type="button"
onclick="window.dispatchEvent(new CustomEvent('markas-highlight'))"
>
Highlight
</button>import { Component, signal } from "@angular/core";
import { TextHighlighter } from "./markas/text-highlighter.component";
@Component({
selector: "app-checklist",
imports: [TextHighlighter],
template: `
<p>
Keep body text at
<span markas-text-highlighter>45 to 75 characters</span> per line, with a
<mark markas-text-highlighter variant="marker" delay="400"
>line height near 1.5</mark
>.
</p>
<span markas-text-highlighter trigger="manual" [active]="active()"
>Ready to publish</span
>
<button type="button" (click)="active.set(!active())">Toggle</button>
`,
})
export class Checklist {
active = signal(false);
}background-size, so it follows the text across line breaks (box-decoration-break: clone).trigger="view" uses IntersectionObserver with once and threshold; hover listens on the closest link, button, label, or element with tabindex, so keyboard focus draws it too.trigger="manual", React and Vue expose animate(direction?) and reset() through a ref. Blade listens for the markas-highlight (with an optional direction in the detail) and markas-highlight-reset window events, and Alpine.$data(el) exposes the same two methods. Svelte exposes them through bind:this, Astro listens for the same window events as Blade and exposes highlight(direction?) and reset() on the markas-text-highlighter element, and Angular exposes them through #mark="markasTextHighlighter".as input: put the markas-text-highlighter attribute on the element you want, such as span, strong, or mark.duration and delay set transition-duration and transition-delay on the element. Give each phrase a higher delay to highlight a paragraph in reading order.view and auto highlights are shown at once, and every change happens without a transition.| Name | Type | Default | Description |
|---|---|---|---|
as | string | "span" | The element to render. Keep it inline, such as span, strong, or mark. Angular: put the markas-text-highlighter attribute on that element. |
trigger | "view" | "hover" | "auto" | "manual" | "view" | view draws when the text scrolls into view, hover follows hover and keyboard focus of the closest link or button, auto draws on mount, manual follows active. |
direction | "ltr" | "rtl" | "ttb" | "btt" | "ltr" | Where the highlight grows from: left to right, right to left, top to bottom, or bottom to top. |
variant | "solid" | "marker" | "underline" | "gradient" | "solid" | solid fills the line, marker covers the lower 60% like a highlighter pen, underline draws a thick bar under the text, gradient blends two tokens. |
color | "warning" | "primary" | "primary-soft" | "success" | "danger" | "warning" | Token used for the highlight, mixed with transparency so the text stays readable. |
active | boolean | false | Highlight state for trigger manual. |
once | boolean | true | trigger view: draw once, or clear again when the text leaves the viewport. |
threshold | number | 0.5 | trigger view: how much of the text must be visible, from 0 to 1. |
duration | number | 700 | Milliseconds the highlight takes to draw. |
delay | number | 0 | Milliseconds to wait before drawing. Use rising delays to highlight a paragraph in order. |
More animations components with the same classes in every framework.
MarkasUI is free and open source. A coffee keeps it going.
Coffee Rp 25.000 + QRIS service fee Rp 479 = total Rp 25.479
Buy me a coffeePreparing your experience
Switching to English
Menyiapkan tampilan
Beralih ke Bahasa Indonesia