Skip to content
ShineUI
Install

Trend

Which way a figure moved.

<sui-trend>DataStable

About

A change and which way it went, beside a figure that is not on a stat card: "+2 this week" under a project's progress, "−3.1% vs. July" in a table cell. Good news takes the ink; bad news takes the danger ink, a ringed arrow and a hidden "unfavorable", so color never carries it alone. sui-stat-card draws the same mark.

Usage

<sui-trend value="+2" direction="up" note="this week"></sui-trend> <script type="module"> import { defineCustomElements } from "@shineui/core/loader"; import "@shineui/core/shineui.css"; defineCustomElements(); </script>
import { SuiTrend } from "@shineui/react"; import "@shineui/core/shineui.css"; export function Example() { return <SuiTrend value="+2" direction="up" note="this week" />; }
<script setup> import { SuiTrend } from "@shineui/vue"; import "@shineui/core/shineui.css"; </script> <template> <SuiTrend value="+2" direction="up" note="this week" /> </template>
import { Component } from "@angular/core"; import { SuiTrend } from "@shineui/angular"; @Component({ standalone: true, imports: [SuiTrend], template: `<sui-trend value="+2" direction="up" note="this week"></sui-trend>`, }) export class Example { }

Good and bad news

Good news takes the positive ink, green under semantic status. Bad news takes the danger ink, its arrow ringed and a hidden "unfavorable" after it. A change that is neither takes the muted ink at regular weight. Whether a rise is good is yours to say: severity="critical" marks a rising receivable.

<div style="display:grid;gap:12px;font-size:13px"> <sui-trend value="+2" direction="up" note="this week"></sui-trend> <sui-trend value="+12.4%" direction="up" severity="critical" note="receivables over 90 days"></sui-trend> <sui-trend value="-3 days" direction="down" note="days sales outstanding"></sui-trend> </div>

Beside a figure

The trend takes the size of the text around it, so it sits under a hero figure without a size of its own. sui-stat-card, on the right, draws the same mark under its value through delta, delta-direction and severity.

Progress 62% 18 of 29 tasks closed
<div style="display:flex;flex-wrap:wrap;gap:32px;align-items:flex-start"> <div style="display:grid;gap:4px"> <span style="font:460 12px/1.6 var(--font-sans);color:var(--ink-faint);text-transform:uppercase;letter-spacing:0.06em">Progress</span> <span style="font:730 30px/1.1 var(--font-sans);letter-spacing:-0.02em">62%</span> <span style="font:460 12px/1.6 var(--font-sans);color:var(--ink-faint)">18 of 29 tasks closed</span> <sui-trend value="+2" direction="up" note="this week" style="font-size:13.5px"></sui-trend> </div> <sui-stat-card label="Receivables" value="$90,740.45" delta="+12.4%" delta-direction="up" severity="critical" note="vs. July" style="width:220px"></sui-stat-card> </div>

In a table cell

In a cell the trend takes the cell's text size. Set severity row by row: more cash is good news, older receivables are not, a smaller bill to pay is, and a flat payroll is neither.

AccountBalanceChange
Operating checking$98,200.00
Receivables over 90 days$12,890.45
Accounts payable$61,250.00
Payroll$48,100.00
<table style="border-collapse:collapse;width:100%;max-width:480px;font:460 13px/1.4 var(--font-sans);color:var(--ink)"> <thead> <tr><th style="padding:8px 10px;text-align:start;font:650 12px/1.4 var(--font-sans);color:var(--ink-muted);border-bottom:1px solid var(--border)">Account</th><th style="padding:8px 10px;text-align:start;font:650 12px/1.4 var(--font-sans);color:var(--ink-muted);border-bottom:1px solid var(--border);text-align:end">Balance</th><th style="padding:8px 10px;text-align:start;font:650 12px/1.4 var(--font-sans);color:var(--ink-muted);border-bottom:1px solid var(--border)">Change</th></tr> </thead> <tbody> <tr><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)">Operating checking</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline);text-align:end;font-feature-settings:'tnum'">$98,200.00</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)"><sui-trend value="+4.2%" direction="up" note="vs. July"></sui-trend></td></tr> <tr><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)">Receivables over 90 days</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline);text-align:end;font-feature-settings:'tnum'">$12,890.45</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)"><sui-trend value="+12.4%" direction="up" severity="critical" note="vs. July"></sui-trend></td></tr> <tr><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)">Accounts payable</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline);text-align:end;font-feature-settings:'tnum'">$61,250.00</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)"><sui-trend value="−3.1%" direction="down" note="vs. July"></sui-trend></td></tr> <tr><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)">Payroll</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline);text-align:end;font-feature-settings:'tnum'">$48,100.00</td><td style="padding:8px 10px;border-bottom:1px solid var(--hairline)"><sui-trend value="0.0%" severity="neutral" note="vs. July"></sui-trend></td></tr> </tbody> </table>

No direction

Leave out direction for a change that has no up or down, a count of open items say.

<sui-trend value="2 open" note="since Monday"></sui-trend>

API

<sui-trend>

Properties

PropertyAttributeTypeDefaultDescription
directiondirection"down" | "up" | undefinedDraws an up or a down arrow before the value. Unset, the change has no arrow. Reflected.
notenotestringstring | undefinedFaint context after the value: "this week", "vs. July".
severityseveritySuiTrendSeverity"critical" | "neutral" | "positive"'positive'How the change reads, on the status ladder sui-stat-card shares: positive, good news, in the positive ink (the ink under brand status, green under semantic); critical, bad news, in the danger ink with the arrow ringed and a hidden "unfavorable" after the figure; neutral, neither, in the muted ink at regular weight, the arrow kept and unringed, so no tone rests on colour alone. Whether a rise is good is yours to say, since a rising receivable is bad: severity="critical" marks it. An unknown value reads as positive. Reflected.
valuevaluestring''The change as text, formatted before it is passed: "+12.4%", "2 more".

Types

SuiTrendSeverity typeHow a change reads, on the library's status ladder: positive is good news, critical bad news, neutral neither.
No members.

Theming

Every design token this element can render with, read from its own stylesheets and the ones it imports. Set a token on :root or on any ancestor and every use below follows it. The values shown are the ones in the theme you are viewing. The list is read per stylesheet, so an element that imports a shared drawing module lists that module's tokens too, whether or not it paints with all of them.

See also