Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Elastic Line

    SVG line that bends toward, away from, or with the pointer when it comes close, then springs back. Works as a divider or a heading underline.

    Release 2.4

    Stacking cards, pixel trails, and a faster CLI.

    Release 2.3

    Indonesian docs and Rupiah currency input.

    Release 2.4

    Stacking cards, pixel trails, and a faster CLI.

    Release 2.3

    Indonesian docs and Rupiah currency input.

    Release 2.4

    Stacking cards, pixel trails, and a faster CLI.

    Release 2.3

    Indonesian docs and Rupiah currency input.

    Release 2.4

    Stacking cards, pixel trails, and a faster CLI.

    Release 2.3

    Indonesian docs and Rupiah currency input.

    Release 2.4

    Stacking cards, pixel trails, and a faster CLI.

    Release 2.3

    Indonesian docs and Rupiah currency input.

    @php
        $wrap = 'grid rounded-xl border border-line bg-surface px-6 py-4';
        $section = 'py-2';
        $title = 'text-base font-semibold text-ink';
        $text = 'mt-1 text-sm text-muted';
    @endphp
    
    <div class="{{ $wrap }}">
        <section class="{{ $section }}">
            <h3 class="{{ $title }}">Release 2.4</h3>
            <p class="{{ $text }}">Stacking cards, pixel trails, and a faster CLI.</p>
        </section>
        <x-markas.elastic-line />
        <section class="{{ $section }}">
            <h3 class="{{ $title }}">Release 2.3</h3>
            <p class="{{ $text }}">Indonesian docs and Rupiah currency input.</p>
        </section>
    </div>
    import { ElasticLine } from "@/components/markas/ElasticLine";
    
    const wrap = "grid rounded-xl border border-line bg-surface px-6 py-4";
    const section = "py-2";
    const title = "text-base font-semibold text-ink";
    const text = "mt-1 text-sm text-muted";
    
    export default function ElasticLineExample() {
      return (
        <div className={wrap}>
          <section className={section}>
            <h3 className={title}>Release 2.4</h3>
            <p className={text}>Stacking cards, pixel trails, and a faster CLI.</p>
          </section>
          <ElasticLine />
          <section className={section}>
            <h3 className={title}>Release 2.3</h3>
            <p className={text}>Indonesian docs and Rupiah currency input.</p>
          </section>
        </div>
      );
    }
    <script setup lang="ts">
    import ElasticLine from "@/components/markas/ElasticLine.vue";
    
    const wrap = "grid rounded-xl border border-line bg-surface px-6 py-4";
    const section = "py-2";
    const title = "text-base font-semibold text-ink";
    const text = "mt-1 text-sm text-muted";
    </script>
    
    <template>
      <div :class="wrap">
        <section :class="section">
          <h3 :class="title">Release 2.4</h3>
          <p :class="text">Stacking cards, pixel trails, and a faster CLI.</p>
        </section>
        <ElasticLine />
        <section :class="section">
          <h3 :class="title">Release 2.3</h3>
          <p :class="text">Indonesian docs and Rupiah currency input.</p>
        </section>
      </div>
    </template>
    <script lang="ts">
      import ElasticLine from "$lib/components/markas/ElasticLine.svelte";
    
      const wrap = "grid rounded-xl border border-line bg-surface px-6 py-4";
      const section = "py-2";
      const title = "text-base font-semibold text-ink";
      const text = "mt-1 text-sm text-muted";
    </script>
    
    <div class={wrap}>
      <section class={section}>
        <h3 class={title}>Release 2.4</h3>
        <p class={text}>Stacking cards, pixel trails, and a faster CLI.</p>
      </section>
      <ElasticLine />
      <section class={section}>
        <h3 class={title}>Release 2.3</h3>
        <p class={text}>Indonesian docs and Rupiah currency input.</p>
      </section>
    </div>
    ---
    import ElasticLine from "@/components/markas/ElasticLine.astro";
    
    const wrap = "grid rounded-xl border border-line bg-surface px-6 py-4";
    const section = "py-2";
    const title = "text-base font-semibold text-ink";
    const text = "mt-1 text-sm text-muted";
    ---
    
    <div class={wrap}>
      <section class={section}>
        <h3 class={title}>Release 2.4</h3>
        <p class={text}>Stacking cards, pixel trails, and a faster CLI.</p>
      </section>
      <ElasticLine />
      <section class={section}>
        <h3 class={title}>Release 2.3</h3>
        <p class={text}>Indonesian docs and Rupiah currency input.</p>
      </section>
    </div>
    import { Component } from "@angular/core";
    import { ElasticLine } from "./markas/elastic-line.component";
    
    @Component({
      selector: "markas-example",
      imports: [ElasticLine],
      template: `
        <div [class]="wrap">
          <section [class]="section">
            <h3 [class]="title">Release 2.4</h3>
            <p [class]="text">Stacking cards, pixel trails, and a faster CLI.</p>
          </section>
          <markas-elastic-line />
          <section [class]="section">
            <h3 [class]="title">Release 2.3</h3>
            <p [class]="text">Indonesian docs and Rupiah currency input.</p>
          </section>
        </div>
      `,
    })
    export default class ElasticLineExample {
      protected readonly wrap =
        "grid rounded-xl border border-line bg-surface px-6 py-4";
      protected readonly section = "py-2";
      protected readonly title = "text-base font-semibold text-ink";
      protected readonly text = "mt-1 text-sm text-muted";
    }

    Examples

    Plucked underline under a heading

    New in Markas

    Build faster, ship calmer

    Touch the underline and pull: it slips free and vibrates like a string.

    New in Markas

    Build faster, ship calmer

    Touch the underline and pull: it slips free and vibrates like a string.

    New in Markas

    Build faster, ship calmer

    Touch the underline and pull: it slips free and vibrates like a string.

    New in Markas

    Build faster, ship calmer

    Touch the underline and pull: it slips free and vibrates like a string.

    New in Markas

    Build faster, ship calmer

    Touch the underline and pull: it slips free and vibrates like a string.

    Vertical dividers between stats

    61

    Components

    3

    Frameworks

    12k

    Weekly installs

    61

    Components

    3

    Frameworks

    12k

    Weekly installs

    61

    Components

    3

    Frameworks

    12k

    Weekly installs

    61

    Components

    3

    Frameworks

    12k

    Weekly installs

    61

    Components

    3

    Frameworks

    12k

    Weekly installs

    Footer divider

    Installation

    npx markasui@latest add elastic-line

    Usage

    <h2 class="text-3xl font-semibold">Our services</h2>
    <x-markas.elastic-line variant="pluck" color="primary" :stroke-width="3" :reach="16" play-on-view decorative class="w-40" />
    
    <x-markas.elastic-line variant="push" :reach="32" />

    Needs Alpine.js.

    import { ElasticLine } from "@/components/markas/ElasticLine";
    
    <h2 className="text-3xl font-semibold">Our services</h2>
    <ElasticLine
      variant="pluck"
      color="primary"
      strokeWidth={3}
      reach={16}
      playOnView
      decorative
      className="w-40"
    />
    
    <ElasticLine variant="push" reach={32} />
    <template>
      <h2 class="text-3xl font-semibold">Our services</h2>
      <ElasticLine
        variant="pluck"
        color="primary"
        :stroke-width="3"
        :reach="16"
        play-on-view
        decorative
        class="w-40"
      />
    
      <ElasticLine variant="push" :reach="32" />
    </template>
    <script lang="ts">
      import ElasticLine from "$lib/components/markas/ElasticLine.svelte";
    </script>
    
    <h2 class="text-3xl font-semibold">Our services</h2>
    <ElasticLine
      variant="pluck"
      color="primary"
      strokeWidth={3}
      reach={16}
      playOnView
      decorative
      class="w-40"
    />
    ---
    import ElasticLine from "@/components/markas/ElasticLine.astro";
    ---
    
    <h2 class="text-3xl font-semibold">Our services</h2>
    <ElasticLine
      variant="pluck"
      color="primary"
      strokeWidth={3}
      reach={16}
      playOnView
      decorative
      class="w-40"
    />

    Each line is a small custom element that runs its own spring, also after view transitions.

    import { Component } from "@angular/core";
    import { ElasticLine } from "./markas/elastic-line.component";
    
    @Component({
      selector: "app-services-heading",
      imports: [ElasticLine],
      template: `
        <h2 class="text-3xl font-semibold">Our services</h2>
        <markas-elastic-line
          variant="pluck"
          color="primary"
          [strokeWidth]="3"
          [reach]="16"
          playOnView
          decorative
          class="w-40"
        />
      `,
    })
    export class ServicesHeading {}
    • The component is reach x 2 tall (or wide when vertical) and the line runs through its middle. The pointer bends it only inside that band.
    • pull bends toward the pointer, push away from it, and pluck follows the pointer once touched until it slips free and vibrates.
    • The curve is one quadratic SVG path. requestAnimationFrame only runs while the pointer is close or the line still moves. playOnView twangs it once when it first scrolls into view.
    • By default it is a separator. Use decorative for underlines. With reduced motion the line stays straight. Attributes and class go to the wrapper.

    Props

    NameTypeDefaultDescription
    variant"pull" | "push" | "pluck""pull"pull: the line bends toward the pointer. push: it bends away like a soft wall. pluck: it follows the pointer once touched, slips free, and vibrates.
    orientation"horizontal" | "vertical""horizontal"Direction of the line. A vertical line stretches to the height of its flex row.
    reachnumber24Px on each side of the line where the pointer bends it. Also the most it can bend. The component is twice this tall (or wide).
    color"line" | "muted" | "ink" | "primary" | "success" | "warning" | "danger""line"Line color token.
    strokeWidthnumber1.5Line width in px. It stays the same however wide the line is.
    playOnViewbooleanfalseTwangs once when the line first scrolls into view.
    decorativebooleanfalseHides the line from assistive tech, for underlines and ornaments. Otherwise it is announced as a separator.

    Accessibility

    • By default the line has role="separator" with aria-orientation; use decorative for underlines so it is hidden instead.
    • The bend is drawn by changing one SVG path; requestAnimationFrame only runs while the pointer is close or the line still moves.
    • With reduced motion the line stays straight and never twangs.

    Related components

    More markasui components with the same classes in every framework.