On this page
@addTagHelper *, Webority.Ui.RazorBasic
Wrap a chart in a card for its title and subtitle, and drop the controls when a plain card is enough.
A card with a footer
Revenue, this year and last
In rupees
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
Without the controls
Revenue by month
| Category | This year |
|---|---|
| Apr | ₹32,40,000 |
| May | ₹35,10,000 |
| Jun | ₹33,80,000 |
| Jul | ₹39,20,000 |
| Aug | ₹41,20,000 |
| Sep | ₹46,30,000 |
Retry on error
When a chart fails to load, the card offers Try again and the chart says what went wrong.
Try again
Revenue by month
In rupees
| Category | This year |
|---|
Every option
Every value of every prop, one cell each.
title: any text, required
title="Revenue by month"Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
subtitle: any text, none by default
subtitle="In rupees"Revenue by month
In rupees
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
subtitle omitted (default)Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
toolbar: true or false, default true
toolbar="true" (default)Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
toolbar="false"Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
onClick: makes the whole card a button
onClick (React only; Razor has no click)Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
onRetry: a callback, none by default
retry="true": shows Try again while the chart is in errorRevenue by month
| Category | This year | Last year |
|---|
retry="false" (default): no Try again button, even on errorRevenue by month
| Category | This year | Last year |
|---|
footer: a node, none by default
<app-chart-card-footer> with a source lineRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
<app-chart-card-footer> omitted (default)Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
children: the AppChart, required
app-chart as content (children on React)Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
className: any text, none by default
class="border-primary" (React: className)Revenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
legendLabel: any text, default Show legend
legend-label="Show key": names the legend button for assistive techRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
legendTitle: any text, default Show or hide the legend
legend-title="Toggle the key": the tooltip on the legend buttonRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
viewLabel: any text, default View
view-label="Display": names the Chart / Table switch for assistive techRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
chartViewLabel: any text, default Chart
chart-view-label="Graph": the first segment of the Chart / Table switchRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
tableViewLabel: any text, default Table
table-view-label="Data": the second segment of the Chart / Table switchRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
moreActionsLabel: any text, default More actions
more-actions-label="Actions": names the menu only when the title is emptyRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
moreActionsForLabel: any text, default More actions for {title}
more-actions-for-label="Actions for {title}": names the More actions menuRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
downloadPngLabel: any text, default Download PNG
download-png-label="Save as image": the PNG item in the menuRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
downloadCsvLabel: any text, default Download CSV
download-csv-label="Save as spreadsheet": the CSV item in the menuRevenue by month
| Category | This year | Last year |
|---|---|---|
| Apr | ₹32,40,000 | ₹28,90,000 |
| May | ₹35,10,000 | ₹31,20,000 |
| Jun | ₹33,80,000 | ₹33,40,000 |
| Jul | ₹39,20,000 | ₹34,10,000 |
| Aug | ₹41,20,000 | ₹36,50,000 |
| Sep | ₹46,30,000 | ₹39,80,000 |
retryLabel: any text, default Try again
retry-label="Retry": the button text in the error stateRevenue by month
| Category | This year | Last year |
|---|
Guidance
What to do, and what to avoid.
Use it when
- A chart that sits on a dashboard or a report page and needs a title and the standard view controls.
- People should be able to see the numbers as a table, or take them away as a PNG or a CSV.
Reach for something else when
- A chart inside prose or inside another card. → AppChart
- A single figure. → AppKpiTile
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
15 props. The 4 most used come first.
Used on most screens 4 props
| Prop | Type | Default | Description |
|---|---|---|---|
| titledefault - | string | - | Required. The card's heading. Also names the menu button for assistive tech. |
| subtitledefault - | string | - | A muted line under the title: the unit or the period. |
| toolbardefault true | bool | true | Show the view controls. |
| legend-titledefault Show or hide the legend | string | Show or hide the legend | Replaces the built-in English text, for other languages. |
Less common 11 props
| Prop | Type | Default | Description |
|---|---|---|---|
| retrydefault false | bool | false | Adds a Try again button that shows while the chart is in its error state, and raises wui-chart-card:retry on the card when pressed. |
| legend-labeldefault Show legend | string | Show legend | Replaces the built-in English text, for other languages. |
| view-labeldefault View | string | View | Replaces the built-in English text, for other languages. |
| chart-view-labeldefault Chart | string | Chart | Replaces the built-in English text, for other languages. |
| table-view-labeldefault Table | string | Table | Replaces the built-in English text, for other languages. |
| more-actions-labeldefault More actions | string | More actions | Replaces the built-in English text, for other languages. |
| more-actions-for-labeldefault More actions for {title} | string | More actions for {title} | Replaces the built-in English text, for other languages. The token {title} is filled with the card's title. |
| download-png-labeldefault Download PNG | string | Download PNG | Replaces the built-in English text, for other languages. |
| download-csv-labeldefault Download CSV | string | Download CSV | Replaces the built-in English text, for other languages. |
| retry-labeldefault Try again | string | Try again | Replaces the built-in English text, for other languages. |
| <app-chart-card-footer>default - | slot | - | A row under the chart: a source, an updated-at time, a link. |
Screen reader
2 notes- The legend toggle is a button that reports its state with aria-pressed and is named Show legend.
- The Try again button is an ordinary button that appears only when onRetry is given and the chart is in its error state.