UI components · Data display
Card
A framed card with header, body and footer. Group: Data display · component 11 of 17, new in silverpoint 0.3.
States
The 2 reference states silverpoint declares for Card, live on both grounds, with their code. As in upstream's documentation the examples are uncontrolled: the state's value is the default value. Pick a framework once and every example on the site follows it.
plain
import '@silverpoint/fonts/fonts.css';
import '@silverpoint/grounds/styles.css';
import '@silverpoint/grounds/ui.css';
import { SpCard } from '@silverpoint/react/ui/card';
<SpCard>Hits per hour rose through the afternoon and eased at night.</SpCard><script setup lang="ts">
import '@silverpoint/fonts/fonts.css';
import '@silverpoint/grounds/styles.css';
import '@silverpoint/grounds/ui.css';
import { SpCard } from '@silverpoint/vue/ui/card';
</script>
<template>
<SpCard>
Hits per hour rose through the afternoon and eased at night.
</SpCard>
</template>// src/styles.css:
// @import '@silverpoint/fonts/fonts.css';
// @import '@silverpoint/grounds/styles.css';
// @import '@silverpoint/grounds/ui.css';
import { Component } from '@angular/core';
import { SpCard, SpCardExtra } from '@silverpoint/angular/ui/card';
@Component({
selector: 'app-root',
imports: [SpCard, SpCardExtra],
template: `
<sp-card>
Hits per hour rose through the afternoon and eased at night.
</sp-card>
`,
})
export class App {}from reflex_silverpoint_react import sp_card
sp_card(
"Hits per hour rose through the afternoon and eased at night.",
)titled
import '@silverpoint/fonts/fonts.css';
import '@silverpoint/grounds/styles.css';
import '@silverpoint/grounds/ui.css';
import { SpCard } from '@silverpoint/react/ui/card';
<SpCard title="Revenue" extra="Q3">128 thousands, up 6.4 on the quarter.</SpCard><script setup lang="ts">
import '@silverpoint/fonts/fonts.css';
import '@silverpoint/grounds/styles.css';
import '@silverpoint/grounds/ui.css';
import { SpCard } from '@silverpoint/vue/ui/card';
</script>
<template>
<SpCard title="Revenue">
<template #extra>Q3</template>
128 thousands, up 6.4 on the quarter.
</SpCard>
</template>// src/styles.css:
// @import '@silverpoint/fonts/fonts.css';
// @import '@silverpoint/grounds/styles.css';
// @import '@silverpoint/grounds/ui.css';
import { Component } from '@angular/core';
import { SpCard, SpCardExtra } from '@silverpoint/angular/ui/card';
@Component({
selector: 'app-root',
imports: [SpCard, SpCardExtra],
template: `
<sp-card title="Revenue">
<ng-template spExtra>Q3</ng-template>
128 thousands, up 6.4 on the quarter.
</sp-card>
`,
})
export class App {}from reflex_silverpoint_react import sp_card
sp_card(
"128 thousands, up 6.4 on the quarter.",
title="Revenue",
extra="Q3",
)Import
Each component has its own subpath under ui/, and every adapter exports them all from ui. Import @silverpoint/grounds/ui.css once, beside styles.css; Reflex adds it for you.
| Framework | Import |
|---|---|
| React | import { SpCard } from '@silverpoint/react/ui/card'; |
| Vue | import { SpCard } from '@silverpoint/vue/ui/card'; |
| Angular | import { SpCard } from '@silverpoint/angular/ui/card'; // <sp-card> |
| Reflex | from reflex_silverpoint_react import sp_card |
Props
The props Card adds to the ones every UI component takes.
| React / Angular | Vue | Reflex | Type | Description |
|---|---|---|---|---|
title | title | title | str | Heading of the card. |
headingLevel | heading-level | heading_level | Literal[2, 3, 4, 5, 6] | Level of the heading, 2 to 6 (3 by default). |
extra | extra | extra | Component | str | Content at the end of the header, e.g. a period or a tag. |
footer | footer | footer | Component | str | Content of the footer. |
Common props
Every UI component also takes these. Like a chart's, they fall back to the dashboard the component sits in, then to the provider. Read more about the UI components.
| React / Angular | Vue | Reflex | Type | Description |
|---|---|---|---|---|
id | id | id | str | The frame variant and every related id derive from it. |
ground | ground | ground | Literal['silverpoint', 'cyanotype'] | str | dict[str, Any] | Style ground: "silverpoint" or "cyanotype", or a ground object. Defaults to the dashboard's, then the provider's, or silverpoint. |
substrate | substrate | substrate | Literal['cream', 'green', 'blue', 'ochre', 'prussian'] | Prepared substrate within the ground. |
mode | mode | mode | Literal['ink', 'precision'] | ink by default; precision disables inking. |
seed | seed | seed | str | int | Seed of the frame's hand; overrides id for the frame variant only. |
size | size | size | Literal['sm', 'md', 'lg'] | Control size: sm, md (default) or lg. |
palette | palette | palette | dict[str, str] | Colours over the ground's (set with palette=), merged over the dashboard's and the provider's. |
className | class-name | class_name | str | Added to the component's root element, after its own classes. |
Report it
Found something wrong with SpCard? Open an issue on GitHub — the form comes pre-filled with the component and the version.