Set the color of icon. When an semantic color (neutral, primary, secondary, success, error) is applied color will change the size, the radius, the background and the text color of the icon.
Type | Default Value |
---|---|
string | null |
semantic color
other color
<NVText MB="1">semantic color</NVText>
<NVStack Gutter="3" MB="4">
<NVIcon Name="search" Medium Color="neutral" />
<NVIcon Name="search" Medium Color="primary"/>
<NVIcon Name="search" Medium Color="secondary"/>
<NVIcon Name="search" Memium Color="success"/>
<NVIcon Name="search" Memium Color="error"/>
</NVStack>
<NVText MB="1">other color</NVText>
<NVIcon Href="#" Color="orange-800" TextColor="white" Medium>orange 800</NVIcon>
<NVIcon Href="#" Color="secondary-800" TextColor="white" Medium>petrol 800</NVIcon>
<NVIcon Href="#" Color="green-100" TextColor="green-500" Medium>green 100</NVIcon>
<NVIcon Href="#" TextColor="red-100" TextColor="red-500" Medium>red 100</NVIcon>
<p class="nv-text text-sm font-normal mb-1">semantic color</p>
<div class="nv-stack gutter-x-3 mb-4" >
<i class="nv-icon nv-icon-search nv-icon-md neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-md primary"></i>
<i class="nv-icon nv-icon-search nv-icon-md secondary"></i>
<i class="nv-icon nv-icon-search nv-icon-md success"></i>
<i class="nv-icon nv-icon-search nv-icon-md error"></i>
</div>
<p class="nv-text text-sm font-normal mb-1">other color</p>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-md bg-orange-800 text-white"></i>
<i class="nv-icon nv-icon-search nv-icon-md bg-petrol-800 text-white"></i>
<i class="nv-icon nv-icon-search nv-icon-md bg-green-100 text-green-500"></i>
<i class="nv-icon nv-icon-search nv-icon-md bg-red-100 text-red-500"></i>
</div>
<nv-text mb="1">semantic color</nv-text>
<nv-stack gutter="3" mb="4">
<nv-icon name="search" color="neutral"></nv-icon>
<nv-icon name="search" color="primary"></nv-icon>
<nv-icon name="search" color="secondary"></nv-icon>
<nv-icon name="search" color="success"></nv-icon>
<nv-icon name="search" color="error"></nv-icon>
</nv-stack>
<nv-text mb="1">other color</nv-text>
<nv-stack gutter="3 mb="4">
<nv-icon name="search" href="#" color="orange-800" textcolor="white" medium>orange 800</nv-icon>
<nv-icon name="search" href="#" color="secondary-800" textcolor="white" medium>petrol 800</nv-icon>
<nv-icon name="search" href="#" color="green-100" textcolor="green-500" medium>green 100</nv-icon>
<nv-icon name="search" href="#" color="red-100" textcolor="red-500" medium>red 100</nv-icon>
</nv-stack>
<NvText mb="1">semantic color</NvText>
<NvStack gutter={3} mb={4}>
<NvIcon name="search" color="neutral"></NvIcon>
<NvIcon name="search" color="primary"></NvIcon>
<NvIcon name="search" color="secondary"></NvIcon>
<NvIcon name="search" color="success"></NvIcon>
<NvIcon name="search" color="error"></NvIcon>
</NvStack>
<NvText mb="1">other color</NvText>
<NvStack gutter={3} mb={4}>
<NvIcon name="search" href="#" color="orange-800" textColor="white" medium>
orange 800
</NvIcon>
<NvIcon name="search" href="#" color="secondary-800" textColor="white" medium>
petrol 800
</NvIcon>
<NvIcon name="search" href="#" color="green-100" textColor="green-500" medium>
green 100
</NvIcon>
<NvIcon name="search" href="#" color="red-100" textColor="red-500" medium>
red 100
</NvIcon>
</NvStack>
Large parameter, set the size of the icon to 28px. If a semantic color is set, the size will be 48px.
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon Name="search" Large Color="neutral" />
<NVIcon Name="search" Large />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-lg neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-lg"></i>
</div>
<nv-stack gutter="3">
<nv-icon name="search" color="neutral" large></nv-icon>
<nv-icon name="search" large></nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon color="neutral" large name="search" />
<NvIcon large name="search" />
</NvStack>
Medium parameter, set the size of the icon to 24px. If a semantic color is set, the size will be 40px.
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon Name="search" Medium Color="neutral" />
<NVIcon Name="search" Medium />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-md neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-md"></i>
</div>
<nv-stack gutter="3">
<nv-icon name="search" color="neutral" medium></nv-icon>
<nv-icon name="search" medium></nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon color="neutral" medium name="search" />
<NvIcon medium name="search"/></NvStack>
Set the size of the icon
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3" MB="4">
<NVIcon Name="search" XSmall Color="neutral" />
<NVIcon Name="search" Small Color="neutral"/>
<NVIcon Name="search" Medium Color="neutral"/>
<NVIcon Name="search" Large Color="neutral"/>
<NVIcon Name="search" XLarge Color="neutral"/>
</NVStack>
<NVStack Gutter="3">
<NVIcon Name="search" XSmall />
<NVIcon Name="search" Small />
<NVIcon Name="search" Medium />
<NVIcon Name="search" Large />
<NVIcon Name="search" XLarge />
</NVStack>
<div class="nv-stack gutter-x-3 mb-4">
<i class="nv-icon nv-icon-search nv-icon-xs neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-sm neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-md neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-lg neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-xl neutral"></i>
</div>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-xs"></i>
<i class="nv-icon nv-icon-search nv-icon-sm"></i>
<i class="nv-icon nv-icon-search nv-icon-md"></i>
<i class="nv-icon nv-icon-search nv-icon-lg"></i>
<i class="nv-icon nv-icon-search nv-icon-xl"></i>
</div>
<nv-stack gutter="3" mb="4">
<nv-icon name="search" color="neutral" size="xs"></nv-icon>
<nv-icon name="search" color="neutral" size="sm"></nv-icon>
<nv-icon name="search" color="neutral" size="md"></nv-icon>
<nv-icon name="search" color="neutral" size="lg"></nv-icon>
<nv-icon name="search" color="neutral" size="xl"></nv-icon>
</nv-stack>
<nv-stack gutter="3">
<nv-icon name="search" size="xs"></nv-icon>
<nv-icon name="search" size="sm"></nv-icon>
<nv-icon name="search" size="md"></nv-icon>
<nv-icon name="search" size="lg"></nv-icon>
<nv-icon name="search" size="xl"></nv-icon>
</nv-stack>
<NvStack gutter={3} mb={4}>
<NvIcon color="neutral" name="search" size="xs" />
<NvIcon color="neutral" name="search" size="sm" />
<NvIcon color="neutral" name="search" size="md" />
<NvIcon color="neutral" name="search" size="lg" />
<NvIcon color="neutral" name="search" size="xl" />
</NvStack>
<NvStack gutter={3} mb={4}>
<NvIcon name="search" size="xs" />
<NvIcon name="search" size="sm" />
<NvIcon name="search" size="md" />
<NvIcon name="search" size="lg" />
<NvIcon name="search" size="xl" />
</NvStack>
Small parameter, set the size of the icon to 24px. If a semantic color is set, the size will be 40px.
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon Name="search" Small Color="neutral" />
<NVIcon Name="search" Small />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-sm neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-sm"></i>
</div>
<nv-stack gutter="3">
<nv-icon name="search" color="neutral" small></nv-icon>
<nv-icon name="search" small></nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon color="neutral" name="search" small />
<NvIcon name="search" small />
</NvStack>
XLarge parameter, set the size of the icon to 32px. If a semantic color is set, the size will be 56px.
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon Name="search" XLarge Color="neutral" />
<NVIcon Name="search" XLarge />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-xl neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-xl"></i>
</div>
<nv-stack gutter="3">
<nv-icon name="search" color="neutral" xlarge></nv-icon>
<nv-icon name="search" xlarge></nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon color="neutral" name="search" xLarge />
<NvIcon name="search" xLarge />
</NvStack>
XSmall parameter, set the size of the icon to 16px. If a semantic color is set, the size will be 24px.
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon Name="search" XSmall Color="neutral" />
<NVIcon Name="search" XSmall />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-xs neutral"></i>
<i class="nv-icon nv-icon-search nv-icon-xs"></i>
</div>
<nv-stack gutter="3" mb="4">
<nv-icon name="search" color="neutral" xsmall></nv-icon>
<nv-icon name="search" xsmall></nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon color="neutral" name="search" xSmall />
<NvIcon name="search" xSmall />
</NvStack>
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon FontSize="100px" Height="auto" Name="search" />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-xs" style="font-size: 100px;"></i>
</div>
<nv-stack gutter="3">
<nv-icon name="search" fontsize="100px">
</nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon fontSize="100px" name="search" />
</NvStack>
Type | Default Value |
---|---|
string | null |
<NVStack Gutter="3">
<NVIcon TextColor="orange-500" Name="search" Medium />
<NVIcon TextColor="petrol-500" Name="search" Medium />
</NVStack>
<div class="nv-stack gutter-x-3">
<i class="nv-icon nv-icon-search nv-icon-md text-orange-500"></i>
<i class="nv-icon nv-icon-search nv-icon-md text-petrol-500"></i>
</div>
<nv-stack gutter="3">
<nv-icon name="search" textColor="orange-500"></nv-icon>
<nv-icon textColor="petrol-500" name="search"></nv-icon>
</nv-stack>
<NvStack gutter={3}>
<NvIcon name="search" textColor="orange-500" />
<NvIcon name="search" textColor="petrol-500" />
</NvStack>
// in your html head load the icon set
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.1/font/bootstrap-icons.css" />
// BIcon.razor
@inherits Nova.Components.NVBaseComponent;
<NVBlock Tag="i" @attributes=@Attributes(ComponentClass, new string[] {"Color"}) aria-label="@Name" role="img"></NVBlock>
@code {
[Parameter]
public string Name { get; set; }
[Parameter]
public string Size { get; set; } = "base";
public string ComponentClass
{
get { return $"bi bi-{Name}"; }
}
public override async Task SetParametersAsync(ParameterView parameters)
{
await base.SetParametersAsync(parameters);
string[] colorTint = ColorUtils.GetColorTint(Color?.ToLower() ?? "");
string color = colorTint[0];
string tint = colorTint[1];
if (!String.IsNullOrWhiteSpace(Size) && String.IsNullOrWhiteSpace(TextSize) && String.IsNullOrWhiteSpace(FontSize))
{
AddClass(DomClass.TextSize(Size));
}
if (!String.IsNullOrEmpty(color) && !String.IsNullOrEmpty(tint))
{
AddClass(DomClass.TextColor(color, tint));
}
}
}