Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Variable Weight Text

    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

    Proximity

    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>
    import { VariableWeightText } from "@/components/markas/VariableWeightText";
    
    export default function VariableWeightTextExample() {
      return (
        <div className="text-center">
          <p className="text-6xl tracking-tight text-ink">
            <VariableWeightText text="Proximity" />
          </p>
          <p className="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>
    import { Component } from "@angular/core";
    import { VariableWeightText } from "./markas/variable-weight-text.component";
    
    @Component({
      selector: "markas-example",
      imports: [VariableWeightText],
      template: `
        <div class="text-center">
          <p class="text-6xl tracking-tight text-ink">
            <span markas-variable-weight-text text="Proximity"></span>
          </p>
          <p class="mt-3 text-sm text-muted">Move your cursor across the letters</p>
        </div>
      `,
    })
    export default class VariableWeightTextExample {}

    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.

    Breathing wave

    Breathe in, breathe out

    Breathe in, breathe out

    Breathe in, breathe out

    Breathe in, breathe out

    Breathe in, breathe out

    Footer wordmark

    Made in Bandung 2026

    markasui

    Made in Bandung2026

    markasui

    Made in Bandung2026

    markasui

    Made in Bandung 2026

    markasui

    Made in Bandung2026

    markasui

    Installation

    npx markasui@latest add variable-weight-text

    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 wght axis, 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' n and font-weight as a fallback. The letter under the cursor gets max; letters outside radius fall back to min, which is also the resting weight.
    • wave runs 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

    NameTypeDefaultDescription
    textstring-The text. Screen readers read it once as a whole.
    radiusnumber120Distance in pixels from the cursor within which letters get bolder.
    minnumber300Weight at rest and outside the radius.
    maxnumber800Weight of the letter right under the cursor.
    wavebooleanfalseWhen 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.