Skip to content

Commit e677c94

Browse files
authored
chore(card): added header wrap example (#11765)
* chore(card): added header wrap example * reworked the logic using actions
1 parent 77cc174 commit e677c94

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/react-core/src/components/Card/examples/Card.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ Images can also be placed in the card header without a `<CardTitle>`.
8989

9090
```
9191

92+
### Card with header that wraps
93+
```ts file='./CardHeaderWraps.tsx'
94+
```
95+
9296
### With HTML heading element
9397

9498
You may use the `component` property to place the card's title within an HTML heading element.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Card, CardBody, CardHeader, Button, CardTitle } from '@patternfly/react-core';
2+
3+
export const CardBasic: React.FunctionComponent = () => (
4+
<Card ouiaId="BasicCard">
5+
<CardHeader
6+
hasWrap
7+
actions={{
8+
hasNoOffset: true,
9+
actions: [
10+
<Button variant="primary" ouiaId="Primary" key="primary">
11+
Primary action
12+
</Button>,
13+
<Button variant="secondary" ouiaId="Secondary" key="secondary">
14+
Secondary action
15+
</Button>,
16+
<Button variant="tertiary" ouiaId="Tertiary" key="tertiary">
17+
Tertiary action
18+
</Button>
19+
]
20+
}}
21+
>
22+
<CardTitle>This is a longer card title that takes up more space</CardTitle>
23+
</CardHeader>
24+
<CardBody>This is the card body</CardBody>
25+
</Card>
26+
);

0 commit comments

Comments
 (0)