Card
A bordered, elevated panel for grouping related content.
A bordered, elevated panel for grouping related content. Compose it from the exported registry parts so local content and behaviour stay in the application while the visual contract stays token-driven.
newt-cardimport { Card, CardDescription, CardTitle } from "@/registry/bases/newt/ui/card"
export default function CardDemo() {
return (
<Card className="w-full max-w-sm">
<CardTitle>Card title</CardTitle>
<CardDescription>Card description text.</CardDescription>
</Card>
)
}<script setup lang="ts">
import {
Card,
CardDescription,
CardTitle,
} from "~~/registry/bases/newt/ui/card"
</script>
<template>
<Card class="w-full max-w-sm">
<CardTitle>Card title</CardTitle>
<CardDescription>Card description text.</CardDescription>
</Card>
</template>Installation
npx newtui@latest add cardnpx shadcn@latest add @newtui/cardnpx shadcn-vue@latest add @newtui/cardpnpm dlx newtui@latest add cardpnpm dlx shadcn@latest add @newtui/cardpnpm dlx shadcn-vue@latest add @newtui/cardyarn dlx newtui@latest add cardyarn dlx shadcn@latest add @newtui/cardyarn dlx shadcn-vue@latest add @newtui/cardbunx newtui@latest add cardbunx shadcn@latest add @newtui/cardbunx shadcn-vue@latest add @newtui/carddeno run -A npm:newtui@latest add carddeno run -A npm:shadcn@latest add @newtui/carddeno run -A npm:shadcn-vue@latest add @newtui/cardvlx newtui@latest add cardvlx shadcn@latest add @newtui/cardvlx shadcn-vue@latest add @newtui/cardvp dlx newtui@latest add cardvp dlx shadcn@latest add @newtui/cardvp dlx shadcn-vue@latest add @newtui/cardnubx newtui@latest add cardnubx shadcn@latest add @newtui/cardnubx shadcn-vue@latest add @newtui/cardnlx newtui@latest add cardnlx shadcn@latest add @newtui/cardnlx shadcn-vue@latest add @newtui/cardupx newtui@latest add cardupx shadcn@latest add @newtui/cardupx shadcn-vue@latest add @newtui/card- newtui
- shadcn
- npm
- pnpm
- yarn
- bun
- deno
- vlt
- vp
- nub
- ni
- upm
The shadcn CLI needs the @newtui registry in your components.json. Set it up.
Copy the source into your project
import * as React from "react"
import { cn } from "@/lib/utils"
const Card = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(
({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-[var(--newt-radius-lg)] border border-newt-border bg-newt-bg-elevated p-5 text-newt-text-primary",
className
)}
{...props}
/>
)
)
Card.displayName = "Card"
const CardTitle = React.forwardRef<HTMLDivElement, React.ComponentProps<"div">>(
({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("mb-1 text-base font-semibold", className)}
{...props}
/>
)
)
CardTitle.displayName = "CardTitle"
const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.ComponentProps<"p">
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("m-0 text-sm text-newt-text-secondary", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
export { Card, CardTitle, CardDescription }<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn(
'rounded-[var(--newt-radius-lg)] border border-newt-border bg-newt-bg-elevated p-5 text-newt-text-primary',
props.class
)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div :class="cn('mb-1 text-base font-semibold', props.class)">
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<p :class="cn('m-0 text-sm text-newt-text-secondary', props.class)">
<slot />
</p>
</template>export { default as Card } from "./Card.vue"
export { default as CardTitle } from "./CardTitle.vue"
export { default as CardDescription } from "./CardDescription.vue"Update the import paths
The files import @/lib/utils and sibling components through the aliases in your components.json. Point them at wherever those live in your project.
No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Card to your React project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.
No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Card to your Vue project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.
Usage
import { Card } from "@/components/ui/card"
export function Example() {
return <Card />
}<script setup lang="ts">
import { Card, CardTitle, CardDescription } from "@/components/ui/card"
</script>
<template>
<Card />
</template>Examples
With actions
The card has no footer part. A row of buttons is plain markup after the description, aligned to the end.
newt-cardimport { Button } from "@/registry/bases/newt/ui/button"
import { Card, CardDescription, CardTitle } from "@/registry/bases/newt/ui/card"
/* The card has no footer part: a row of buttons is plain markup inside it. */
export default function CardActionsDemo() {
return (
<Card className="w-full max-w-sm">
<CardTitle>Turn on community updates</CardTitle>
<CardDescription>
Moderators get a weekly summary of new members and reported messages.
</CardDescription>
<div className="mt-4 flex flex-wrap justify-end gap-2">
<Button size="sm" variant="secondary">
Not now
</Button>
<Button size="sm">Turn on</Button>
</div>
</Card>
)
}<script setup lang="ts">
import { Button } from "~~/registry/bases/newt/ui/button"
import {
Card,
CardDescription,
CardTitle,
} from "~~/registry/bases/newt/ui/card"
</script>
<template>
<!-- The card has no footer part: a row of buttons is plain markup inside it. -->
<Card class="w-full max-w-sm">
<CardTitle>Turn on community updates</CardTitle>
<CardDescription>
Moderators get a weekly summary of new members and reported messages.
</CardDescription>
<div class="mt-4 flex flex-wrap justify-end gap-2">
<Button size="sm" variant="secondary">Not now</Button>
<Button size="sm">Turn on</Button>
</div>
</Card>
</template>With an avatar and a badge
A header row composed from Avatar and Badge, with the card’s own title and description around it.
newt-cardimport { Avatar } from "@/registry/bases/newt/ui/avatar"
import { Badge } from "@/registry/bases/newt/ui/badge"
import { Card, CardDescription, CardTitle } from "@/registry/bases/newt/ui/card"
/* A header row built from other registry parts, then the card's own text. */
export default function CardProfileDemo() {
return (
<Card className="w-full max-w-sm">
<div className="mb-3 flex items-center gap-3">
<Avatar aria-hidden="true">R</Avatar>
<div className="min-w-0 flex-1">
<CardTitle className="mb-0 truncate">Riverbend Book Club</CardTitle>
<CardDescription>128 members</CardDescription>
</div>
<Badge variant="success" dot>
Open
</Badge>
</div>
<CardDescription>
One novel a month, a voice chat on the last Sunday, and no spoilers
outside the reading channel.
</CardDescription>
</Card>
)
}<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import { Badge } from "~~/registry/bases/newt/ui/badge"
import {
Card,
CardDescription,
CardTitle,
} from "~~/registry/bases/newt/ui/card"
</script>
<template>
<!-- A header row built from other registry parts, then the card's own text. -->
<Card class="w-full max-w-sm">
<div class="mb-3 flex items-center gap-3">
<Avatar aria-hidden="true">R</Avatar>
<div class="min-w-0 flex-1">
<CardTitle class="mb-0 truncate">Riverbend Book Club</CardTitle>
<CardDescription>128 members</CardDescription>
</div>
<Badge variant="success" dot>Open</Badge>
</div>
<CardDescription>
One novel a month, a voice chat on the last Sunday, and no spoilers
outside the reading channel.
</CardDescription>
</Card>
</template>API reference
Card
children / default slot?React.ReactNode / Vue slot
Content rendered inside the component.
React.ReactNode / Vue slotclassName / class?string
Additional classes merged with the component defaults.
stringThe registry exports Card, CardTitle, CardDescription. Parts without a table accept the native attributes for the element they render; React uses className, while Vue uses class and fallthrough attributes.
Accessibility
Preserve the native semantics of the rendered elements and pass through ARIA attributes when the surrounding context needs a label or description. Any interactive child needs a visible focus indicator, and meaning must not rely on colour alone.
Tokens
Card reads its colours, radii and motion from the --newt-* tokens installed with the library. Override a token and every component that reads it follows, including this one — see the token layer. In the plain HTML and CSS distribution the same component is newt-card.
--newt-bg-elevated--newt-radius-lg--newt-border--newt-text-secondary