Colour and restraint
Where colour, depth and text size appear on a Khaeli screen, and how little of each a screen uses.
A Khaeli screen is neutral, and colour, depth and text size appear only where each does a job. Every rule below is shown being followed, on a screen of the same invoicing product.
One fill on a screen
INV-2051
OverdueBrightwater Dental
| Item | Quantity | Amount |
|---|---|---|
| Website care plan, October | 1 month | £480.00 |
| Booking form redesign | 8 hours | £640.00 |
| Photography | Half a day | £160.00 |
| Total | £1,280.00 | |
import { Badge } from "@/components/ui/badge"
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
import { Button } from "@/components/ui/button"
import { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { Screen, ScreenBody, ScreenHeader, ScreenSidebar } from "~/components/principles/screen"
const lines = [
{ item: "Website care plan, October", quantity: "1 month", amount: "£480.00" },
{ item: "Booking form redesign", quantity: "8 hours", amount: "£640.00" },
{ item: "Photography", quantity: "Half a day", amount: "£160.00" },
]
export default function OneFillOnAScreen() {
return (
<Screen sidebar={<ScreenSidebar current="Invoices" />}>
<ScreenHeader
trail={
<Breadcrumb aria-label="Path to INV-2051">
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="#invoices">Invoices</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>INV-2051</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
}
title="INV-2051"
tag={<Badge variant="negative">Overdue</Badge>}
line="Brightwater Dental"
actions={
<>
<Button variant="outline">Download PDF</Button>
<Button>Send reminder</Button>
</>
}
/>
<ScreenBody rows>
<Table aria-label="Lines of INV-2051">
<TableHeader>
<TableRow>
<TableHead>Item</TableHead>
<TableHead>Quantity</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{lines.map((line) => (
<TableRow key={line.item}>
<TableCell>{line.item}</TableCell>
<TableCell>{line.quantity}</TableCell>
<TableCell className="text-right">{line.amount}</TableCell>
</TableRow>
))}
</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={2}>Total</TableCell>
<TableCell className="text-right">£1,280.00</TableCell>
</TableRow>
</TableFooter>
</Table>
</ScreenBody>
</Screen>
)
}
A screen has one filled button, and nothing saturated on it is larger. Every other action is outlined or quieter, and the fill never spreads to a ground, a card, a header or a sidebar.
The accent marks what is on
Settings
Each change applies at once
Email the customer 3 days before an invoice is due.
Email again when an invoice is 7 days late.
Send each reminder to accounts@harbour.example too.
import { useId } from "react"
import { Button } from "@/components/ui/button"
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Switch } from "@/components/ui/switch"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { Screen, ScreenBody, ScreenHeader, ScreenSidebar, ScreenToolbar } from "~/components/principles/screen"
const groups = [
{
value: "reminders",
label: "Reminders",
rows: [
{ name: "Before the due date", line: "Email the customer 3 days before an invoice is due.", on: true },
{ name: "After the due date", line: "Email again when an invoice is 7 days late.", on: true },
{ name: "A copy for me", line: "Send each reminder to accounts@harbour.example too.", on: false },
],
link: "Preview the reminder",
},
{
value: "payments",
label: "Payments",
rows: [
{ name: "Card payments", line: "Customers pay by card from the invoice's link.", on: true },
{ name: "Bank transfers", line: "Show the studio's bank details on every invoice.", on: true },
{ name: "Part payments", line: "Let a customer pay an invoice in instalments.", on: false },
],
},
{
value: "numbering",
label: "Numbering",
rows: [
{ name: "Prefix", line: "Number invoices INV-2051, INV-2052 and so on.", on: true },
{ name: "Restart each year", line: "The first invoice of a year takes the number 0001.", on: false },
],
},
]
export default function TheAccentMarksWhatIsOn() {
const id = useId()
return (
<Screen sidebar={<ScreenSidebar current="Settings" />}>
<ScreenHeader title="Settings" line="Each change applies at once" />
<Tabs defaultValue="reminders" className="min-w-0 flex-1 gap-0">
<ScreenToolbar>
<TabsList variant="line" aria-label="Settings" className="-ml-3.5">
{groups.map(({ value, label }) => (
<TabsTrigger key={value} value={value}>
{label}
</TabsTrigger>
))}
</TabsList>
</ScreenToolbar>
<ScreenBody>
{groups.map(({ value, rows, link }) => (
<TabsContent key={value} value={value} className="flex flex-col gap-4">
<FieldGroup className="max-w-sm">
{rows.map(({ name, line, on }, index) => (
<Field key={name} orientation="horizontal">
<FieldContent>
<FieldLabel htmlFor={`${id}-${value}-${index}`}>{name}</FieldLabel>
<FieldDescription id={`${id}-${value}-${index}-line`}>{line}</FieldDescription>
</FieldContent>
<Switch
id={`${id}-${value}-${index}`}
defaultChecked={on}
aria-describedby={`${id}-${value}-${index}-line`}
/>
</Field>
))}
</FieldGroup>
{link ? (
<Button variant="link" className="self-start px-0">
{link}
</Button>
) : null}
</TabsContent>
))}
</ScreenBody>
</Tabs>
</Screen>
)
}
The accent marks what is on, selected, focused or linked: here the switches, the current tab, the current destination's icon and the link. Press Tab and the focus ring takes it too.
Status is a tint and a word
INV-2051, due 4 November
INV-2050, due 28 November
INV-2048, paid 18 November
INV-2047, not sent yet
import { Badge } from "@/components/ui/badge"
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemSeparator, ItemTitle } from "@/components/ui/item"
const invoices = [
{ number: "INV-2051", customer: "Brightwater Dental", detail: "due 4 November", status: "Overdue", tone: "negative" },
{ number: "INV-2050", customer: "Kestrel Print Co", detail: "due 28 November", status: "Sent", tone: "info" },
{ number: "INV-2048", customer: "Pennant Cycles", detail: "paid 18 November", status: "Paid", tone: "positive" },
{ number: "INV-2047", customer: "Fernhill Bakery", detail: "not sent yet", status: "Draft", tone: "neutral" },
] as const
export default function StatusIsATintAndAWord() {
return (
<ItemGroup role="list" aria-label="Invoices and their status" className="max-w-md gap-0">
{invoices.map(({ number, customer, detail, status, tone }, index) => (
<div key={number} role="listitem">
{index > 0 ? <ItemSeparator className="my-0" /> : null}
<Item size="sm">
<ItemContent>
<ItemTitle>{customer}</ItemTitle>
<ItemDescription>
{number}, {detail}
</ItemDescription>
</ItemContent>
<ItemActions>
<Badge variant={tone}>{status}</Badge>
</ItemActions>
</Item>
</div>
))}
</ItemGroup>
)
}
Status is a badge: a pale tint of its hue with a dot and a word in the same hue, never a solid block and never colour alone. Green is good, amber is waiting, red is late or lost, and the accent never carries status.
A category is a same-hue pair
| Customer | Category | Outstanding |
|---|---|---|
| Brightwater Dental | Healthcare | £1,280.00 |
| Kestrel Print Co | Trades | £640.00 |
| Oakline Joinery | Trades | £2,400.00 |
| Pennant Cycles | Retail | £0.00 |
| Fernhill Bakery | Retail | £0.00 |
import { Badge } from "@/components/ui/badge"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
const tints = {
Healthcare: "bg-tint-mint text-tint-mint-foreground",
Trades: "bg-tint-peach text-tint-peach-foreground",
Retail: "bg-tint-blue text-tint-blue-foreground",
}
const customers = [
{ name: "Brightwater Dental", category: "Healthcare", outstanding: "£1,280.00" },
{ name: "Kestrel Print Co", category: "Trades", outstanding: "£640.00" },
{ name: "Oakline Joinery", category: "Trades", outstanding: "£2,400.00" },
{ name: "Pennant Cycles", category: "Retail", outstanding: "£0.00" },
{ name: "Fernhill Bakery", category: "Retail", outstanding: "£0.00" },
] as const
export default function ACategoryIsASameHuePair() {
return (
<div className="w-full max-w-md">
<Table aria-label="Customers by category">
<TableHeader>
<TableRow>
<TableHead>Customer</TableHead>
<TableHead>Category</TableHead>
<TableHead className="text-right">Outstanding</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{customers.map((customer) => (
<TableRow key={customer.name}>
<TableCell className="font-medium">{customer.name}</TableCell>
<TableCell>
<Badge className={tints[customer.category]}>{customer.category}</Badge>
</TableCell>
<TableCell className="text-right">{customer.outstanding}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
A category takes a tinted ground with its own hue as the text. A screen holds at most five saturated hues, status and charts included, and a test counts them on the built screen.
A chart in one hue
"use client"
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from "@/components/ui/chart"
const months = [
{ month: "May", lastYear: 2100, thisYear: 2650 },
{ month: "Jun", lastYear: 2400, thisYear: 3100 },
{ month: "Jul", lastYear: 1900, thisYear: 2300 },
{ month: "Aug", lastYear: 2800, thisYear: 3450 },
{ month: "Sep", lastYear: 3000, thisYear: 3900 },
{ month: "Oct", lastYear: 2600, thisYear: 3200 },
]
const config = {
lastYear: { label: "Last year", color: "var(--chart-3)" },
thisYear: { label: "This year", color: "var(--chart-3)" },
} satisfies ChartConfig
export default function AChartInOneHue() {
return (
<figure className="flex w-full max-w-md flex-col gap-3">
<ChartContainer config={config}>
<BarChart accessibilityLayer data={months} title="Payments received each month, this year and last">
<CartesianGrid vertical={false} />
<XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
<ChartTooltip content={<ChartTooltipContent />} />
<Bar dataKey="lastYear" fill="var(--color-lastYear)" fillOpacity={0.3} isAnimationActive={false} />
<Bar dataKey="thisYear" fill="var(--color-thisYear)" isAnimationActive={false} />
</BarChart>
</ChartContainer>
<figcaption className="text-center text-sm text-muted-foreground">
Payments received each month, in pounds. The paler bars are last year.
<span className="sr-only">
{" "}
May to October. Last year: 2,100, 2,400, 1,900, 2,800, 3,000, 2,600. This year: 2,650, 3,100, 2,300, 3,450, 3,900,
3,200.
</span>
</figcaption>
</figure>
)
}
A chart draws in one hue, the accent or ink, and a compared series is a ghost of the first. Gridlines are fainter than a card's edge.
Hierarchy by neutrals before size
Brightwater Dental is 16 days late on INV-2051
Pennant Cycles paid INV-2048
Kestrel Print Co opened INV-2050
Oakline Joinery was sent INV-2049
import { Item, ItemActions, ItemContent, ItemGroup, ItemSeparator } from "@/components/ui/item"
const activity = [
{ who: "Brightwater Dental", what: "is 16 days late on INV-2051", when: "Today" },
{ who: "Pennant Cycles", what: "paid INV-2048", when: "2 days ago" },
{ who: "Kestrel Print Co", what: "opened INV-2050", when: "5 days ago" },
{ who: "Oakline Joinery", what: "was sent INV-2049", when: "6 days ago" },
]
export default function HierarchyByNeutralsBeforeSize() {
return (
<ItemGroup role="list" aria-label="Recent activity" className="max-w-md gap-0">
{activity.map(({ who, what, when }, index) => (
<div key={who} role="listitem">
{index > 0 ? <ItemSeparator className="my-0" /> : null}
<Item size="sm" className="text-base">
<ItemContent>
<p>
{who} <span className="text-muted-foreground">{what}</span>
</p>
</ItemContent>
<ItemActions className="text-subtle-foreground">{when}</ItemActions>
</Item>
</div>
))}
</ItemGroup>
)
}
The name, the event and the time are one size and one weight, set apart by three neutrals. A quieter neutral comes before a smaller size or a heavier weight.
Four text sizes and two weights
Home
3 invoices awaiting payment
| Invoice | Customer | Status | Amount |
|---|---|---|---|
| INV-2051 | Brightwater Dental | Overdue | £1,280.00 |
| INV-2050 | Kestrel Print Co | Sent | £640.00 |
| INV-2049 | Oakline Joinery | Sent | £2,400.00 |
import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { Screen, ScreenBody, ScreenHeader, ScreenSidebar } from "~/components/principles/screen"
const metrics = [
{ label: "Outstanding", figure: "£4,320.00", line: "3 invoices" },
{ label: "Overdue", figure: "£1,280.00", line: "1 invoice" },
{ label: "Paid this month", figure: "£915.00", line: "1 payment" },
]
const awaiting = [
{ number: "INV-2051", customer: "Brightwater Dental", status: "Overdue", tone: "negative", amount: "£1,280.00" },
{ number: "INV-2050", customer: "Kestrel Print Co", status: "Sent", tone: "info", amount: "£640.00" },
{ number: "INV-2049", customer: "Oakline Joinery", status: "Sent", tone: "info", amount: "£2,400.00" },
] as const
export default function FourTextSizesAndTwoWeights() {
return (
<Screen sidebar={<ScreenSidebar current="Home" />}>
<ScreenHeader title="Home" line="3 invoices awaiting payment" />
<ScreenBody>
<div className="grid grid-cols-3 gap-3">
{metrics.map(({ label, figure, line }) => (
<Card key={label} size="sm">
<CardHeader>
<CardDescription>{label}</CardDescription>
<CardTitle className="text-xl">{figure}</CardTitle>
</CardHeader>
<CardContent className="text-sm text-muted-foreground">{line}</CardContent>
</Card>
))}
</div>
<div className="-mx-3">
<Table aria-label="Invoices awaiting payment">
<TableHeader>
<TableRow>
<TableHead>Invoice</TableHead>
<TableHead>Customer</TableHead>
<TableHead>Status</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{awaiting.map((invoice) => (
<TableRow key={invoice.number}>
<TableCell className="font-medium">{invoice.number}</TableCell>
<TableCell>{invoice.customer}</TableCell>
<TableCell>
<Badge variant={invoice.tone}>{invoice.status}</Badge>
</TableCell>
<TableCell className="text-right">{invoice.amount}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</ScreenBody>
</Screen>
)
}
A screen uses at most four text sizes, each a type role of the foundation, and two weights; only a metric figure takes a fifth size. The title sits one role above body, and a test counts the sizes on the built screen.
Depth by tone, then hairline, then shadow
- Contact
- Imogen Vale
- Terms
- 30 days
- Billed
- 2 invoices
import { MoreHorizontalIcon } from "@keyline-icons/react"
import { Button } from "@/components/ui/button"
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
const facts = [
{ label: "Contact", value: "Imogen Vale" },
{ label: "Terms", value: "30 days" },
{ label: "Billed", value: "2 invoices" },
]
export default function DepthByToneThenHairlineThenShadow() {
return (
<Card className="w-full max-w-sm">
<CardHeader>
<CardTitle>Oakline Joinery</CardTitle>
<CardDescription>Customer since March 2024</CardDescription>
<CardAction>
<DropdownMenu>
<DropdownMenuTrigger
render={<Button variant="ghost" size="icon" aria-label="Actions for Oakline Joinery" className="-mr-2" />}
>
<MoreHorizontalIcon />
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-44">
<DropdownMenuItem>Create invoice</DropdownMenuItem>
<DropdownMenuItem>Send statement</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive">Delete customer</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</CardAction>
</CardHeader>
<CardContent className="flex flex-col gap-3 text-base">
<dl className="divide-y divide-border">
{facts.map(({ label, value }) => (
<div key={label} className="flex justify-between gap-4 py-2">
<dt className="text-muted-foreground">{label}</dt>
<dd>{value}</dd>
</div>
))}
</dl>
<div className="flex justify-between gap-4 rounded-md bg-muted px-3 py-2">
<span className="text-muted-foreground">Outstanding</span>
<span className="font-medium">£2,400.00</span>
</div>
</CardContent>
</Card>
)
}
Tone sets the total apart, a hairline holds the card and its rows, and a shadow is kept for what floats. Open the menu to see the only shadow here.
Where the colours come from
The accent, the tints and the chart series are the product's own, set once on the foundation: see The base layer and Theming. The limits a test counts here, one fill, five hues and four text sizes, are among the Budgets on Composing a screen.