OsirionContactInfoSection shows contact details: a title, a short message, an address, and phone numbers, email
addresses and websites as tel:, mailto: and web links, each with a label and an icon. Use it in a footer, on a
contact page, or next to the contact form, which renders it for its own contact details.
Usage
Pass a ContactInformation from Osirion.Blazor.Core.Models. Only the fields you fill are shown:
@using Osirion.Blazor.Core.Models
<OsirionContactInfoSection ContactInfo="@contact" />
@code {
private readonly ContactInformation contact = new()
{
Address = "Belgrade, Serbia",
Email = "hello@example.org"
};
}
Phone, email and website take several values separated by commas. Labels can be translated:
<OsirionContactInfoSection Title="Kontakt"
AddressLabel="Adresa:"
PhoneLabel="Telefon:"
EmailLabel="E-pošta:"
WebsiteLabel="Sajt:"
ContactInfo="@contact" />
@code {
private readonly ContactInformation contact = new()
{
Phone = "+381 11 123 4567, +381 64 123 4567",
Email = "sales@example.org, support@example.org",
Website = "example.org",
Message = "We answer within one working day."
};
}
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
ContactInfo |
ContactInformation? |
null |
The details to show. Required. |
Title |
string |
"Contact information" |
Heading, rendered as an <h2>. Hidden when empty. |
AddressLabel |
string |
"Address:" |
Label of the address. |
PhoneLabel |
string |
"Phone:" |
Label of the phone numbers. |
EmailLabel |
string |
"Email:" |
Label of the email addresses. |
WebsiteLabel |
string |
"Website:" |
Label of the websites. |
Class |
string? |
null |
Extra CSS classes on the root element. |
Style |
string? |
null |
Inline style on the root element. |
Unmatched attributes are written to the root <div>.
ContactInformation has five string properties, all empty by default:
| Property | Shown as |
|---|---|
Address |
Text, sanitized HTML allowed |
Phone |
One tel: link per comma-separated number |
Email |
One mailto: link per comma-separated address |
Website |
One link per comma-separated address, showing the host name |
Message |
A paragraph under the title, sanitized HTML allowed |
Behavior
- The component renders plain HTML and needs no script.
- Phone numbers, email addresses and website text are HTML-encoded (since 4.0).
Title,MessageandAddressmay contain simple inline markup, such as a<br>between address lines. They go through the registered HTML sanitizer, so script and event handlers are removed.- Websites are validated:
https://andhttp://addresses are linked, an address without a scheme such asexample.orgis linked ashttps://example.org/, and anything else, such as ajavascript:URL, is left out. - A website on the current site's host is linked by its path in the same tab. Other websites open in a new tab with
rel="noopener noreferrer". - The icons are inline SVG with
aria-hidden="true"; the visible labels name each group.
Styling
The root has osirion-contact-info-section. Inside are osirion-contact-info-title,
osirion-contact-info-description, osirion-contact-info-list, and per group osirion-contact-info-item,
osirion-contact-info-icon, osirion-contact-info-label and osirion-contact-info-value; the links also have
osirion-contact-link.
The section reads five custom properties, which you can set through Style:
| Custom property | Used for | Default |
|---|---|---|
--osirion-contact-accent |
Icons and link hover color | --osirion-action-primary |
--osirion-contact-text |
Title and labels | inherit |
--osirion-contact-text-muted |
Message, values and links | inherit |
--osirion-contact-bg |
Background | not set |
--osirion-contact-spacing |
Padding | 0 |
<OsirionContactInfoSection ContactInfo="@contact"
Style="--osirion-contact-bg: var(--osirion-background-secondary); --osirion-contact-spacing: 1.5rem;" />
With prefers-contrast: high, the accent color becomes pure blue.
Related
Related Articles

