Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions examples/Demo/Shared/Pages/Tabs/Examples/TabsDefault.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<FluentSwitch @bind-Value="@DeferredLoading">Use deferred loading</FluentSwitch>
<FluentSelect Label="Size"
Items="@(Enum.GetValues<TabSize>())"
@bind-SelectedOption="@size" />

<FluentSwitch @bind-Value="@DeferredLoading">Use deferred loading</FluentSwitch>
<p>
If checked, the contents of Tab two and three will be loaded after 1 second of processing (to simulate a long running process). <br />
</p>

<FluentTabs @bind-ActiveTabId="@activeid" OnTabChange="HandleOnTabChange" >
<FluentDivider />

<FluentTabs @bind-ActiveTabId="@activeid" OnTabChange="HandleOnTabChange" Size="@size" >
<FluentTab Label="Tab one" Icon="@(new Icons.Regular.Size24.LeafOne())" Id="tab-1">
Tab one content. This is for testing.
</FluentTab>
Expand Down Expand Up @@ -36,7 +42,7 @@ If checked, the contents of Tab two and three will be loaded after 1 second of p
<p>Active tab changed to: @changedto?.Label</p>

<h4>Vertical</h4>
<FluentTabs Orientation="Orientation.Vertical" ActiveTabId="tab-v1" Style="height: 200px;">
<FluentTabs Orientation="Orientation.Vertical" Style="height: 200px;" Size="@size">
<FluentTab Label="Tab one" Id="tab-v1">
Tab one content. This is for testing.
</FluentTab>
Expand All @@ -51,6 +57,8 @@ If checked, the contents of Tab two and three will be loaded after 1 second of p
@code {
bool DeferredLoading = false;

TabSize size;

string? activeid = "tab-3";
FluentTab? changedto;

Expand Down
15 changes: 15 additions & 0 deletions src/Core/Components/Tabs/FluentTab.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,18 @@ fluent-tab {
::deep fluent-tab[aria-selected="true"] {
font-variation-settings: normal;
}

fluent-tabs fluent-tab-panel {
--density: 0;
}


fluent-tabs.medium fluent-tab {
font-size: var(--type-ramp-base-font-size);
padding: 0 10px;
}

fluent-tabs.large fluent-tab {
font-size: var(--type-ramp-plus-1-font-size);
padding: 0 16px;
}
9 changes: 5 additions & 4 deletions src/Core/Components/Tabs/FluentTabs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ public partial class FluentTabs : FluentComponentBase

/// <summary />
protected string? ClassValue => new CssBuilder(Class)
.AddClass(Size.ToAttributeValue(), Size != TabSize.Small)
.AddClass(Orientation.ToAttributeValue(), Orientation == Orientation.Vertical)
.Build();

/// <summary />
protected string? StyleValue => new StyleBuilder(Style)
.AddStyle("padding", "6px", () => Size == TabSize.Small)
.AddStyle("padding", "12px 10px", () => Size == TabSize.Medium)
.AddStyle("padding", "16px 10px", () => Size == TabSize.Large)
.AddStyle("--density", "2", () => Size == TabSize.Medium)
.AddStyle("--density", "4", () => Size == TabSize.Large)
.AddStyle("width", Width, () => !string.IsNullOrEmpty(Width))
.AddStyle("height", Height, () => !string.IsNullOrEmpty(Height))
.Build();
Expand Down Expand Up @@ -79,7 +80,7 @@ public partial class FluentTabs : FluentComponentBase
/// Gets or sets the width of the tab items.
/// </summary>
[Parameter]
public TabSize? Size { get; set; } = TabSize.Medium;
public TabSize? Size { get; set; } = TabSize.Small;

/// <summary>
/// Gets or sets the width of the tabs component.
Expand Down
Loading