Skip to content
Effects

Highlight

A marker stroke that draws itself across the text.

import
import { Highlight } from '@joshicodes/cock';

Marker

Size isn't everything. It's what you do with it that counts.

Behaviour

  • Survives a line break, because the stroke is a background rather than a box.
  • Skips straight to the final state when the visitor has reduced motion turned on.

API

Read out of the component sources at build time, so it matches the version you installed. Every component also takes class, merged through tailwind-merge so your utility wins.

Props of Highlight

PropTypeDefault
variant

A broad marker stroke behind the text, or a line under it.

'marker' | 'underline''marker'
color

Any CSS colour. Defaults to a translucent accent.

string—
duration
number800
delay
number0
trigger

Draw once the text is on screen, or straight away.

'visible' | 'mount''visible'
class
string—

Snippets of Highlight

SnippetTypeDefault
children required
Snippet—

See also

cock. Yes, it stands for core component kit. We checked twice.