Stat card
During lab day, I created a stat card. This card allows the user to display a single value, with an optional title and label. This is a popular component that will save our users time - expecially when creating dashboards.
This commit is contained in:
parent
4158b7c237
commit
1f3942b0e6
|
@ -427,6 +427,49 @@ export default {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/cardstat",
|
||||
name: "Stat",
|
||||
description:
|
||||
"A card component for displaying numbers.",
|
||||
icon: "ri-dual-sim-2-line",
|
||||
children: [],
|
||||
properties: {
|
||||
design: { ...all },
|
||||
settings: [
|
||||
{
|
||||
label: "Title",
|
||||
key: "title",
|
||||
control: Input,
|
||||
placeholder: "Total Revenue",
|
||||
},
|
||||
{
|
||||
label: "Value",
|
||||
key: "value",
|
||||
control: Input,
|
||||
placeholder: "$1,981,983",
|
||||
},
|
||||
{
|
||||
label: "Label",
|
||||
key: "label",
|
||||
control: Input,
|
||||
placeholder: "Stripe",
|
||||
},
|
||||
{
|
||||
label: "Value Color",
|
||||
key: "color",
|
||||
control: Input,
|
||||
placeholder: "Blue",
|
||||
},
|
||||
{
|
||||
label: "Border Color",
|
||||
key: "bordercolor",
|
||||
control: Input,
|
||||
placeholder: "lightgrey",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -359,6 +359,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"cardstat": {
|
||||
"name": "Stat Card",
|
||||
"props": {
|
||||
"title": "string",
|
||||
"value": "string",
|
||||
"label": "string",
|
||||
"color": "string",
|
||||
"bordercolor": "string"
|
||||
}
|
||||
},
|
||||
"cardhorizontal": {
|
||||
"name": "Horizontal Card",
|
||||
"props": {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<script>
|
||||
import { cssVars, createClasses } from "./cssVars"
|
||||
|
||||
export const className = ""
|
||||
export let title = ""
|
||||
export let value = ""
|
||||
export let label = ""
|
||||
export let bordercolor = ""
|
||||
export let color
|
||||
|
||||
$: cssVariables = {
|
||||
bordercolor,
|
||||
color,
|
||||
}
|
||||
</script>
|
||||
|
||||
<div use:cssVars={cssVariables} class="container">
|
||||
<p class="title">{title}</p>
|
||||
<h3 class="value">{value}</h3>
|
||||
<p class="label">{label}</p>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
min-width: 260px;
|
||||
width: max-content;
|
||||
max-height: 170px;
|
||||
border: 1px solid var(--bordercolor);
|
||||
border-radius: 0.3rem;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 0.85rem;
|
||||
color: #9e9e9e;
|
||||
font-weight: 500;
|
||||
margin: 1rem 1.5rem 0.5rem 1.5rem;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 2rem;
|
||||
font-weight: 500;
|
||||
color: var(--color);
|
||||
margin: 0rem 1.5rem 1.5rem 1.5rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 400;
|
||||
color: #9e9e9e;
|
||||
margin: 1rem 1.5rem;
|
||||
}
|
||||
</style>
|
|
@ -23,6 +23,7 @@ export { default as embed } from "./Embed.svelte"
|
|||
export { default as stackedlist } from "./StackedList.svelte"
|
||||
export { default as card } from "./Card.svelte"
|
||||
export { default as cardhorizontal } from "./CardHorizontal.svelte"
|
||||
export { default as cardstat } from "./CardStat.svelte"
|
||||
export { default as rowdetail } from "./RowDetail.svelte"
|
||||
export { default as newrow } from "./NewRow.svelte"
|
||||
export { default as datepicker } from "./DatePicker.svelte"
|
||||
|
|
Loading…
Reference in New Issue