Expand card component
Background
We have already used some kinds of cards in our product, but it is not documented in the current cards component.
Such as:
- How many cards layouts do we need
- How do we organize the cards on a page (with responsive design)
- What are different elements can a card can have
- What are different behaviours a card can have
Create a new project (in the live product) | Create a new policy(ongoing design) |
---|---|
![]() |
![]() |
Proposal
Different types of cards
Cards with text only
This is the simplest type of card. It could contain several sections with title and context. For the guideline on how to use title and content, please follow the type scale guidelines
Cards with image
The image could be pictures, illustrations or icons, what to use is depends on the particular scenario.
-
Image sizes
- There are no hard guidelines for the image size. Depending on the situation, it could be a full width/height image, or it could be a small visual icon-like image.
- If the image is smaller than the content container, for a horizontal layout, it should be top/left-aligned with the content container; for a vertical layout, the images should be centre-aligned with the content container.
Cards with actions
There are three types of actions that can be added to a card. The button order should follow the current guidelines about how to use buttons
- Buttons: Buttons are always located at the button of the cards. The button is obvious enough to tell the user that it is clickable, there is no need to add hover status to the whole card.
- Tertiary Action: when there is a tertiary action, to make sure the user knows this is clickable, we can add hover status to the whole card as an affordance to indicate the clickable action.
- Links mixed within the content: when there are links mixed in the content, to make sure the user knows this is clickable, we can add hover status to the whole card as an affordance to indicate the clickable action. There are also exceptions, such as a full-width card with a big table, adding hover states to the card will be overwhelming, so for this type of card, we don't add whole card hover status. Different layout of cards There are two different layouts for the cars: vertical and horizontal horizontal layout suits better for bigger screen size; a vertical layout suits a smaller screen size like mobile because the text can keep the full length of the small screen which is better for readability.
Behaviours
Hover behaviour
Those cards can have either rich content or simple content, but none of them contains any actions that the user needs. So there is no affordance needed for the card style, such as hover or active.
Clickable behaviour
The clickable item in the cards are buttons or links, the cards themselves shouldn't be clickable. It means, TECHNICALLY, we don't make the whole card clickable(don't attach a link to the whole card, links only are attached to the action itself).
Page layout and breakpoints
Three columns
- Three columns are more suitable for vertical cards
- Cards spacing is 16 px; between columns spacing is 24px
- The minimum page size for three-column is 1200 px
Two columns
- Two-column can be for both horizontal or vertical cards
- Cards spacing is 24 px; between columns spacing is 40px
- The minimum page size for two-column is 768 px
One column
- One column is more suitable for vertical cards
- Cards spacing is 24px
- When the column width is smaller than 480px, we recommend using a vertical layout.
cc: @gitlab-com/gitlab-ux any feedbacks are welcoming!