Description list
In code: DescriptionList
Facts about one thing: name on the left, value on the right, a hairline between the rows
Preview
- Phone
- 020 7946 0321
- Address
- 12 Quay Street, Bristol
- Open
- Tue to Sat, 09:00 to 20:00
Use
import { DescriptionList } from '@/components/ui';
import { Clock, MapPin, Phone } from 'lucide-react';
<div className="ui-grow">
<DescriptionList
items={[
{ label: 'Phone', value: <span className="ui-mono">020 7946 0321</span>, icon: <Phone /> },
{ label: 'Address', value: '12 Quay Street, Bristol', icon: <MapPin /> },
{ label: 'Open', value: 'Tue to Sat, 09:00 to 20:00', icon: <Clock /> },
]}
/>
</div>Options
| Option | Type | What it does |
|---|---|---|
items Needed | { label: ReactNode; value: ReactNode; icon?: ReactNode; }[] | icon (a Lucide icon) goes before the name: a phone, a pin, a clock. |
plain | boolean | Without the lines between the rows: a few short facts in a card. |
It also takes the 279 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.
Without React
The same look on any HTML, with the classes dl.ui-dl > div.ui-dl-row > dt (+ span.ui-dl-icon) + dd; ui-dl--plain.
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/description-list.csscomponents/prose.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
- Flour
- 250 g
- Milk
- 300 ml
- Eggs
- 2
- Butter
- 30 g
- Noor Haddad#1187
- Otis Brandt#1188
- Yuki Tanabe#1189
| Work | Qty | Price | Line |
|---|---|---|---|
| €900.00 | |||
| €240.00 |
- Subtotal
- €1,140.00
- VAT 21%
- €239.40
- Total
- €1,379.40
- Subtotal
- €84.00
- Discount
- —
- Total
- €84.00
Showing things: states, do and don’t
Facts about one thing, name left and value right, with a hairline between the rows: details, contacts, opening hours. An item's icon goes before its name. plain drops the lines, for a few short facts in a card.
States. Lists, tables and boards have three more states besides their content: empty (Empty, with the first action inside), loading (Skeleton) and failed (Alert tone="danger"). A chosen row shows in ink, never in the brand colour.
Do
- Put numbers, dates and codes in
ui-mono(in a table cell,ui-num, which also aligns them). - Let a
Tableturn into blocks on a phone; give itscrollonly when it is read down its columns. - Show a status in words and colour together (
Badge tone="success"with "Paid"), never colour alone.
Don't
- Don't put a card round a
Table,List,Cells,CalendarorEmpty: they draw their own box. - Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
- Don't use the status colours (success, warning, danger, info) for anything but those meanings.