Skip to content

Card

A container that groups related content and actions. Same markup and props in every style: switch the style in the header to see it change.

Basic

Header, body and footer. Every part is optional, and the spacing follows Customize → Density.

Team plan

Everything in Free, plus shared workspaces.

Invite up to 10 people, share components and keep one theme for the whole team.

card-basic.html
<div class="vin-card" style="width: 100%; max-width: 360px">
  <div class="vin-card__header">
    <h3 class="vin-card__title">Team plan</h3>
    <p class="vin-card__desc">Everything in Free, plus shared workspaces.</p>
  </div>
  <div class="vin-card__body">
    <p>Invite up to 10 people, share components and keep one theme for the whole team.</p>
  </div>
  <div class="vin-card__footer">
    <button type="button" class="vin-btn">Upgrade</button>
    <button type="button" class="vin-btn vin-btn--ghost">Compare plans</button>
  </div>
</div>

Stat card

A big number with a trend badge: the building block of dashboards.

Monthly visitors

48,210

card-stat.html
<div class="vin-card" style="width: 100%; max-width: 280px">
  <div class="vin-card__header">
    <p class="vin-card__desc">Monthly visitors</p>
    <h3 class="vin-card__title" style="font-size: 28px">48,210</h3>
  </div>
  <div class="vin-card__footer">
    <span class="vin-badge vin-badge--success">+12.5%</span>
    <p class="vin-card__desc">vs last month</p>
  </div>
</div>

With a form

Cards hold form fields and actions without any extra CSS.

New project

You can change these later.

card-form.html
<div class="vin-card" style="width: 100%; max-width: 360px">
  <div class="vin-card__header">
    <h3 class="vin-card__title">New project</h3>
    <p class="vin-card__desc">You can change these later.</p>
  </div>
  <div class="vin-card__body">
    <div class="vin-field">
      <label class="vin-label" for="project-name">Project name</label>
      <input id="project-name" class="vin-input" placeholder="My app">
    </div>
  </div>
  <div class="vin-card__footer">
    <button type="button" class="vin-btn">Create</button>
    <button type="button" class="vin-btn vin-btn--outline">Cancel</button>
  </div>
</div>

Installation

React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:

Terminal
npx @vinish/ui add card
React
import { Card, CardHeader, CardTitle, CardDescription, CardBody, CardFooter } from "@/components/vin/card";
Vue
import Card, { CardHeader, CardTitle, CardDescription, CardBody, CardFooter } from "@/components/vin/card.vue";
Svelte
import Card from "$lib/components/vin/card.svelte";
import CardBody from "$lib/components/vin/card-body.svelte";
import CardDescription from "$lib/components/vin/card-description.svelte";
import CardFooter from "$lib/components/vin/card-footer.svelte";
import CardHeader from "$lib/components/vin/card-header.svelte";
import CardTitle from "$lib/components/vin/card-title.svelte";

The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.

Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.

API

From spec/card.json, which every framework version is tested against.

PropValuesDefaultIn HTML
as (CardTitle)
Heading level for the title, so it fits your page outline.
h2h3h4ph3the tag of .vin-card__title

Parts

React, Vue, SvelteHTML classes
<Card><CardHeader><CardTitle><CardDescription><CardBody><CardFooter>.vin-card.vin-card__header.vin-card__title.vin-card__desc.vin-card__body.vin-card__footer

Accessibility

  • The title is a real heading (h3 by default), so it appears in the page outline. Pick the level that fits your page.
  • A card is a plain container: put links and buttons inside it rather than making the whole card clickable.
  • Text and description meet 4.5:1 contrast in every style and mode.