Talisman LogoTalisman Logo Design System
Browse documentation
Components

Card Button

A clickable card for items such as tasks and for create-new actions, with a title, optional details and a footer row.

Stableimport { CardButton } from "@repo/ui/card-button";Source
type
variant
<CardButton title="Revisar contestação" variant="solid" />

When to use

  • To show an item the user opens with one click: a task in a case, a reason in a list of options.
  • To offer a “create new” action next to existing items, using the dashed variant.
  • When the card has a few lines of content: a title, a note and a status.

When not to use

  • A plain action. Use Button.
  • Content with several separate actions inside. Use Card and put real buttons in it. A card button is one button, so nested controls are invalid.
  • Choosing an option that stays selected. Use Radio group or Checkbox.
  • Navigation to a page. Wrap it in the app’s CustomLink or use a link styled as a card, so the destination is a real link.

Variants

Variant Use for
solid Default. An existing item, with a shadow and fill.
dashed A create-new action, with a dashed border.

Layout

The card is 120px high and between 220px and 300px wide. Replace each limit with a Tailwind class through heightClassName, minWidthClassName, maxWidthClassName and widthClassName. The title row, the middle row and the bottom row are optional. topRow replaces the title.

In a grid of options, remove the width limits.

States

Hover changes the fill. Disabled blocks pointer events, shows the not-allowed cursor and dims the card.

Content

  • The title is the name of the item or the action: “Revisar contestação”, “Criar tarefa de recurso”. It truncates to one line.
  • The middle row holds at most two lines of detail, such as the process number or a note.
  • The bottom row holds status and small signs, such as a tag and a chevron.
  • Create-new cards start with a plus icon and a verb.

Do and don’t

DoUse the dashed variant for create-new actions, next to the items they create.
Don'tDon't use a card for a plain action. A Button is smaller and clearer.

Accessibility

  • It renders a native <button type="button">, so Enter and Space activate it and the accessible name comes from its content.
  • Disabled sets both disabled and aria-disabled. A disabled card cannot receive focus.
  • Do not put buttons or links inside the card. Interactive content nested in a button is invalid HTML and breaks keyboard and screen reader behavior.
  • Keyboard focus has no custom style. See Known issues.
  • The card is at least 48px high in every product use, above the 24px minimum.

Code

import { CardButton } from "@repo/ui/card-button";
import { Typography } from "@repo/ui/typography";

<CardButton
  bottomRow={<Typography variant="paragraphXs">Em revisão</Typography>}
  middleRow={
    <Typography variant="paragraphXs">
      Processo 0001234-56.2024.8.26.0100
    </Typography>
  }
  onClick={openTask}
  title={<Typography variant="paragraphSm">Revisar contestação</Typography>}
/>;

<CardButton title="Criar tarefa" variant="dashed" onClick={createTask} />;

Props

PropTypeDefaultDescription
bottomRowReactNode—Footer row, such as a status tag or helper text
classNamestring—Extra classes, for layout only
disabledbooleanfalseDisables the card
heightClassNamestringh-[120px]Tailwind height class that replaces the default
maxWidthClassNamestringmax-w-[300px]Tailwind max-width class that replaces the default
middleRowReactNode—Content between the title and the footer
minWidthClassNamestringmin-w-[220px]Tailwind min-width class that replaces the default
onClickfunction—Click handler
titlestring—Heading of the card
topRowReactNode—Replaces the title when provided
type"button" | "submit" | "reset"buttonNative button type
variant"solid" | "dashed"solid`solid` for existing items, `dashed` for create-new actions
widthClassNamestring""Tailwind width class, empty by default

Known issues

Issue Effect
The dashed variant uses border-old-muted-foreground/30. Depends on a deprecated -old token, and the border is translucent.
The fills use bg-disabled/20, hover:bg-disabled/40 and hover:bg-disabled/30. The repository avoids transparency. Hover depends on the color behind the card.
Disabled uses opacity-50 on the whole card. Content, tags and icons inside become low contrast instead of using the disabled tokens.
There is no focus-visible style. Keyboard focus shows only the browser default outline.
The default title is a raw <div> with text-sm font-medium, and the middle row uses text-xs. Text does not follow Typography tokens when the app passes a plain string.
Size is controlled by four class-name props (heightClassName, minWidthClassName, …). Apps set widths with arbitrary Tailwind classes, so cards in different pages drift apart.
The solid variant sets border but no border color. The stroke is whatever the global default border color is, not a design token chosen for the card.
Edit this page on GitHub