Class BOBCarousel
- Namespace
- BlazOrbit.Components
- Assembly
- BlazOrbit.dll
[GenerateComponentInfo]
public class BOBCarousel : BOBComponentBase, IHasSize, IPureBuiltComponent, IBuiltComponent
- Inheritance
-
objectComponentBaseBOBCarousel
- Implements
- Inherited Members
Constructors
BOBCarousel()
public BOBCarousel()
Properties
ActiveIndex
Index of the currently visible slide.
[Parameter]
public int ActiveIndex { get; set; }
Property Value
- int
ActiveIndexChanged
Raised when ActiveIndex changes via user interaction or auto-play.
[Parameter]
public EventCallback<int> ActiveIndexChanged { get; set; }
Property Value
- EventCallback<int>
ActiveIndicatorIcon
Optional icon override for the active slide indicator. When null, the active indicator uses IndicatorIcon (or the default dot).
[Parameter]
public IconKey? ActiveIndicatorIcon { get; set; }
Property Value
ActiveIndicatorIconColor
Color applied to the active-indicator icon. Falls back to IndicatorIconColor.
[Parameter]
public string? ActiveIndicatorIconColor { get; set; }
Property Value
- string
ArrowIconLeft
Icon for the previous-slide arrow. Defaults to BOBIconKeys.UI.ChevronLeft.
[Parameter]
public IconKey? ArrowIconLeft { get; set; }
Property Value
ArrowIconRight
Icon for the next-slide arrow. Defaults to BOBIconKeys.UI.ChevronRight.
[Parameter]
public IconKey? ArrowIconRight { get; set; }
Property Value
AutoPlay
When true, the carousel advances automatically every AutoPlayInterval.
[Parameter]
public bool AutoPlay { get; set; }
Property Value
- bool
AutoPlayInterval
Time between automatic transitions when AutoPlay is enabled. Defaults to 5 seconds.
[Parameter]
public TimeSpan AutoPlayInterval { get; set; }
Property Value
- TimeSpan
ChildContent
Markup that emits the slides (typically <BOBCarouselItem> children).
[Parameter]
public RenderFragment? ChildContent { get; set; }
Property Value
- RenderFragment
IndicatorIcon
Optional icon used for non-active slide indicators. When null (default), a CSS dot is rendered for inactive slides.
[Parameter]
public IconKey? IndicatorIcon { get; set; }
Property Value
IndicatorIconColor
Color applied to the inactive-indicator icon. Accepts any valid CSS color value, PaletteColor or BOBColor.
[Parameter]
public string? IndicatorIconColor { get; set; }
Property Value
- string
Loop
When true, navigation wraps around at both ends. With Slide the carousel renders cloned slides at the boundaries so wrap-around feels continuous (no jump back to the start).
[Parameter]
public bool Loop { get; set; }
Property Value
- bool
NextLabel
Accessible label for the next-slide arrow. Defaults to "Next slide".
[Parameter]
public string? NextLabel { get; set; }
Property Value
- string
PreviousLabel
Accessible label for the previous-slide arrow. Defaults to "Previous slide".
[Parameter]
public string? PreviousLabel { get; set; }
Property Value
- string
ShowArrows
When true (default), the previous/next arrow buttons are visible.
[Parameter]
public bool ShowArrows { get; set; }
Property Value
- bool
ShowIndicators
When true (default), the slide indicators row is visible.
[Parameter]
public bool ShowIndicators { get; set; }
Property Value
- bool
Size
Visual size of the carousel.
[Parameter]
public BOBSize Size { get; set; }
Property Value
SwipeThresholdPx
Pixel distance a horizontal swipe must cover before it triggers slide navigation. Defaults to 50.
[Parameter]
public int SwipeThresholdPx { get; set; }
Property Value
- int
Transition
Visual transition between slides. Defaults to Slide.
[Parameter]
public BOBCarouselTransition Transition { get; set; }
Property Value
TransitionDurationMs
Duration of the slide transition in milliseconds. Drives both the CSS animation and the post-animation snap-back used by the looping wrap behaviour. Defaults to 350.
[Parameter]
public int TransitionDurationMs { get; set; }
Property Value
- int
WheelRadiusPx
Radius (in pixels) of the cylinder used by Wheel. Larger values push the side slides further behind the active one. Defaults to 280.
[Parameter]
public int WheelRadiusPx { get; set; }
Property Value
- int
Methods
BuildComponentCssVariables(Dictionary<string, string>)
Contributes additional CSS custom properties to the inline style attribute. Keys
that collide with framework-owned --bob-inline-* variables will be overwritten.
public void BuildComponentCssVariables(Dictionary<string, string> cssVariables)
Parameters
cssVariablesDictionary<string, string>
BuildComponentDataAttributes(Dictionary<string, object>)
Contributes additional data- attributes to the root element. Keys that collide
with framework-owned data-bob- attributes will be overwritten.
public void BuildComponentDataAttributes(Dictionary<string, object> attributes)
Parameters
attributesDictionary<string, object>
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builderRenderTreeBuilder
DisposeAsync()
public override ValueTask DisposeAsync()
Returns
- ValueTask
GoNextAsync()
Navigate to the next slide.
public Task GoNextAsync()
Returns
- Task
GoPreviousAsync()
Navigate to the previous slide.
public Task GoPreviousAsync()
Returns
- Task
GoToAsync(int)
Navigate to a specific slide by index.
public Task GoToAsync(int index)
Parameters
indexint
Returns
- Task
OnAfterRenderAsync(bool)
Method invoked after each time the component has been rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any Microsoft.AspNetCore.Components.ElementReference fields will be populated by the time this runs.
This method is not invoked during prerendering or server-side rendering, because those processes are not attached to any live browser DOM and are already complete before the DOM is updated.
Note that the component does not automatically re-render after the completion of any returned System.Threading.Tasks.Task, because that would cause an infinite render loop.
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
firstRenderboolSet to
trueif this is the first time Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender(bool) has been invoked on this component instance; otherwisefalse.
Returns
- Task
A System.Threading.Tasks.Task representing any asynchronous operation.
Remarks
The Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender(bool) and Microsoft.AspNetCore.Components.ComponentBase.OnAfterRenderAsync(bool) lifecycle methods
are useful for performing interop, or interacting with values received from @ref.
Use the firstRender parameter to ensure that initialization work is only performed
once.