Outline to fill
An outline title that fills from the bottom on hover or on entering view: the under-layer strokes with text-stroke while the top layer climbs up through clip-path — once as a gradient, once as a checkered pattern; a two-dot switch swaps them mid-scene.
Real scenarios
The component as it is used in a product — not a specimen grid.
Words that earn their ink
The outline is the resting state — text-stroke over transparent ink. Hover fills a word from the bottom through a clip-path wipe, and the tier cards below fill themselves once as they scroll into view. The two-dot switch trades the gradient body for a checkered one.
FJORD CLOUD · NOW LIVE
FRANKFURTHover the word — the wipe climbs from the baseline.
Sub-50ms responses across the EU edge
99.99% uptimeUp to 248 cores a region, no ticket needed
Dublin · SingaporeEncryption at rest and in transit, on by default
SOC 2 Type IIImportant props
| Prop | Type | Default | What it does |
|---|---|---|---|
| -webkit-text-stroke | length | '1.5px' | The under-layer’s stroke; its colour pairs with transparent text so only the glyph outlines stay. |
| clip-path | inset | '100% 0 0 0 → 0' | Filling from the bottom: the filled layer sits over the outline and climbs from inset(100% 0 0 0) to inset(0) in .7s. |
| trigger | behaviour | 'hover · in-view' | Hover fills instantly; entering view fills too, through an IntersectionObserver (35% threshold, once) that disconnects itself — cleaned up with $cleanup. |
| fill | attribute | 'gradient' | Two fill bodies via data-fill on the root: a two-colour gradient, or a checkerboard built from repeating-conic-gradient — both clipped to the glyphs. |
| reduced-motion | media | 'instant' | Under prefers-reduced-motion the clip-path transition drops out and the fill lands complete in the same instant. |
Snippet
<div class="otl" x-data="{ fill: 'gradient' }" x-bind:data-fill="fill"
x-init="
const io = new IntersectionObserver((entries) => entries.forEach((entry) => {
if (entry.isIntersecting) { entry.target.dataset.in = 'true'; io.unobserve(entry.target); }
}), { threshold: 0.35 });
$el.querySelectorAll('.otl-word').forEach((w) => io.observe(w));
$cleanup(() => io.disconnect());
">
<div class="otl-switch" role="group" aria-label="Fill body">
<button type="button" x-bind:aria-pressed="fill === 'gradient' ? 'true' : 'false'" x-on:click="fill = 'gradient'">Gradient</button>
<button type="button" x-bind:aria-pressed="fill === 'pattern' ? 'true' : 'false'" x-on:click="fill = 'pattern'">Pattern</button>
</div>
@foreach ([['SPEED', 'Sub-50ms responses'], ['SCALE', 'Up to 248 cores a region'], ['TRUST', 'Encryption on by default']] as [$word, $copy])
<div class="otl-card">
<span class="otl-word"><span class="otl-ghost">{{ $word }}</span>
<span class="otl-fill" aria-hidden="true">{{ $word }}</span></span>
<p>{{ $copy }}</p>
</div>
@endforeach
</div>
<style>
.otl { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.otl-word { position: relative; display: inline-block; font-weight: 900;
font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1.1; }
.otl-ghost { color: transparent; -webkit-text-stroke: 1.5px #a8a29e; }
.otl-fill { position: absolute; inset-block-start: 0; inset-inline-start: 0;
background-clip: text; -webkit-background-clip: text; color: transparent;
clip-path: inset(100% 0 0 0); transition: clip-path .7s cubic-bezier(.4, 0, .2, 1); }
.otl[data-fill='gradient'] .otl-fill { background: linear-gradient(15deg, #7c3aed, #22d3ee); }
.otl[data-fill='pattern'] .otl-fill {
background: repeating-conic-gradient(#7c3aed 0 25%, #ede9fe 0 50%) 0 0 / 14px 14px; }
.otl-word:hover .otl-fill, .otl-word[data-in='true'] .otl-fill { clip-path: inset(0); }
@media (prefers-reduced-motion: reduce) { .otl-fill { transition: none; } }
</style>
// app/Pages/Platforms.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import OutlineFill from '@/components/OutlineFill';
export default function Platforms() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<OutlineFill />
</main>
</NabuXUIProvider>
);
}
// OutlineFill.jsx — an outline title that fills from the bottom
import { useEffect, useRef, useState } from 'react';
import '@nabuxai/ui-core/css';
const WORDS = [
{ id: 'speed', word: 'SPEED', copy: 'Sub-50ms responses' },
{ id: 'scale', word: 'SCALE', copy: 'Up to 248 cores a region' },
{ id: 'trust', word: 'TRUST', copy: 'Encryption on by default' },
];
export default function OutlineFill() {
const [fill, setFill] = useState<'gradient' | 'pattern'>('gradient');
const rootRef = useRef<HTMLDivElement>(null);
// Words fill themselves once, the first time 35% of them is visible.
useEffect(() => {
const io = new IntersectionObserver(
(entries) => entries.forEach((e) => {
if (e.isIntersecting) { (e.target as HTMLElement).dataset.in = 'true'; io.unobserve(e.target); }
}),
{ threshold: 0.35 },
);
rootRef.current?.querySelectorAll('.otl-word').forEach((w) => io.observe(w));
return () => io.disconnect();
}, []);
return (
<>
<style>{`
.otl { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.otl-switch { display: inline-flex; gap: .4rem; }
.otl-switch button { padding: .35rem .9rem; border: 1px solid #e7e5e4; border-radius: 999px;
background: transparent; cursor: pointer; font-size: .8rem; }
.otl-switch button[aria-pressed='true'] { border-color: #7c3aed; color: #7c3aed; }
.otl-word { position: relative; display: inline-block; font-weight: 900;
font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1.1; }
.otl-ghost { color: transparent; -webkit-text-stroke: 1.5px #a8a29e; }
.otl-fill { position: absolute; inset-block-start: 0; inset-inline-start: 0;
background-clip: text; -webkit-background-clip: text; color: transparent;
clip-path: inset(100% 0 0 0); transition: clip-path .7s cubic-bezier(.4, 0, .2, 1); }
.otl[data-fill='gradient'] .otl-fill { background: linear-gradient(15deg, #7c3aed, #22d3ee); }
.otl[data-fill='pattern'] .otl-fill {
background: repeating-conic-gradient(#7c3aed 0 25%, #ede9fe 0 50%) 0 0 / 14px 14px; }
.otl-word:hover .otl-fill, .otl-word[data-in='true'] .otl-fill { clip-path: inset(0); }
@media (prefers-reduced-motion: reduce) { .otl-fill { transition: none; } }
`}</style>
<div className="otl" data-fill={fill} ref={rootRef}>
<div className="otl-switch" role="group" aria-label="Fill body">
<button type="button" aria-pressed={fill === 'gradient'} onClick={() => setFill('gradient')}>Gradient</button>
<button type="button" aria-pressed={fill === 'pattern'} onClick={() => setFill('pattern')}>Pattern</button>
</div>
{WORDS.map((w) => (
<div className="otl-card" key={w.id}>
<span className="otl-word">
<span className="otl-ghost">{w.word}</span>
<span className="otl-fill" aria-hidden="true">{w.word}</span>
</span>
<p>{w.copy}</p>
</div>
))}
</div>
</>
);
}
<!-- OutlineFill.vue — an outline title that fills from the bottom -->
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue';
import '@nabuxai/ui-core/css';
const words = [
{ id: 'speed', word: 'SPEED', copy: 'Sub-50ms responses' },
{ id: 'scale', word: 'SCALE', copy: 'Up to 248 cores a region' },
{ id: 'trust', word: 'TRUST', copy: 'Encryption on by default' },
];
const fill = ref<'gradient' | 'pattern'>('gradient');
const root = ref<HTMLElement | null>(null);
let io: IntersectionObserver | null = null;
onMounted(() => {
io = new IntersectionObserver(
(entries) => entries.forEach((e) => {
if (e.isIntersecting) { (e.target as HTMLElement).dataset.in = 'true'; io!.unobserve(e.target); }
}),
{ threshold: 0.35 },
);
root.value?.querySelectorAll('.otl-word').forEach((w) => io!.observe(w));
});
onBeforeUnmount(() => io?.disconnect());
</script>
<template>
<div ref="root" class="otl" :data-fill="fill">
<div class="otl-switch" role="group" aria-label="Fill body">
<button type="button" :aria-pressed="fill === 'gradient'" @click="fill = 'gradient'">Gradient</button>
<button type="button" :aria-pressed="fill === 'pattern'" @click="fill = 'pattern'">Pattern</button>
</div>
<div v-for="w in words" :key="w.id" class="otl-card">
<span class="otl-word">
<span class="otl-ghost">{{ w.word }}</span>
<span class="otl-fill" aria-hidden="true">{{ w.word }}</span>
</span>
<p>{{ w.copy }}</p>
</div>
</div>
</template>
<style scoped>
.otl { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.otl-switch { display: inline-flex; gap: .4rem; grid-column: 1 / -1; }
.otl-switch button { padding: .35rem .9rem; border: 1px solid #e7e5e4; border-radius: 999px;
background: transparent; cursor: pointer; font-size: .8rem; }
.otl-switch button[aria-pressed='true'] { border-color: #7c3aed; color: #7c3aed; }
.otl-word { position: relative; display: inline-block; font-weight: 900;
font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1.1; }
.otl-ghost { color: transparent; -webkit-text-stroke: 1.5px #a8a29e; }
.otl-fill { position: absolute; inset-block-start: 0; inset-inline-start: 0;
background-clip: text; -webkit-background-clip: text; color: transparent;
clip-path: inset(100% 0 0 0); transition: clip-path .7s cubic-bezier(.4, 0, .2, 1); }
.otl[data-fill='gradient'] .otl-fill { background: linear-gradient(15deg, #7c3aed, #22d3ee); }
.otl[data-fill='pattern'] .otl-fill {
background: repeating-conic-gradient(#7c3aed 0 25%, #ede9fe 0 50%) 0 0 / 14px 14px; }
.otl-word:hover .otl-fill, .otl-word[data-in='true'] .otl-fill { clip-path: inset(0); }
@media (prefers-reduced-motion: reduce) { .otl-fill { transition: none; } }
</style>
<!-- OutlineFill.svelte — an outline title that fills from the bottom -->
<script lang="ts">
import { onMount } from 'svelte';
import '@nabuxai/ui-core/css';
const words = [
{ id: 'speed', word: 'SPEED', copy: 'Sub-50ms responses' },
{ id: 'scale', word: 'SCALE', copy: 'Up to 248 cores a region' },
{ id: 'trust', word: 'TRUST', copy: 'Encryption on by default' },
];
let fill = $state<'gradient' | 'pattern'>('gradient');
let root: HTMLElement;
onMount(() => {
const io = new IntersectionObserver(
(entries) => entries.forEach((e) => {
if (e.isIntersecting) { (e.target as HTMLElement).dataset.in = 'true'; io.unobserve(e.target); }
}),
{ threshold: 0.35 },
);
root.querySelectorAll('.otl-word').forEach((w) => io.observe(w));
return () => io.disconnect();
});
</script>
<div bind:this={root} class="otl" data-fill={fill}>
<div class="otl-switch" role="group" aria-label="Fill body">
<button type="button" aria-pressed={fill === 'gradient'} onclick={() => (fill = 'gradient')}>Gradient</button>
<button type="button" aria-pressed={fill === 'pattern'} onclick={() => (fill = 'pattern')}>Pattern</button>
</div>
{#each words as w (w.id)}
<div class="otl-card">
<span class="otl-word">
<span class="otl-ghost">{w.word}</span>
<span class="otl-fill" aria-hidden="true">{w.word}</span>
</span>
<p>{w.copy}</p>
</div>
{/each}
</div>
<style>
.otl { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.otl-switch { display: inline-flex; gap: .4rem; grid-column: 1 / -1; }
.otl-switch button { padding: .35rem .9rem; border: 1px solid #e7e5e4; border-radius: 999px;
background: transparent; cursor: pointer; font-size: .8rem; }
.otl-switch button[aria-pressed='true'] { border-color: #7c3aed; color: #7c3aed; }
.otl-word { position: relative; display: inline-block; font-weight: 900;
font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1.1; }
.otl-ghost { color: transparent; -webkit-text-stroke: 1.5px #a8a29e; }
.otl-fill { position: absolute; inset-block-start: 0; inset-inline-start: 0;
background-clip: text; -webkit-background-clip: text; color: transparent;
clip-path: inset(100% 0 0 0); transition: clip-path .7s cubic-bezier(.4, 0, .2, 1); }
.otl[data-fill='gradient'] .otl-fill { background: linear-gradient(15deg, #7c3aed, #22d3ee); }
.otl[data-fill='pattern'] .otl-fill {
background: repeating-conic-gradient(#7c3aed 0 25%, #ede9fe 0 50%) 0 0 / 14px 14px; }
.otl-word:hover .otl-fill, .otl-word[data-in='true'] .otl-fill { clip-path: inset(0); }
@media (prefers-reduced-motion: reduce) { .otl-fill { transition: none; } }
</style>