Text whose letters get bolder as the cursor gets closer, using the wght axis of a variable font. Optional wave that breathes when idle.
Proximity
Move your cursor across the letters
Proximity
Move your cursor across the letters
Proximity
Move your cursor across the letters
Proximity
Move your cursor across the letters
Move your cursor across the letters
<div class="text-center">
<p class="text-6xl tracking-tight text-ink">
<x-markas.variable-weight-text text="Proximity" />
</p>
<p class="mt-3 text-sm text-muted">Move your cursor across the letters</p>
</div><script setup lang="ts">
import VariableWeightText from "@/components/markas/VariableWeightText.vue";
</script>
<template>
<div class="text-center">
<p class="text-6xl tracking-tight text-ink">
<VariableWeightText text="Proximity" />
</p>
<p class="mt-3 text-sm text-muted">Move your cursor across the letters</p>
</div>
</template><script lang="ts">
import VariableWeightText from "$lib/components/markas/VariableWeightText.svelte";
</script>
<div class="text-center">
<p class="text-6xl tracking-tight text-ink">
<VariableWeightText text="Proximity" />
</p>
<p class="mt-3 text-sm text-muted">Move your cursor across the letters</p>
</div>---
import VariableWeightText from "@/components/markas/VariableWeightText.astro";
---
<div class="text-center">
<p class="text-6xl tracking-tight text-ink">
<VariableWeightText text="Proximity" />
</p>
<p class="mt-3 text-sm text-muted">Move your cursor across the letters</p>
</div>Examples
Hero word
Type that reacts
Letters near the cursor get bolder. Works with any variable font that has a weight axis.
Type that reacts
Letters near the cursor get bolder. Works with any variable font that has a weight axis.
Type that reacts
Letters near the cursor get bolder. Works with any variable font that has a weight axis.
Type that reacts
Letters near the cursor get bolder. Works with any variable font that has a weight axis.
Type that reacts
Letters near the cursor get bolder. Works with any variable font that has a weight axis.
<div class="py-4">
<h2 class="text-5xl tracking-tight text-ink">
Type that <x-markas.variable-weight-text text="reacts" :radius="80" :min="300" :max="900" />
</h2>
<p class="mt-4 max-w-sm text-sm text-muted">Letters near the cursor get bolder. Works with any variable font that has a weight axis.</p>
</div>Breathing wave
Breathe in, breathe out
Breathe in, breathe out
Breathe in, breathe out
Breathe in, breathe out
<div class="text-center">
<p class="text-5xl tracking-tight text-ink">
<x-markas.variable-weight-text text="Breathe in, breathe out" wave :min="200" :max="700" />
</p>
</div>Footer wordmark
<footer class="rounded-xl bg-primary px-6 pt-6 pb-2 text-on-primary">
<div class="flex justify-between text-sm">
<span>Made in Bandung</span>
<span>2026</span>
</div>
<p class="mt-4 text-7xl leading-none tracking-tighter">
<x-markas.variable-weight-text text="markasui" wave :min="100" :max="900" :radius="100" />
</p>
</footer>Installation
npx markasui@latest add variable-weight-textpnpm dlx markasui@latest add variable-weight-textyarn dlx markasui@latest add variable-weight-textbunx --bun markasui@latest add variable-weight-text- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Install the dependency:
npm install alpinejs - Copy the component source below to
resources/views/components/markas/variable-weight-text.blade.php.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/VariableWeightText.tsx.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/VariableWeightText.vue.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/VariableWeightText.svelte.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/VariableWeightText.astro.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/variable-weight-text.component.ts.
Usage
<p class="text-6xl">
<x-markas.variable-weight-text text="Proximity" :radius="100" :min="200" :max="900" />
</p>
<x-markas.variable-weight-text text="markasui" wave class="text-7xl" />import { VariableWeightText } from "@/components/markas/VariableWeightText";
<p className="text-6xl">
<VariableWeightText text="Proximity" radius={100} min={200} max={900} />
</p>
<VariableWeightText text="markasui" wave className="text-7xl" /><template>
<p class="text-6xl">
<VariableWeightText text="Proximity" :radius="100" :min="200" :max="900" />
</p>
<VariableWeightText text="markasui" wave class="text-7xl" />
</template><script lang="ts">
import VariableWeightText from "$lib/components/markas/VariableWeightText.svelte";
</script>
<p class="text-6xl">
<VariableWeightText text="Proximity" radius={100} min={200} max={900} />
</p>
<VariableWeightText text="markasui" wave class="text-7xl" />---
import VariableWeightText from "@/components/markas/VariableWeightText.astro";
---
<p class="text-6xl">
<VariableWeightText text="Proximity" radius={100} min={200} max={900} />
</p>
<VariableWeightText text="markasui" wave class="text-7xl" />import { Component } from "@angular/core";
import { VariableWeightText } from "./markas/variable-weight-text.component";
@Component({
selector: "app-wordmark",
imports: [VariableWeightText],
template: `
<p class="text-6xl">
<span
markas-variable-weight-text
text="Proximity"
radius="100"
min="200"
max="900"
></span>
</p>
<span
markas-variable-weight-text
text="markasui"
wave
class="text-7xl"
></span>
`,
})
export class Wordmark {}Angular uses an attribute selector on a span: <span markas-variable-weight-text>.
- Needs a variable font with a
wghtaxis, such as Inter, Geist, Recursive, or the system font on macOS and iOS. With a static font, the weight jumps between the weights you load. - Each letter sets
font-variation-settings: 'wght' nandfont-weightas a fallback. The letter under the cursor getsmax; letters outsideradiusfall back tomin, which is also the resting weight. waveruns a breathing weight wave while the cursor is away. It stops when the text is off screen and when the tab is hidden.- Screen readers hear the text once. With reduced motion, letters stay at
min. The Blade version needs Alpine.js.
Props
| Name | Type | Default | Description |
|---|---|---|---|
text | string | - | The text. Screen readers read it once as a whole. |
radius | number | 120 | Distance in pixels from the cursor within which letters get bolder. |
min | number | 300 | Weight at rest and outside the radius. |
max | number | 800 | Weight of the letter right under the cursor. |
wave | boolean | false | When the cursor is away, a weight wave runs through the letters. It stops off screen. |
Accessibility
- Screen readers read the whole text once from a visually hidden copy; the letter spans are aria-hidden.
- The effect is decorative and needs no interaction; the text stays readable at every weight.
- With reduced motion, the letters stay at the min weight and the wave does not run.
Related components
More animations components with the same classes in every framework.
- Avatar GroupOverlapping stack of avatars that spreads out on hover, shows each name in a tooltip, and collapses extra people into a +N chip.
- Letter SwapText whose letters slide out and back in with a stagger when its link or button is hovered or focused. Forward, ping-pong, or shuffled order.
- MarqueeEndless horizontal or vertical scroll of any content, with faded edges, reverse direction, and a pause on hover or focus.
- Number TickerNumber that counts up to its value when it scrolls into view, with thousands separators, decimals, and a prefix or suffix.
- Scroll ProgressThin bar at the top of the page or a scrolling container that fills as the reader scrolls.
- Spotlight CardCard with a soft radial light that follows the pointer and a border that glows near it. Lights up on keyboard focus too.