Chapter 08 Layout
Card
A surface that groups related content: a summary, a list, a form. Cards are flat, with a thin border; shadows are kept for things that float, like menus and dialogs.
import { CardComponent } from '@okaapi-ui/angular';With a title
Set the heading level so the title fits the page: level 2 under the page title, level 3 inside a section.
Order #1042
2 items · 340 EGP
<ui-card title="Order #1042">
<p>2 items · 340 EGP</p>
<ui-badge variant="success">Paid</ui-badge>
</ui-card>Roomy
More padding, for a card that stands alone on a page.
Today
18 orders, 3 still in the kitchen.
<ui-card title="Today" padding="lg" [level]="2">
<p>18 orders, 3 still in the kitchen.</p>
</ui-card>In Arabic
طلب رقم ١٠٤٢
صنفين · ٣٤٠ جنيه
<ui-card title="طلب رقم ١٠٤٢">
<p>صنفين · ٣٤٠ جنيه</p>
</ui-card>When to use something else
| If you need | Use |
|---|---|
| Separate two groups with a line only | Divider |
| Label and value pairs, such as order details | Property list |
| One number and how it changed | Stat |
Inputs
| Name | Type | Default | What it does |
|---|---|---|---|
title | string | — | Optional heading at the top of the card. |
level | 2 | 3 | 4 | 3 | The heading level of the title. |
padding | 'md' | 'lg' | 'md' | 1.5rem or 2rem inside the border. |
Keyboard and screen readers
- A card with a heading reads as its own part of the page; give it one when it stands alone.