Basic card
This is a basic padded card. Use hasPadding and hasBorder to adjust padding and the header divider.
Card component for displaying content in a container with padding and a shadow.
This is a basic padded card. Use hasPadding and hasBorder to adjust padding and the header divider.
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>hasPadding</code> and{' '}
<code>hasBorder</code> to adjust padding and the header divider.
</p>
</Card.Content>
<Card.Footer>
<p className="text-300--regular">Footer actions / meta</p>
</Card.Footer>
</Card>
);
} hasPadding controls the content padding and defaults to true. The header divider is separate, via hasBorder on Card.Header, so the two compose freely.
Standard internal padding.
Adds a divider under the header and clears the content of it.
You control spacing completely.
Keeps the divider while the content stays edge to edge.
import { Button, Card } from '@mylighthouse/prism-react';
export default function PaddingAndBorderExample(): React.JSX.Element {
return (
<div className="flex flex-wrap gap-300 items-start">
<Card>
<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>
<Card.Header hasBorder>
<Card.Header.Title>Padded, bordered header</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">
Adds a divider under the header and clears the content of it.
</p>
</Card.Content>
</Card>
<Card hasPadding={false}>
<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>
<Card hasPadding={false}>
<Card.Header hasBorder>
<Card.Header.Title>No padding, bordered header</Card.Header.Title>
</Card.Header>
<Card.Content>
<p className="text-300--regular">
Keeps the divider while the content stays edge to edge.
</p>
</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>
<Card.Header hasBorder>
<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 hasPadding={false} isParent>
<Card.Header>
<Card.Header.Title>Parent</Card.Header.Title>
</Card.Header>
<Card.Content>
<div className="p-400">
<Card 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 |
|---|---|---|---|
hasPadding | -- | boolean | -- |
isParent | -- | boolean | -- |
isSecondary | -- | boolean | -- |
| Name | Default | Type | Description |
|---|---|---|---|
hasBorder | -- | boolean | -- |
| Name | Default | Type | Description |
|---|---|---|---|
disabled | -- | boolean | -- |
No component-specific props
No component-specific props
No component-specific props