Basic card
This is a basic padded card. Use contentLayout to adjust padding / borders.
Card component for displaying content in a container with padding and a shadow.
This is a basic padded card. Use contentLayout to adjust padding / borders.
import { Card } from '@mylighthouse/prism-react';
export default function BasicExample(): React.JSX.Element {
return (
<Card>
<Card.Header>
<Card.Header.Title>Basic card</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">
This is a basic padded card. Use <code>contentLayout</code> to adjust
padding / borders.
</p>
</Card.Content>
<Card.Footer>
<p className="text-300--regular">Footer actions / meta</p>
</Card.Footer>
</Card>
);
} Controlled via contentLayout padded (default), borderedHeader, noPadding.
Standard internal padding.
Adds a border between the header & top padding to the content.
You control spacing completely.
import { Button, Card } from '@mylighthouse/prism-react';
export default function ContentLayoutExample(): React.JSX.Element {
return (
<div className="flex flex-wrap gap-300 items-start">
<Card contentLayout="padded">
<Card.Header>
<Card.Header.Title>Padded (default)</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">Standard internal padding.</p>
</Card.Content>
</Card>
<Card contentLayout="borderedHeader">
<Card.Header>
<Card.Header.Title>Bordered header</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">
Adds a border between the header & top padding to the content.
</p>
</Card.Content>
</Card>
<Card contentLayout="noPadding">
<Card.Header>
<Card.Header.Title>No padding</Card.Header.Title>
</Card.Header>
<Card.Content>
<div className="flex flex-col gap-100">
<p className="text-300--regular">You control spacing completely.</p>
<Button size="small">Action</Button>
</div>
</Card.Content>
</Card>
</div>
);
} Use <Card.Header.After> to append controls on the right side of the header.
Use <Card.Header.After> for right-aligned controls.
import { Button, Card } from '@mylighthouse/prism-react';
export default function HeaderAfterExample(): React.JSX.Element {
return (
<Card contentLayout="borderedHeader">
<Card.Header>
<Card.Header.Title>Header after</Card.Header.Title>
<Card.Header.After>
<Button size="small">Add</Button>
</Card.Header.After>
</Card.Header>
<Card.Content>
<p className="text-300--regular">
Use <code>{'<Card.Header.After>'}</code> for right-aligned controls.
</p>
</Card.Content>
</Card>
);
} isSecondary reduces internal spacing; isParent adds an outer border and subdued background for nested cards; disabled applies a disabled state to the card title.
Reduced internal spacing and title style.
Content
Content
import { Card } from '@mylighthouse/prism-react';
export default function VariantsNestingExample(): React.JSX.Element {
return (
<div className="flex flex-wrap gap-300 items-start">
<Card isSecondary>
<Card.Header>
<Card.Header.Title>Secondary</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">
Reduced internal spacing and title style.
</p>
</Card.Content>
</Card>
<Card contentLayout="noPadding" isParent>
<Card.Header>
<Card.Header.Title>Parent</Card.Header.Title>
</Card.Header>
<Card.Content>
<div className="p-400">
<Card contentLayout="borderedHeader" isSecondary>
<Card.Header>
<Card.Header.Title>Secondary child</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">Content</p>
</Card.Content>
</Card>
</div>
</Card.Content>
</Card>
<Card>
<Card.Header>
<Card.Header.Title disabled>Disabled title</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">Content</p>
</Card.Content>
</Card>
</div>
);
} | Name | Default | Type | Description |
|---|---|---|---|
contentLayout | -- | ContentLayout | -- |
isParent | -- | boolean | -- |
isSecondary | -- | boolean | -- |
No component-specific props
| Name | Default | Type | Description |
|---|---|---|---|
disabled | -- | boolean | -- |
No component-specific props
No component-specific props
No component-specific props