Infragistics
Close
Angular React Web Components Blazor Blazor
Open Source

Blazor Divider

The Ignite UI for Blazor Divider allows the content author to easily create a horizontal/vertical rule as a break between content to better organize information on a page.

Blazor Divider Example

Dependencies

Register the Ignite UI for Blazor services:

// in Program.cs file

builder.Services.AddIgniteUIBlazor();

Registering IgbDividerModule, the client resource module of the IgbDivider, is optional: the component loads its resources when it first renders. Listing it in builder.Services.AddIgniteUIBlazor(typeof(IgbDividerModule)) can be used to preload resources or to support elements created only on the client (see Component Modules).

You will also need to link an additional CSS file to apply the styling to the IgbDivider component. The following needs to be placed in the app’s host page (wwwroot/index.html in a standalone Blazor WebAssembly or Blazor Hybrid app, Pages/_Host.cshtml in a Blazor Server app, Components/App.razor in a Blazor Web App):

<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />

For a complete introduction to the Ignite UI for Blazor, read the Getting Started topic.

The IgbDivider is capable of displaying images, initials, or any other content, including icons. Declaring an IgbDivider is as simple as:

<IgbDivider></IgbDivider>

Usage

Vertical Divider

If the Vertical attribute is set the direction of the divider would be changed from horizontal to vertical.

<IgbDivider vertical></IgbDivider>

Type

The Type attribute determines whether to render a solid or a dashed divider line. The default value is solid.

<IgbDivider Type="dashed"></IgbDivider>

Inset Divider

The IgbDivider can be set in on both sides. To inset the divider, set the Middle attribute to true in combination with the --inset css variable. This will shrink the divider line from both sides. The default value of the Middle attribute is false.

/* DividerStyles.css */
.withInset{
    --inset: 100px;
    --color:red;
}
// Both side
<IgbDivider Middle="True" class="withInset"></IgbDivider>
// Left side only
<IgbDivider class="withInset"></IgbDivider>

Using Divider Inside Select Component

The following sample illustrates how the IgbDivider can be integrated within the IgbSelect in order to distinguish two groups of items.

<IgbSelect>
 <IgbSelectItem>Item 1</IgbSelectItem>
 <IgbSelectItem>Item 2</IgbSelectItem>
 <IgbDivider></IgbDivider>
 <IgbSelectItem>Item 2</IgbSelectItem>
</IgbSelect>

CSS Variables

Inset

The --inset css variable shrinks the divider by the given amount from the start. If middle is set it will shrink from both sides.

Color

The --color css variable sets the color of the divider.

API References

Additional Resources