Card
A content container for grouping related information.
<script lang="ts">
import { CircleAlert } from "@lucide/svelte";
import {
Button,
Card,
CardDescription,
CardFooter,
CardHeader,
CardPanel,
CardTitle,
Field,
FieldLabel,
Form,
Input,
Select,
SelectItem,
SelectPopup,
SelectTrigger,
SelectValue,
} from "coss-svelte";
const frameworkOptions = [
{ label: "Next.js", value: "next" },
{ label: "Vite", value: "vite" },
{ label: "Remix", value: "remix" },
{ label: "Astro", value: "astro" },
];
</script>
<Card class="w-full max-w-xs">
<CardHeader>
<CardTitle>Create project</CardTitle>
<CardDescription>Deploy your new project in one-click.</CardDescription>
</CardHeader>
<CardPanel>
<Form class="flex w-full flex-col gap-4">
<Field>
<FieldLabel>Name</FieldLabel>
<Input placeholder="Name of your project" type="text" />
</Field>
<Field>
<FieldLabel>Framework</FieldLabel>
<Select value="next" options={frameworkOptions}>
<SelectTrigger aria-label="Framework"><SelectValue /></SelectTrigger>
<SelectPopup>
{#each frameworkOptions as item}
<SelectItem value={item.value} label={item.label}>{item.label}</SelectItem>
{/each}
</SelectPopup>
</Select>
</Field>
<Button class="w-full" type="submit">Deploy</Button>
</Form>
</CardPanel>
<CardFooter>
<div class="flex gap-1 text-muted-foreground text-xs">
<CircleAlert class="size-3 shrink-0" />
<p>This will take a few seconds to complete.</p>
</div>
</CardFooter>
</Card>
Installation
Install the component package, shared coss-svelte theme, and Bits UI peer.
npm install coss-svelte @coss-svelte/theme bits-uiUsage
Import the Svelte component exports directly from the package.
import { Card, CardDescription, CardFooter, CardHeader, CardPanel, CardTitle } from "coss-svelte";Anatomy
- Card
- CardDescription
- CardFooter
- CardHeader
- CardPanel
- CardTitle
API Reference
Card
A content container for grouping related information.
children : Snippet<[]>Inherits from Svelte component attributes.
CardDescription
Provides supporting copy for the parent component.
children : Snippet<[]>Inherits from Svelte component attributes.
CardHeader
Groups heading content for the parent component.
children : Snippet<[]>Inherits from Svelte component attributes.
CardPanel
Renders the main panel surface for the parent component.
children : Snippet<[]>Inherits from Svelte component attributes.
CardTitle
Names the parent surface or section.
children : Snippet<[]>Inherits from Svelte component attributes.
Implementation Details
- Status
- Stable
- Foundation
- native
- Category
- Content & Display
- Particles
- 11