Skip to content

Commit f4fa7e3

Browse files
authored
Merge pull request #790 from Ivy-Interactive/feat/view-metric-docs
(card): view metric and card redesign and documentation
2 parents 40f7fe8 + e7ff927 commit f4fa7e3

File tree

7 files changed

+496
-592
lines changed

7 files changed

+496
-592
lines changed

Ivy.Docs.Shared/Docs/02_Widgets/01_Common/Card.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The `Card` widget is a versatile container used to group related content and act
1515

1616
Here's a simple example of a card containing text and a button that shows a toast message when clicked.
1717

18-
```csharp demo-below
18+
```csharp demo-below
1919
new Card(
2020
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc",
2121
new Button("Sign Me Up", _ => client.Toast("You have signed up!"))
@@ -39,4 +39,23 @@ new Card(
3939
.Width(Size.Units(100))
4040
```
4141

42-
<WidgetDocs Type="Ivy.Card" ExtensionTypes="Ivy.CardExtensions" SourceUrl="https://github.com/Ivy-Interactive/Ivy-Framework/blob/main/Ivy/Widgets/Card.cs"/>
42+
## Dashboard Metrics
43+
44+
For dashboard applications, Ivy provides the specialized `MetricView` component that extends Card functionality with KPI-specific features like trend indicators and goal tracking.
45+
46+
```csharp demo-below
47+
new MetricView(
48+
"Revenue",
49+
Icons.DollarSign,
50+
() => Task.FromResult(new MetricRecord(
51+
"$125,430",
52+
0.12, // 12% increase
53+
0.85, // 85% of goal
54+
"Target: $150,000"
55+
))
56+
)
57+
```
58+
59+
The `MetricView` automatically handles loading states, error handling, and displays trend arrows with color-coded indicators for performance tracking.
60+
61+
<WidgetDocs Type="Ivy.Card" ExtensionTypes="Ivy.CardExtensions" SourceUrl="https://github.com/Ivy-Interactive/Ivy-Framework/blob/main/Ivy/Widgets/Card.cs"/>

Ivy.Docs.Shared/GlobalUsings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
global using Ivy.Widgets.Internal;
2323
global using Ivy.Views.Tables;
2424
global using Ivy.Views.Blades;
25+
global using Ivy.Views.Dashboards;
2526
global using Ivy.Docs.Shared.Helpers;
2627

2728
namespace Ivy.Docs.Shared;

0 commit comments

Comments
 (0)