|
1 | 1 | --- |
2 | 2 | title: "Cards" |
3 | | -description: "Highlight main points or links with customizable icons" |
4 | | -icon: 'square-mouse-pointer' |
| 3 | +description: "Highlight main points or links with customizable layouts andicons" |
| 4 | +icon: "square-mouse-pointer" |
5 | 5 | --- |
6 | 6 |
|
7 | | -<Card title="Card Title" icon="text" href="/components/columns"> |
| 7 | +Use cards to create visual containers for content. Cards are flexible containers that can include text, icons, images, and links. |
| 8 | + |
| 9 | +## Basic card |
| 10 | + |
| 11 | +<Card title="Card title" icon="text" href="/components/columns"> |
8 | 12 | This is how you use a card with an icon and a link. Clicking on this card |
9 | 13 | brings you to the Columns page. |
10 | 14 | </Card> |
11 | 15 |
|
12 | | -<RequestExample> |
13 | | - ```mdx Card Example |
14 | | - <Card title="Click on me" icon="text" href="/components/columns"> |
15 | | - This is how you use a card with an icon and a link. Clicking on this card |
16 | | - brings you to the Columns page. |
17 | | - </Card> |
18 | | - ``` |
19 | | - |
20 | | -```mdx Image Card Example |
21 | | -<Card title="Image Card" img="/images/card-with-image.png"> |
22 | | - Here is an example of a card with an image |
| 16 | +```mdx Card example |
| 17 | +<Card title="Card title" icon="text" href="/components/columns"> |
| 18 | + This is how you use a card with an icon and a link. Clicking on this card |
| 19 | + brings you to the Columns page. |
23 | 20 | </Card> |
24 | 21 | ``` |
25 | 22 |
|
26 | | -</RequestExample> |
| 23 | +## Card variations |
27 | 24 |
|
28 | | -## Horizontal card |
| 25 | +Cards support several layout and styling options to fit different content needs. |
29 | 26 |
|
30 | | -Add a `horizontal` property to display cards horizontally. |
| 27 | +### Horizontal layout |
31 | 28 |
|
32 | | -<Card title="Horizontal Card" icon="text" horizontal> |
33 | | - Here is an example of a horizontal card |
| 29 | +Add the `horizontal` property to display cards in a more compact, horizontal layout. |
| 30 | + |
| 31 | +<Card title="Horizontal card" icon="text" horizontal> |
| 32 | + This is an example of a horizontal card. |
34 | 33 | </Card> |
35 | 34 |
|
36 | | -## Image card |
| 35 | +```mdx Horizontal card example |
| 36 | +<Card title="Horizontal card" icon="text" horizontal> |
| 37 | + This is an example of a horizontal card. |
| 38 | +</Card> |
| 39 | +``` |
| 40 | + |
| 41 | +### Image cards |
37 | 42 |
|
38 | | -Add an `img` property to display an image on the top of the card. |
| 43 | +Add an `img` property to display an image at the top of the card. |
39 | 44 |
|
40 | | -<Card title="Image Card" img="https://mintlify-assets.b-cdn.net/yosemite.jpg"> |
41 | | - Here is an example of a card with an image |
| 45 | +<Card title="Image card" img="https://mintlify-assets.b-cdn.net/yosemite.jpg"> |
| 46 | + This is an example of a card with an image. |
42 | 47 | </Card> |
43 | 48 |
|
44 | | -## Link card |
| 49 | +```mdx Image card example |
| 50 | +<Card title="Image card" img="/images/card-with-image.png"> |
| 51 | + This is an example of a card with an image. |
| 52 | +</Card> |
| 53 | +``` |
45 | 54 |
|
46 | | -You can customize the CTA and whether or not to display the arrow on the card. By default, the arrow will only show for external links. |
| 55 | +### Link cards with custom CTAs |
| 56 | + |
| 57 | +You can customize the call-to-action text and control whether an arrow appears. By default, arrows only show for external links. |
| 58 | + |
| 59 | +<Card title="Link card" icon="link" href="/components/columns" arrow="true" cta="Click here"> |
| 60 | + This is an example of a card with an icon and a link. Clicking on this card brings you to the Columns page. |
| 61 | +</Card> |
47 | 62 |
|
| 63 | +```mdx Link card example |
48 | 64 | <Card |
49 | 65 | title="Link card" |
50 | 66 | icon="link" |
51 | 67 | href="/components/columns" |
52 | 68 | arrow="true" |
53 | 69 | cta="Click here" |
54 | 70 | > |
55 | | - This is how you use a card with an icon and a link. Clicking on this card |
56 | | - brings you to the Columns page. |
| 71 | + This is an example of a card with an icon and a link. Clicking on this card brings you to the Columns page. |
57 | 72 | </Card> |
58 | | - |
59 | | -<RequestExample> |
60 | | - ```mdx Card Example |
61 | | - <Card |
62 | | - title="Link card" |
63 | | - icon="link" |
64 | | - href="/components/columns" |
65 | | - arrow="true" |
66 | | - cta="Click here" |
67 | | - > |
68 | | - This is how you use a card with an icon and a link. Clicking on this card |
69 | | - brings you to the Columns page. |
70 | | - </Card> |
71 | | - ``` |
72 | | -</RequestExample> |
| 73 | +``` |
73 | 74 |
|
74 | 75 | ## Grouping cards |
75 | 76 |
|
76 | | -You can group cards in [columns](/components/columns). |
| 77 | +Use the [Columns component](/components/columns) to organize multiple cards side by side. |
77 | 78 |
|
78 | 79 | <Columns cols={2}> |
79 | | - <Card title="First Card" icon="panel-left-close"> |
| 80 | + <Card title="First card" icon="panel-left-close"> |
80 | 81 | This is the first card. |
81 | 82 | </Card> |
82 | | - <Card title="Second Card" icon="panel-right-close"> |
| 83 | + <Card title="Second card" icon="panel-right-close"> |
83 | 84 | This is the second card. |
84 | 85 | </Card> |
85 | 86 | </Columns> |
86 | 87 |
|
87 | | -## Props |
| 88 | +```mdx Columns example |
| 89 | +<Columns cols={2}> |
| 90 | + <Card title="First card" icon="panel-left-close"> |
| 91 | + This is the first card. |
| 92 | + </Card> |
| 93 | + <Card title="Second card" icon="panel-right-close"> |
| 94 | + This is the second card. |
| 95 | + </Card> |
| 96 | +</Columns> |
| 97 | +``` |
| 98 | + |
| 99 | +## Properties |
88 | 100 |
|
89 | 101 | <ResponseField name="title" type="string" required> |
90 | | - The title of the card |
| 102 | + The title displayed on the card |
91 | 103 | </ResponseField> |
92 | 104 |
|
93 | 105 | <ResponseField name="icon" type="string or svg"> |
94 | | - A [Font Awesome icon](https://fontawesome.com/icons), [Lucide |
95 | | - icon](https://lucide.dev/icons), or JSX compatible SVG code in `icon={}`. |
96 | | - |
97 | | - To generate JSX compatible SVG code: |
98 | | - |
| 106 | + Icon to display on the card. Use a [Font Awesome icon](https://fontawesome.com/icons) name, [Lucide icon](https://lucide.dev/icons) name, or JSX-compatible SVG code wrapped in `icon={}`. |
| 107 | + |
| 108 | + For custom SVG icons: |
99 | 109 | 1. Use the [SVGR converter](https://react-svgr.com/playground/). |
100 | 110 | 2. Copy the code inside the `<svg/>` tag. |
101 | | - 3. Paste the code into your card. Make sure to only copy and paste the code inside the `<svg/>` tag. |
102 | | - 4. You may need to decrease the height and width to make the image fit. |
| 111 | + 3. Paste the code into your card. |
| 112 | + 4. Adjust height and width as needed. |
103 | 113 | </ResponseField> |
104 | 114 |
|
105 | 115 | <ResponseField name="iconType" type="string"> |
106 | | - One of `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands` |
| 116 | + Font Awesome icon style: `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, or `brands`. |
107 | 117 | </ResponseField> |
108 | 118 |
|
109 | 119 | <ResponseField name="color" type="string"> |
110 | | - The color of the icon as a hex code |
| 120 | + Icon color as a hex code (e.g., `#FF6B6B`). |
111 | 121 | </ResponseField> |
112 | 122 |
|
113 | 123 | <ResponseField name="href" type="string"> |
114 | | - The url that clicking on the card would navigate the user to |
| 124 | + URL to navigate to when the card is clicked. |
115 | 125 | </ResponseField> |
116 | 126 |
|
117 | 127 | <ResponseField name="horizontal" type="boolean"> |
118 | | - Makes the card more compact and horizontal |
| 128 | + Display the card in a compact horizontal layout. |
119 | 129 | </ResponseField> |
120 | 130 |
|
121 | 131 | <ResponseField name="img" type="string"> |
122 | | - The url or local path to an image to display on the top of the card |
| 132 | + URL or local path to an image displayed at the top of the card. |
123 | 133 | </ResponseField> |
124 | 134 |
|
125 | 135 | <ResponseField name="cta" type="string"> |
126 | | - Label for the action button |
| 136 | + Custom text for the action button. |
127 | 137 | </ResponseField> |
128 | 138 |
|
129 | 139 | <ResponseField name="arrow" type="boolean"> |
130 | | - Enable or disable the link arrow icon |
| 140 | + Show or hide the link arrow icon. |
131 | 141 | </ResponseField> |
0 commit comments