Components
Affix
A nail: the wrapped content travels with the page until it reaches its offset, then stays put while the page moves on. The semantics are plain `position: sticky` — pinning is relative to the nearest *scrolling* ancestor, so the element works inside a scrollable panel exactly as it does on the page itself, and a parent with `overflow: hidden` clips the pin. Both offsets may be given: the content then holds its place inside that band.
#Basic usage
Passage 1 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 2 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 3 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 4 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 5 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 6 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 7 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 8 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 9 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 10 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 11 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 12 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 13 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 14 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 15 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
Passage 16 — the tools travel with the reader: once their row reaches the top of the page it stays there while the chapters move on underneath.
<script setup lang="ts">
import { Affix } from "@bysages/vue";
const passages = 16;
</script>
<template>
<div class="w-full">
<Affix>
<div
class="flex gap-3 items-center px-4 py-3 bg-surface-1 border border-border rounded-sm text-sm tracking-label"
>
<strong>Reading tools</strong>
<span class="text-tertiary">·</span>
<span>Contents</span>
<span>Print</span>
<span>Share</span>
</div>
</Affix>
<div class="pt-4">
<p v-for="n in passages" :key="n" class="leading-relaxed text-secondary">
Passage {{ n }} — the tools travel with the reader: once their row reaches the top of the
page it stays there while the chapters move on underneath.
</p>
</div>
</div>
</template>
Passage 1 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 2 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 3 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 4 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 5 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 6 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 7 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 8 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 9 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 10 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 11 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 12 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 13 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 14 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 15 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
Passage 16 — with both offsets given, the row holds its place inside the band between them: clear of the header, clear of the page's end.
<script setup lang="ts">
import { Affix } from "@bysages/vue";
const passages = 16;
</script>
<template>
<div class="w-full">
<Affix offset-top="var(--bs-space-12)" offset-bottom="var(--bs-space-4)">
<div
class="flex gap-3 items-center px-4 py-3 bg-surface-1 border border-border rounded-sm text-sm tracking-label"
>
<strong>Reading tools</strong>
<span class="text-tertiary">·</span>
<span>Contents</span>
<span>Print</span>
<span>Share</span>
</div>
</Affix>
<div class="pt-4">
<p v-for="n in passages" :key="n" class="leading-relaxed text-secondary">
Passage {{ n }} — with both offsets given, the row holds its place inside the band between
them: clear of the header, clear of the page's end.
</p>
</div>
</div>
</template>
#Props
#Affix
A nail: the wrapped content travels with the page until it reaches its
offset, then stays put while the page moves on. The semantics are
plain position: sticky — pinning is relative to the nearest
scrolling ancestor, so the element works inside a scrollable panel
exactly as it does on the page itself, and a parent with
overflow: hidden clips the pin. Both offsets may be given: the
content then holds its place inside that band.
| Prop | Type | Default | Description |
|---|---|---|---|
offsetTop | String | "0px" | — |
offsetBottom | String | "0px" | — |