Class BOBAccordion
- Namespace
- BlazOrbit.Components
- Assembly
- BlazOrbit.dll
[GenerateComponentInfo]
public class BOBAccordion : BOBComponentBase, IHasSize, IHasBorder, IPureBuiltComponent, IBuiltComponent
- Inheritance
-
objectComponentBaseBOBAccordion
- Implements
- Inherited Members
Constructors
BOBAccordion()
public BOBAccordion()
Properties
Border
Border applied to the accordion container. Defaults to BOBBorderPresets.None; individual items never carry a border of their own.
[Parameter]
public BorderStyle? Border { get; set; }
Property Value
ChildContent
Markup that emits the accordion items (typically <BOBAccordionItem> children).
[Parameter]
public RenderFragment? ChildContent { get; set; }
Property Value
- RenderFragment
ExpandedItems
Identifiers of currently expanded items. When non-null, the accordion runs in controlled mode: the internal state mirrors this list on every render and InitiallyExpanded is ignored.
[Parameter]
public IReadOnlyList<string>? ExpandedItems { get; set; }
Property Value
- IReadOnlyList<string>
ExpandedItemsChanged
Raised whenever the set of expanded items changes. Provides the full new snapshot.
[Parameter]
public EventCallback<IReadOnlyList<string>> ExpandedItemsChanged { get; set; }
Property Value
- EventCallback<IReadOnlyList<string>>
Gap
CSS gap between items (and between items and separators). Accepts any valid CSS length
(e.g. "0", "0.5rem", "8px"). Defaults to "0".
[Parameter]
public string Gap { get; set; }
Property Value
- string
Mode
Determines how many items can be expanded at the same time. Defaults to Multiple.
[Parameter]
public BOBAccordionMode Mode { get; set; }
Property Value
OnExpandedChanged
Raised for the item whose expanded state was toggled by the user (click or keyboard). Other items collapsed implicitly by Single/SingleStrict modes do not trigger this callback.
[Parameter]
public EventCallback<BOBAccordionItemToggle> OnExpandedChanged { get; set; }
Property Value
- EventCallback<BOBAccordionItemToggle>
Separator
Optional content rendered between consecutive items. When null (default), items stack flush with no divider.
[Parameter]
public RenderFragment? Separator { get; set; }
Property Value
- RenderFragment
Size
Visual size of the accordion.
[Parameter]
public BOBSize Size { get; set; }
Property Value
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()
Tears down the JS-side behavior associated with this component.
public override ValueTask DisposeAsync()
Returns
- ValueTask
IsItemExpanded(string)
Returns whether the item with the given identifier is currently expanded.
public bool IsItemExpanded(string itemId)
Parameters
itemIdstring
Returns
- bool
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.
OnParametersSet()
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.
protected override void OnParametersSet()