Card
A content container with header, body and footer sections in four variants.
Production cluster
us-east-1 · 12 nodes
Operational
All services healthy. Last incident 42 days ago.
"use client";
import { Card, Badge, Button, Text, Box } from "astralis-ui";
export function CardDemo() {
return (
<Box w="full" maxW="xs">
<Card>
<Card.Header extra={<Badge colorScheme="green">Operational</Badge>}>
<Card.Title>Production cluster</Card.Title>
<Card.Description>us-east-1 · 12 nodes</Card.Description>
</Card.Header>
<Card.Body>
<Text size="sm" color="muted">
All services healthy. Last incident 42 days ago.
</Text>
</Card.Body>
<Card.Footer>
<Button variant="link" size="sm">View dashboard →</Button>
</Card.Footer>
</Card>
</Box>
);
}Import#
import { Card } from "astralis-ui";
// Card.Header, .Title, .Description, .Body, .FooterAnatomy#
Card.Header takes an extra slot for trailing content (badges, menus);
size on the root scales every section's padding through context.
Variants#
hoverable adds a lift on hover — pair it with clickable cards.
elevated
hoverable — try me
outline
hoverable — try me
filled
hoverable — try me
"use client";
import { Card, Text, Grid } from "astralis-ui";
const variants = ["elevated", "outline", "filled"] as const;
export function CardVariants() {
return (
<Grid columns={{ base: "1", md: "3" }} gap="4" w="full" maxW="md">
{variants.map((variant) => (
<Card key={variant} variant={variant} size="sm" hoverable>
<Card.Body>
<Text size="sm" weight="medium">{variant}</Text>
<Text size="xs" color="muted">hoverable — try me</Text>
</Card.Body>
</Card>
))}
</Grid>
);
}Props#
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "elevated" | "outline" | "filled" | "unstyled" | "elevated" | Shadowed, bordered, tinted, or bare. |
size | "sm" | "md" | "lg" | "md" | Padding density for all sections. |
hoverable | boolean | false | Hover elevation. |
Card.Header additionally takes extra: ReactNode; Card.Title renders an
h3 and Card.Description a p — both accept their native attributes.