Gå til indholdet
NAVIGATION · FREE

Anchor

Anchor er en del af RayCraft Free.

Eksempel

<div style="display:flex;align-items:flex-start;gap:1.5rem">
    <div style="flex:1;min-width:0">
        @foreach (var section in new[] { "Intro", "Setup", "Usage", "Extras" })
        {
            <h3 id="anchor-@section.ToLowerInvariant()">@section</h3>
            <p style="min-height:9rem">Text of the @section section. Scroll the page: the matching link is highlighted.</p>
        }
    </div>
    <Anchor Links="_links" Offset="120" />
</div>

@code {
    private readonly AnchorLink[] _links =
    [
        new("anchor-intro", "Introduction"),
        new("anchor-setup", "Setup"),
        new("anchor-usage", "Usage", [new("anchor-extras", "Extras")])
    ];
}

Et kort uddrag. Tilføj @using RayCraft.Blazor.Components til din side, og brug en interaktiv gengivelsestilstand.

Inkluderet i RayCraft Free. Fungerende eksempler findes i GitHub-lager (MIT); det indeholder eksempel- og demokode, ikke bibliotekets kode.

Alle kontroller ยท Dokumentation