ViewHeightScrollable

Layout

Provides scrollable content area that scrolls through physical lines of any content. Has all functionalities of default Scrollable.

@using RazorConsole.Components
@using Spectre.Console
@using Markup = RazorConsole.Components.Markup
@using Panel = RazorConsole.Components.Panel

<Markup Content="Use tab to change focus and arrow up/down + num keys to scroll"/>
<Newline/>
<ViewHeightScrollable Scrollbar="new()" LinesToRender="10">
    <Panel Title="View Height scrollable with some markdown content" Border="BoxBorder.Rounded">
        <Markdown Content="@_largeText"/>
    </Panel>
</ViewHeightScrollable>


@code {
    private readonly string _largeText =@"
#### Counter.razor
```razor
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using RazorConsole.Components

<Columns>
    <p>Current count</p>
    <Markup Content=""@currentCount.ToString()"" Foreground=""@Spectre.Console.Color.Green"" />
</Columns>
<TextButton Content=""Click me""
            OnClick=""IncrementCount""
            BackgroundColor=""@Spectre.Console.Color.Grey""
            FocusedColor=""@Spectre.Console.Color.Blue"" />


@code {
    private int currentCount = 0;
    private void IncrementCount()
    {
        currentCount++;
    }
}
```

#### Program.cs
```csharp
using Microsoft.Extensions.Hosting;
using RazorConsole.Core;

IHostBuilder hostBuilder = Host.CreateDefaultBuilder(args)
    .UseRazorConsole<Counter>();
IHost host = hostBuilder.Build();
await host.RunAsync();
```
".Trim();

}

Parameters

6
NameTypeDefaultDescription
Events
ScrollOffsetChangedEventCallback<Int32>Event callback invoked when the scroll offset changes.
Common
ChildContentRenderFragment<ScrollContext>
Other
IsScrollbarEmbeddedBooleanFlag that determines will scrollbar be embedded or not.
LinesToRenderInt32Number of lines visible at one time.
ScrollOffsetInt32Current scroll offset (index of the first visible line).
ScrollbarScrollbarSettingsScrollbar settings. If provided, the scrollbar is enabled.

API