Exemple
<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")])
];
} Un court fragment. Ajoutez @using RayCraft.Blazor.Components à votre page et utilisez un mode de rendu interactif.
Inclus dans RayCraft Free. Des exemples fonctionnels se trouvent dans le dépôt GitHub (MIT); il contient du code d’exemple et de démonstration, pas le code de la bibliothèque.