Separator
A visual divider that separates content horizontally or vertically with customizable styles.
Renders a semantic div with role="separator" and the appropriate
aria-orientation attribute for accessibility.
Usage
Add the namespace import and include the stylesheet reference if not already done.
@using Marai.UI.Components.MSeparatorBasic usage:
Above the separator
Below the separator
<div style="width:100%;max-width:24rem;">
<p style="margin:0 0 0.75rem;">Above the separator</p>
<MSeparator />
<p style="margin:0.75rem 0 0;">Below the separator</p>
</div>
Examples
Orientation
The Orientation parameter controls whether the separator is displayed horizontally or vertically.
Use MSeparatorOrientation.Horizontal (default) for a horizontal divider or
MSeparatorOrientation.Vertical for a vertical divider.
Horizontal (Default)
The default orientation is horizontal — a full-width line spanning across its container.
<div style="width:100%;max-width:24rem;display:flex;flex-direction:column;gap:0.75rem;">
<span>Section A</span>
<MSeparator Orientation="MSeparatorOrientation.Horizontal" />
<span>Section B</span>
</div>
Vertical
Set Orientation="MSeparatorOrientation.Vertical" to render a vertical divider.
The parent container must have a defined height for the separator to be visible.
<div style="display:flex;align-items:center;gap:0.75rem;height:2rem;">
<span>Left</span>
<MSeparator Orientation="MSeparatorOrientation.Vertical" />
<span>Center</span>
<MSeparator Orientation="MSeparatorOrientation.Vertical" />
<span>Right</span>
</div>
Separator Types
The Type parameter allows you to customize the visual appearance of the separator.
Available types include LightSubtle, Thick, Dashed, and Gradient.
Light Subtle
A subtle, thin separator with reduced opacity. Ideal for minimal, clean designs.
<div style="width:100%;max-width:24rem;display:flex;flex-direction:column;gap:0.75rem;">
<span>Light separator for subtle division</span>
<MSeparator Type="MSeparatorType.LightSubtle" />
<span>Content continues below</span>
</div>
Thick
A thicker, more prominent separator. This is the default type.
<div style="width:100%;max-width:24rem;display:flex;flex-direction:column;gap:0.75rem;">
<span>Prominent division with thick separator</span>
<MSeparator Type="MSeparatorType.Thick" />
<span>Distinct section below</span>
</div>
Dashed
A dashed line separator for a different visual style.
<div style="width:100%;max-width:24rem;display:flex;flex-direction:column;gap:0.75rem;">
<span>Dashed style separator</span>
<MSeparator Type="MSeparatorType.Dashed" />
<span>Adds visual interest</span>
</div>
Gradient
A gradient separator that fades from center to edges for a modern look.
<div style="width:100%;max-width:24rem;display:flex;flex-direction:column;gap:0.75rem;">
<span>Gradient separator adds depth</span>
<MSeparator Type="MSeparatorType.Gradient" />
<span>Modern aesthetic</span>
</div>
Type and Orientation Combinations
Combine different types with orientations for various design needs.
<div style="display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:32rem;">
<!-- Horizontal Types -->
<div style="display:flex;flex-direction:column;gap:0.5rem;">
<small style="font-weight:600;color:var(--text-secondary);">Horizontal Types</small>
<MSeparator Type="MSeparatorType.LightSubtle" />
<MSeparator Type="MSeparatorType.Thick" />
<MSeparator Type="MSeparatorType.Dashed" />
<MSeparator Type="MSeparatorType.Gradient" />
</div>
<!-- Vertical Types -->
<div>
<small style="font-weight:600;color:var(--text-secondary);display:block;margin-bottom:0.5rem;">Vertical Types</small>
<div style="display:flex;gap:1rem;height:4rem;align-items:center;">
<MSeparator Orientation="MSeparatorOrientation.Vertical" Type="MSeparatorType.LightSubtle" />
<MSeparator Orientation="MSeparatorOrientation.Vertical" Type="MSeparatorType.Thick" />
<MSeparator Orientation="MSeparatorOrientation.Vertical" Type="MSeparatorType.Dashed" />
<MSeparator Orientation="MSeparatorOrientation.Vertical" Type="MSeparatorType.Gradient" />
</div>
</div>
</div>
Inside a Card
Separators blend naturally into card layouts to divide sections of content.
Account Settings
Manage your account preferences and security.
<MCard Class="w-full max-w-sm rounded-lg border border-slate-200 bg-white shadow-sm">
<MCardHeader Class="flex flex-col gap-1 px-6 pt-6 pb-3">
<MCardTitle Class="text-lg font-semibold text-slate-950">Account Settings</MCardTitle>
<MCardDescription Class="text-sm text-slate-500">Manage your account preferences and security.</MCardDescription>
</MCardHeader>
<MCardContent Class="px-6 pb-6">
<MSeparator Type="MSeparatorType.LightSubtle" />
<div class="mt-3 flex flex-col gap-2">
<div class="text-sm font-medium text-slate-900">Quick Links</div>
<div class="text-sm text-slate-500">Profile · Security · Notifications</div>
</div>
</MCardContent>
</MCard>
Navigation Menu Divider
Use vertical separators to divide navigation items or toolbar buttons.
<div style="display:flex;align-items:center;gap:1rem;padding:0.5rem;background:var(--surface);border-radius:0.5rem;">
<button style="border:none;background:transparent;cursor:pointer;padding:0.5rem;">Home</button>
<MSeparator Orientation="MSeparatorOrientation.Vertical" Type="MSeparatorType.LightSubtle" />
<button style="border:none;background:transparent;cursor:pointer;padding:0.5rem;">About</button>
<MSeparator Orientation="MSeparatorOrientation.Vertical" Type="MSeparatorType.LightSubtle" />
<button style="border:none;background:transparent;cursor:pointer;padding:0.5rem;">Contact</button>
</div>
Between List Items
Separate list items with horizontal separators for better readability.
<div style="width:100%;max-width:24rem;display:flex;flex-direction:column;">
<div style="padding:0.75rem 0;">Item 1</div>
<MSeparator Type="MSeparatorType.LightSubtle" />
<div style="padding:0.75rem 0;">Item 2</div>
<MSeparator Type="MSeparatorType.LightSubtle" />
<div style="padding:0.75rem 0;">Item 3</div>
<MSeparator Type="MSeparatorType.LightSubtle" />
<div style="padding:0.75rem 0;">Item 4</div>
</div>
API Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
| Orientation | MSeparatorOrientation | Horizontal |
Controls the direction of the divider. Horizontal renders a full-width line; Vertical renders a full-height line. |
| Type | MSeparatorType | Thick |
Controls the visual style of the separator. Options: LightSubtle, Thick, Dashed, Gradient. |
| Class | string? | null |
Additional CSS class names appended to the separator element. |
| AdditionalAttributes | Dictionary<string, object>? | null |
Arbitrary HTML attributes passed through to the underlying div element (e.g. aria-label, data-*). |
MSeparatorOrientation Enum
| Value | Description |
|---|---|
Horizontal |
Renders a horizontal separator (full-width line). This is the default. |
Vertical |
Renders a vertical separator (full-height line). Parent container must have a defined height. |
MSeparatorType Enum
| Value | Description |
|---|---|
LightSubtle |
A subtle, thin separator with reduced opacity. Best for minimal designs. |
Thick |
A thicker, more prominent separator. This is the default type. |
Dashed |
A dashed line separator for visual variety. |
Gradient |
A gradient separator that fades from center to edges for a modern aesthetic. |
Customization
Use the Class parameter to add custom spacing, colors, or other styles:
<MSeparator Class="my-4" />
The MSeparator component does not support the PreDefName parameter.
Use the Type, Orientation, and Class parameters for customization instead.
Accessibility
The MSeparator component automatically includes proper ARIA attributes:
role="separator"— Identifies the element as a separatoraria-orientation— Set to"horizontal"or"vertical"based on theOrientationparameter