Card
Card with context styles for Image and Divider components
Import
Source
Docs
Package
Usage
Card component is a wrapper around Paper component with context styles for Card.Section
component:
Norway Fjord Adventures
On Sale
With Fjord Tours you can explore more of the magical fjord landscapes with tours and activities on and around the fjords of Norway
Card.Section
Card.Section is a special component that is used to remove Card padding from its children while other elements still have horizontal spacing. Card.Section works the following way:
- If component is a first child in Card then it has negative top, left and right margins
- If it is a last child in Card then it has negative bottom, left and right margins
- If it is in the middle then only left and right margins will be negative
Note that Card relies on mapping direct children and you cannot use fragments or others wrappers for Card.Section
:
Custom root element
You can set component
prop on Card to use provide custom root element,
for example, you can make whole card a link:
You can also use React component instead of an element, for example, Link from react-router-dom:
To use custom component with TypeScript provide type:
Custom Card.Section root element
Card.Section
root element can be changed the same way as with Card: