Skip to main content

Starwind UI v3.0 is now available! Migration guide

Create project
Deploy your new project in one-click.

Installation

Usage

---
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/starwind/card";
import { Button } from "@/components/starwind/button";
import { Input } from "@/components/starwind/input";
import { Label } from "@/components/starwind/label";
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, } from "@/components/starwind/select";
---
<Card class="w-[360px]">
<CardHeader>
<CardTitle>Create project</CardTitle>
<CardDescription>Deploy your new project in one-click.</CardDescription>
</CardHeader>
<CardContent class="flex flex-col gap-4">
<div class="flex w-full flex-col gap-2">
<Label for="project-name">Name</Label>
<Input type="text" id="project-name" placeholder="Name of your project" />
</div>
<div class="flex w-full flex-col gap-2">
<Label for="project-framework">Framework</Label>
<Select name="framework" required>
<SelectTrigger id="project-framework" class="w-full">
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>Frameworks</SelectLabel>
<SelectItem value="astro">Astro</SelectItem>
<SelectItem value="next">Next.js</SelectItem>
<SelectItem value="svelte">SvelteKit</SelectItem>
<SelectItem value="solid">SolidStart</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
</div>
</CardContent>
<CardFooter class="flex justify-between">
<Button variant="outline">Cancel</Button>
<Button type="submit">Deploy</Button>
</CardFooter>
</Card>

Composition

Use the parts that match the content in your card:

Card
├── CardHeader
│ ├── CardTitle
│ ├── CardDescription
│ └── CardAction
├── CardContent
└── CardFooter

Form Submission

You can easily add a standard html form submission to your card. Here is a full example with the javascript submission code.

Tip

Open up your browser’s dev tools and view the console to see the form data.

Create project
Deploy your new project in one-click.

Size

Card supports sm and md sizes. It defaults to md when size is omitted; use size="sm" for tighter spacing.

Small Card
This card uses the small size variant.

The card component supports a size prop that can be set to "sm" for a more compact appearance.

Spacing

Use the --card-spacing CSS variable to control both the spacing between sections and the inset of Card parts.

Login to your account
Enter your email below to login to your account.

Image

Add an image before the card header to create a card with an image. Use the CardAction component to position a badge or other action in the header.

Event cover
Featured
Design systems meetup
A practical talk on component APIs, accessibility, and shipping faster.

API Reference

Styled Component API

These props are added or materially changed by the installed styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. Follow the Primitive and Runtime links for lower-level behavior props.

Card

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
size "sm" | "md" "md"
Description
Selects the component's visual size.
Classification
Styled variant

Changelog

View version history v2.3.1 9 releases

v2.3.1

  • Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly.

v2.3.0

  • Renamed the standard Card size from default to md. Omitting size keeps the same medium spacing.

v2.2.0

  • Added the overridable --card-spacing CSS variable and default and small presets for coordinating section gaps and part insets consistently in Astro and React.

v2.1.0

  • Added contract-generated Astro and React implementations while preserving the component’s existing public API and styling.

v2.0.2

  • Refactor tailwind variants functions into separate variants.ts file

v2.0.0

  • Added size prop to Card component ("default" | "sm")
  • Added CardAction component for positioning actions in card headers
  • Added support for images within cards with automatic rounded corners
  • Update styling to more closely match the shadcn/ui card component

v1.3.0

  • style updates

v1.2.0

  • Add a data-slot attribute to all components to enable global styling updates

v1.1.0

  • tailwind-variants now implemented. This uses tailwind-merge under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the “class” prop.