Raft Design System

Components · Data Display

SiteDomain

A site's domain where the app says which site a page is on, cut at its start when it doesn't fit, so its end, whose site it is, always shows.

ExperimentalAlso called Domain, Host, Origin, Address bar domain
import { SiteDomain } from "@botiverse/raft-ui/wip";

SiteDomain draws a site's domain where the app says which site a page is on: a built-in browser's address bar, the head over a page on another site, a web page's panel title. When the domain is longer than its room it loses its start, never its end. The end of a domain says whose site it is: accounts.google.com.sign-in.evil-example.net with its end cut off would read as Google.

site-domain/compositions/head

When to use

SituationUse
The domain of the page someone is on, in a head, an address bar or a panel titleSiteDomain
A web page's row that shows its path too (a web page opened beside a conversation)SiteDomain for the domain, and the path beside it as text cut at its end (Address rows)
A built-in browser's address barSiteDomain alone: the bar shows only the domain, the path is noise there (Navigation, rule 4)
A link's domain after a card button's label, or in a link previewText: it names where a link goes, not the page someone is on, and is written without the www. (MessageItem)
A file name, a title or another name too long for its rowEllipsis: it cuts at the end

Anatomy

  • SiteDomain: a span that cuts its text at the start, holding the domain in a left-to-right bdi. Its host is the domain. Required.

It draws the domain and nothing else. The Not secure badge, the path, the tooltip with the full address and any icon are the caller's, beside it.

Behavior

  • A domain that fits starts at the inline start, as every head and address does.
  • One that doesn't fit is cut at its start with an ellipsis: the box is laid right to left so the browser's text-overflow: ellipsis falls at the start, and the bdi keeps the domain itself, and text selected or copied from it, left to right. Find in page, copy and screen readers get the whole domain.
  • It shrinks in a flex row (min-w-0). Put it after whatever should give up its room first, and give that shrink.

Address rows

Only where the design shows a page's path as well, today the row of a web page opened beside a conversation, the domain comes first, in full and bold, and the path, query and fragment follow it, muted and cut at their end. The path gives up its room first (shrink-9999); the domain is cut, at its start, only once the path has gone. A built-in browser's address bar shows the domain alone, with no path (Navigation, rule 4). Never pass a whole address to SiteDomain: cut at its start, an address loses its domain first.

site-domain/compositions/address

Content

  • Pass the domain as URL.host gives it: ASCII (punycode, xn--…) for an internationalized domain, so a look-alike Unicode domain can't pass for another, and with its port when it has one. Don't drop www. or any other subdomain: a subdomain can belong to someone else.
  • On an http: page, show Not secure before the domain: a Badge with appearance="soft" and variant="warning", which doesn't shrink.
  • Put the full address in the row's title (or a Tooltip), so a cut domain can still be read in full.

Accessibility

  • It is text, with no role of its own. A screen reader reads the whole domain, left to right, whatever is cut.
  • A head or a panel that names its page by the domain uses it inside its heading element.

Rules

  • Cut a domain at its start, never its end: the end says whose site it is.
  • Draw only a domain with it. The path goes beside it, cut at its end.
  • Show the domain in ASCII form, as the browser's address does: a Unicode look-alike of another site's domain would read as that site.

API

SiteDomain

ExperimentalA site's domain where the app says which site a page is on. Too long for its room, it loses its start, never its end: the end says whose site it is. The right-to-left box puts the ellipsis at the start; the `<bdi>` keeps the domain itself, and text selected from it, left to right.
PropTypeDefault
host (required)The site's domain as `URL.host` gives it: ASCII (punycode) for an internationalized domain, with its port when it has one. Never a full address: the path goes beside it, cut at its end (site-domain.md).string

Also takes the attributes of its element.