- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Typography
Installation#
pnpm dlx shadcn@latest add @force-ui-svelte/card
Usage#
<script lang="ts">
import * as Card from "@/svelte-ui/card/index.js";
</script><Card.Root>
<Card.Header>
<Card.Title>Card Title</Card.Title>
<Card.Description>Card Description</Card.Description>
<Card.Action>Card Action</Card.Action>
</Card.Header>
<Card.Content>
<p>Card Content</p>
</Card.Content>
<Card.Footer>
<p>Card Footer</p>
</Card.Footer>
</Card.Root>Composition#
Use the following composition to build a Card:
Card.Root
├── Card.Header
│ ├── Card.Title
│ ├── Card.Description
│ └── Card.Action
├── Card.Content
└── Card.FooterExamples#
Size#
Use the size="sm" prop to set the size of the card to small. The small size variant uses smaller spacing.
Spacing#
In addition to the size prop, you can use the --card-spacing CSS variable to control the spacing between sections and the inset of card parts.
Use negative margins with -mx-(--card-spacing) to make content go edge to edge while keeping it aligned with the card inset. When the edge-to-edge content sits above a footer, use -mb-(--card-spacing) on Card.Content to remove the section gap.
Image#
Add an image before the card header to create a card with an image.
RTL#
To enable RTL support in Force UI, see the RTL configuration guide.
API Reference#
Card.Root#
The Card.Root component is the root container for card content.
| Prop | Type | Default |
|---|---|---|
size | "default" | "sm" | "default" |
class | string | - |
Card.Header#
The Card.Header component is used for a title, description, and optional action.
| Prop | Type | Default |
|---|---|---|
class | string | - |
Card.Title#
The Card.Title component is used for the card title.
| Prop | Type | Default |
|---|---|---|
class | string | - |
Card.Description#
The Card.Description component is used for helper text under the title.
| Prop | Type | Default |
|---|---|---|
class | string | - |
Card.Action#
The Card.Action component places content in the top-right of the header (for example, a button or a badge).
| Prop | Type | Default |
|---|---|---|
class | string | - |
Card.Content#
The Card.Content component is used for the main card body.
| Prop | Type | Default |
|---|---|---|
class | string | - |
Card.Footer#
The Card.Footer component is used for actions and secondary content at the bottom of the card.
| Prop | Type | Default |
|---|---|---|
class | string | - |