Foundations
States
How hover, press, focus, selection, located, unread, disabled, error, busy and autofill look, shared by every component.
Every component shows its interaction states the same way. A component doc only describes a state when it differs from this page.
Principles
- Hover and press add an overlay, in two tiers. They never change the fill; see Motion. Large things people read hover with the subtle tier, small controls with the medium tier, and anything clickable presses with the medium tier (Hover and press). Selected items don't respond to hover, and fields don't hover. Text that can be clicked has no box to lay an overlay on, so it underlines on hover instead (Clickable text). One named exception: a collapsible group heading only darkens (Collapsible group headings).
- Selection has three meanings, and three looks. Where you are in navigation is yellow (
selected, in every theme: Themes; on the frame, such as the rail, it takes the theme's frame colors), the item singled out in content is cyan, and a chosen value is ink. - Disabled looks the same everywhere and doesn't react to hover or press. One exception: a control that shows on or selected by its color keeps that color when disabled, so on and off never differ only by position (Switch).
Usage
Hover and press
Hover says "the pointer is here, and this is what a click acts on"; press confirms the click. Both lay one translucent layer of ink over the resting color, never a different fill, so the step looks the same on white, on the yellowish sidebar and on a card. There are two tiers, sized by what is under the pointer, not by which token a component happened to use: before, raft-ui had nine ways to turn a thing gray, from a step of 2.1 to 8.4 (OKLab ΔE × 100), and two cards that look alike hovered at 2.7 and 5.7.
- Subtle for what people read. A message can be twenty lines tall and a row runs the width of the panel; the pointer rests on them while someone reads. A small step shows on a large area, and body text loses at most 6 APCA Lc on it,
foreground-hintstays at 4.5:1 or more on every surface (Contrast). Messages used to hover lighter than rows (3% and 2.2%) and readable cards heavier (7.8%); now a row, a message and a card on the same screen step the same. - Medium for small controls. A 32px button needs a clear answer under the pointer, and nobody reads through it. The alphas differ by backdrop so the step looks the same: the same ink shows more on dark, yellow and pink, so dark mode takes 6.5%, a sticker and the yellow frame 10%, the dark frame 6%.
- Anything clickable presses with the medium tier, except a collapsible group heading (Collapsible group headings). A press lasts a moment and confirms the click, so it may be strong: rows, cards, chips, badges, mentions and the selected sticker (a selected segment, toggle, tab or sidebar item lays
sticker-medium). A control hovers and presses with the same tier: there is no third, stronger press tier. A message has no press: the row itself is not an action (a click selects text or lands on a link, a name or a button inside it), so its hover only marks what the toolbar and the menu act on. - Joined frameless parts hover as one control. This is for frameless parts only. When two frameless parts touch to make one control, an action and the ▾ that opens its menu (split actions), the part under the pointer takes the medium tier and its joined neighbour the subtle tier,
fill-subtle. Each part hovering alone, with its own square, read as two unrelated buttons side by side; lighting the whole shape says they belong together, and the darker part still says which one a click acts on. The same holds while a part is pressed on or its menu is open: the neighbour keeps the subtle tier. Only parts that touch take this, never two buttons that merely sit next to each other with a gap. Frameless parts take the tint because nothing else joins them at rest. Parts with a fill or a border (split buttons) already draw one shape with their fill, their edge and the divider between them, so there the neighbour stays at rest and only the part under the pointer takes its medium tier. - A row with its menu open is subtle, hovered or not. Every row, a message or any other, takes
fill-subtle(a list cell itsfill-cell-hover) while a menu or popup it opened is up (data-popup-openon the row, or on a button inside it); a selected row keeps its selection. On a phone, which has no hover, it is the sign of which row the menu acts on (2.5 to 2.9 off every row surface). With a mouse it is the hover it already had, so the two never stack. - Under selection. Both gray tiers stay under the selection tints on the same surface, so a hover never reads as selected: on paper
info-softis 6.4 (light) and 4.6 (dark),brand-soft8.1 and 6.1. Hover stays neutral ink; selection keeps its color (Selected: content). - Selected items don't respond to hover. Selection is the strongest signal on the item; darkening it on hover adds nothing and makes it look like something else. A selected segment or toggle, like a selected tab and the active sidebar item, keeps its look under the pointer; pressing it lays the medium tier.
- The yellow highlight is the popup's cursor, not a gray. It moves with the pointer and the keyboard alike. In dark mode it is 20% yellow: at 16% it was 5.0, weaker than the button hover beside the popup.
- Fields don't hover. A field's states are its caret, its focus ring and its error; a hover would say "click here to act" on something you type into. The select trigger and the top bar's search box are drawn as fields, so they don't hover either; pressing them still lays the medium tier.
- One signal. A hover never adds a second change to its surface: no border, shadow or fill change beside the overlay. One exception: a frameless control whose icon or label rests in
foreground-mutedorforeground-hint(a field's clear and chevron buttons, the system-message disclosure, an icon button) steps that content toforegroundwith its overlay, the way clickable text steps to ink; the content answers, the surface doesn't change twice. - Media hovers with
ink-8. An image in a message has no resting fill to lay a tier on, and the button that opens it covers the whole picture (MessageImageGalleryPreview): it laysbg-ink-8on hover, at once like every hover (Motion), with no new token. An avatar that opens a profile is media too: it lays the sameink-8over its face, under its corner light (Avatar). In light mode ink is near black and the picture dims; in dark mode it is near white and the picture lifts, the same direction as every other hover in dark mode. Never hover media with abrightnessfilter: it multiplies, so a dark photo, the usual one on a dark page, moved by about one level in 255 and showed no hover at all. - Media in a pressable card takes the card's tier on top. A card's tier is its background, under its content, so text and icons keep their ink; an opaque picture in it (a screenshot, a cover image) hides that background, and only the rows around it would step. So the card lays the same tier, subtle on hover and medium on press, over the picture too, and the whole card steps as one (MessageEmbed,
MessageEmbedCover). Badges and buttons laid on the picture stay above it; the picture itself stays in flow, so the tier paints over it. This is the card's tier, not media's ownink-8: the picture isn't what the pointer acts on alone, the card is. A part with no fill of its own, such as text on the card's background, takes no second tier: the card's already shows through. - Only with a pointer that hovers. Every hover applies under
@media (hover: hover): Tailwind'shover:does this, and the CSS files wrap their:hoverrules in the same query. On a touch screen a hover would stay on the last thing tapped.
Use the overlay utility (overlay-subtle, overlay-medium, overlay-sticker-medium, overlay-frame-medium) on anything with a fill of its own, and the color (bg-fill-subtle, bg-fill-medium, bg-fill-frame-medium) on a transparent control. Neither fades: hover and press change at once (Motion).
The rows of a list (Activity items, sidebar rows, search results, ListRow with cell) draw these states on an inset rounded shape instead of the whole row, with their own tokens: fill-cell-hover and fill-cell-press are the subtle and medium tiers in light, and step up in dark (7.5% and 12% paper) so the smaller shape still reads on a dark surface. The global tiers above don't change (Lists).
Clickable text
Text that does something or goes somewhere, with no box, chip or fill around it: a TextLink, a mention of someone else, a sender's name, the text actions under a message, a toast's action.
- Show no underline at rest, and underline the text on hover in its own color: the underline is the one hover signal for clickable text everywhere, so people learn it once. At rest, its color, its weight and where it sits say it can be clicked.
- Never turn clickable text pink on hover. Pink is the one primary action on the screen (Color); a color change on hover is only the step from a muted color to the ink of body text.
- Give text that cannot be clicked no hover change at all, and take the hover underline away from clickable text when it is disabled, so a change on hover always means "this can be clicked".
- Exception: a link inside rendered message or document text (Markdown) keeps an underline at rest, because the link blue alone is too close to the body text around it: below the 3:1 that WCAG 1.4.1 asks of a link told apart by color alone. The underline is quieter at rest and takes the full color on hover; the values are in Markdown.
- Chips, cards, badges, buttons and tabs are not clickable text: they keep their hover tier or their own hover.
Located
Located answers "where did that take me?". After a jump, the item someone arrived at shows info-soft at once, holds it, and fades out: a link to a message, a search result or Activity item that opens a message, Back to the list a result was opened from, the passage or table row a file comment is anchored to, the rows a bulk change touched. It is one look for one meaning, whatever the item is: a message, a list row, a table row or a region of a file.
- Cyan, because it singles out an item in content, as Selected: content does. It is not a selection, so it goes away by itself; a selection stays until people change it. The current match of a search inside a page is a selection: it stays
info-softwhile that search is open, and doesn't fade. - Layered over the item's own fill, not in place of it: the row's surface is still there and comes back as the cyan fades. A message lays it as its row fill, so the ring around a delegated face matches the row (MessageItem).
- No shape of its own. The highlight takes the shape the item's hover has. A message and the rows of a sheet run from edge to edge of their panel and stay square. The rows of a list (Activity items, sidebar rows, search results, ListRow with
cell) are list cells: the highlight fills their inset rounded shape, as tall as the row and 8px from each side, infill-cell-selected(info-softin light, a stronger cyan in dark), and the row stays transparent (Lists). An item with its own radius has the highlight clipped to that radius. A region of a file is marked the same way: a square fill with no border. - A stronger mark wins. An item that is already selected, current, a search match, checked, or has its menu open isn't located: its own mark already says where it is, and the highlight must never take it away, not even for 2 seconds.
- No hover while it lasts, but a press shows. The pointer often rests where the item lands, and a gray hover would hide the cyan, so a located item doesn't answer hover. A press is an action, so it lays the medium tier as always.
- Start it when the item is on screen, after the scroll that brings it there, not when the jump is asked for: a highlight that ran out while the list was still loading was never seen. New messages and loaded pages don't restart it; a new jump does, also to the same item.
- Reduced motion: the same 2 seconds, held still, then off with no fade (Motion).
- Held by a tour stop. A coach mark's target keeps the wash at full
info-soft(fill-cell-selectedon a list row) for as long as its stop is open, with no fade, and loses it when the stop closes (Coach marks): the person is reading about it, not looking for it. It is the only located mark that doesn't time out. raft-ui's CoachMark setsdata-located="held"on its target and removes it; don't set it by hand. - Not for success. The rows a bulk change touched are located, not green: the receipt already says the change worked, and the highlight only shows which rows it was.
- Only a look. A screen reader doesn't see the highlight, and a keyboard user needs more than a color. A jump started from the keyboard also moves focus to the item (
tabIndex={-1}, thenfocus({ preventScroll: true })after the scroll), so keyboard and screen reader users land on it. A jump started with the pointer leaves focus where it was, in the composer for instance. - Focus on the item is the inset ring. The focused item draws the inset ring (
outline-none focus-visible:keyboard:inset-ring-2 focus-visible:keyboard:inset-ring-foreground, Focus), never the browser's outline: the browser draws its outline outside the item, with rounded corners of its own, so on a message it frames the transparent gap above the row instead of its fill, and a scroller that ends at the row's edge cuts it off. The ring sits inside the item and takes its shape, as the highlight does: square on a message, on the inset rounded shape of a list row, the item's own radius otherwise. It shows only after keyboard input, like every ring, so it marks a jump started from the keyboard and nothing else; it stays while focus does, after the cyan has faded. An item that is a button or a link (an Activity item, a search result, a Saved row) takes focus on that control and shows the ring it already has. - A message is announced as an article named by its sender and its time (MessageItem gives its row
role="article"andaria-labelledbyon its name and time), so a screen reader landing on it says whose message it is and when, before the text. A continuation row, which shows no name, is named by its time; a row with neither a name nor a time stays a plain container, since an article with no name is announced with nothing to tell it apart. - Drive it with
useLocated(request)from raft-ui: pass a new request for each jump once the item is on screen (a counter or token that changes on every jump, a string or number; not the item's id, which stays the same on a second jump), and setdata-located(MessageItem'slocated) while it returns true; styles.css runs the animation. The hook turns it off afterLOCATED_MSand restarts it on the next jump, also to the same item: setting the attribute again while it is on doesn't restart the animation, only removing it for a frame does. Left on, the attribute keeps hiding hover, so don't set it by hand, and don't write your own flash or timer.
Dimmed
Something that is there but not active, a deleted agent's avatar, an offline slot, a message or a chip still pending, a task being changed, is drawn at 60%, with the opacity-dimmed utility (the opacity-dimmed token, 0.6).
- Two values, two meanings. 60% says "here, but inactive". 40% says "this is where it was": only the place a dragged item came from takes it (
data-drag-origin, Drag and drop), so the two never read alike. Don't give either meaning another value, such as 30% or 70%. - A disabled switch that is on is dimmed, not gray. It is there and on, but can't be changed: the 60% says inactive, and the yellow it keeps says on (Switch).
- A deleted person or agent is gray as well as dimmed (
grayscalewithopacity-dimmed): their colors are their identity, and gray says it is gone. - Something loading in place is veiled, not dimmed. An image uploading or a preview being prepared takes a
layer-veilcover and a spinner (Busy), so it reads as "working", not as "inactive".
Collapsible group headings
A heading that folds the group under it, such as a status heading in the Tasks section (Tasks), is a named exception to Hover and press and Clickable text: it has a box, but lays no overlay, and its words can be clicked, but don't underline.
- On hover, turn its words and its chevron from
foreground-hinttoforeground, with no fill and no underline. A heading is a label over its rows, not a row: a fill would read as one more row in the list, and an underline would make the group's name read as a link that goes somewhere. - On press, show the same as hover, with no pressed fill: a press fill would flash that extra row for a moment.
- On keyboard focus, show the inset ring (
inset-ring-2inforeground, with thekeyboard:variant; see Focus), so the heading still says where focus is. - Only a heading that folds its group takes this. A heading that does nothing has no hover at all (Clickable text).
Focus
Focus uses focus-ring (Elevation), and it shows only when the person's last navigation input was the keyboard. The ring answers "where am I?" for someone moving with Tab and the arrow keys. A person who clicks or taps already knows where they are, since they just pointed there, and the caret marks a text field they clicked. A ring that shows up on every click, and stays on the always-focused composer, distracts and tells them nothing.
- Show the ring after keyboard navigation: Tab, Shift+Tab and F6 anywhere; the arrow keys, Home, End, Page Up, Page Down, Enter, Space and Esc outside a text field. Tabbing into a text field shows the full ring.
- Inside a text field those keys edit, so they keep the modality as it was, unless focus leaves the field right after: Esc closing the dialog the field is in, Enter submitting it, Left Arrow moving from a combobox's text to its chips. Then the person is on the keyboard, and the element focus lands on shows the ring.
- Show no ring after a click or a tap, and none when code moves focus after one (a dialog that focuses its first field, a popup that focuses its search row). A text field clicked with the mouse shows only its caret: no ring and no border change.
- Typing doesn't count as navigation. Letters, and Enter, Space and the arrow keys inside a text field, keep the modality as it was, so the composer stays quiet while someone types in it after clicking, and keeps its ring when they tabbed into it.
- Cmd and Ctrl shortcuts, and modifier keys pressed alone, don't count either. A shortcut that moves focus somewhere without a caret still gets the ring when nothing else explains the move (next rule); a shortcut that sends focus to a text field (Cmd+K) shows its caret.
- Show every ring when the input isn't a pointer we can see: before any input (the page just loaded; a keyboard user who hasn't pressed Tab yet), when focus arrives with no key or press just before it (a screen reader's browse cursor, a timer), and when a screen reader synthesizes a press (VoiceOver, TalkBack). Only a real pointer press, or real mouse movement before anything else, hides the ring. Keyboard and screen-reader users never lose it (WCAG 2.4.7).
- Ring the whole group for compound controls: the composer, an input with a prefix or suffix, a multi-select field. The group rings only when an element inside it has keyboard focus (
has-focus-visible), not for any focus inside it (focus-within): clicking the clear button of a search field doesn't ring the field. - Ring the box of a checkbox or radio. A hidden native input drives it.
- Keep the ring whole where something around the element clips what is past its box: a row or a list that scrolls (
overflowclips on both axes even when it scrolls on one), an edge fade (a mask clips too), a frame withoverflow-hidden. A ring with two sides doesn't read as a ring. First make room: the container keeps the ring's reach (4px forfocus-ring) inside its box as padding and gives it back with a negative margin, so its content stays on the content's edge, and the ring stays outside the element, as on a row of sticker tabs. Where the container can't make room (a menu's search row, a sidebar row), draw the ring inside the element, the inset ring (focus-visible:keyboard:inset-ring-2 focus-visible:keyboard:inset-ring-foreground). When the element's content runs to its sides, as an underline tab's text does, draw the ring on a shape of its own around the content, inside the container's room (Tabs) (raft-design #1447).
raft-ui implements the rule with installInputModality(). ThemeProvider installs it, so an app that uses ThemeProvider gets it with no code of its own. It keeps data-input-modality on document.documentElement: absent until there is evidence, then pointer, keyboard or virtual. Only while it says pointer does styles.css empty focus-ring, in light and dark mode and in light or dark islands; every other value, and no value, shows the rings.
- Draw a focus indicator with
focus-visible:shadow-focus(has-focus-visible:shadow-focuson a group), neverfocus:orfocus-within:. - Stack the
keyboard:variant on any indicator not drawn withfocus-ring, such as an outline or the inset ring:focus-visible:keyboard:outline-2 focus-visible:keyboard:outline-line-strong. It matches unless the last input was a pointer.
Taps on a touch screen
A touch screen has three gestures on one item: tap, double tap, press and hold. Each means one thing everywhere, so a person learns them once.
- Tap does what a click does: open the item, or run its control.
- Double tap only opens a bar of quick choices, never acts by itself, so a stray double tap changes nothing. Give an item a double tap only when it has such a bar; then its tap waits about 250ms for the second one, and the item shows its press state at once so the wait doesn't read as no response.
- Press and hold opens the item's menu (Dragging on a touch screen for items that move).
- A touch is not a tap when it moves more than 10px (a scroll), when it stops a list that is still scrolling (it only stops it), or when it lands on a control inside the item (a link, a button, an image, a reaction): that control takes it.
- Screen readers activate with a double tap and have no hold, so every gesture is also an accessibility action on the item, and the menu is reachable from a visible control.
Dragging on a touch screen
On a touch screen one long press can mean two things on an item that can be moved: its menu, or picking it up. Holding still is the menu; holding and then moving is the drag. This is how iOS separates them, and it means the menu and the drag never fight over the same moment.
- Arm an item after the finger holds still for 500ms, the moment raft-ui's long-press menu opens (
ContextMenuTrigger), a tooltip opens on touch (Tooltip) and iOS's long press fires, so a menu and the armed item arrive together. A long press belongs to the layer that owns it: a tooltip inside a draggable item or a long-press menu (markeddata-long-press-owner) leaves the hold to them. Android's own long press comes at 400ms: its menu shows first and stays until the drag starts. - Start the drag on the first move of 10px after that.
- Let go of the item if the finger moves more than 10px before the 500ms are up (that was a scroll), or if a second finger comes down (a pinch).
- Lifting the finger after the hold without moving leaves the menu open and moves nothing.
- Close the item's menu when its drag starts. The component that owns the menu closes it: an app that puts its own menu on a draggable item closes it in the drag's
onDragStart(SortableTabsListpasses one through). - A tab in a pane's tab bar opens its menu when the finger lifts after the hold, not while it is down: a hold that then moves is only the drag, and the menu never opens under a tab that is being moved between panes (Tabs and panes; the tabs prototype v9, #proj-workspace:#480, pending stdrc).
- Use the same hold, distance and tolerance for everything that can be dragged by touch (sidebar rows, tabs, task cards, attachments in the composer): raft-ui's
useDragSensorscarries them (useHoldThenMoveTouchSensor, next to a pointer sensor that leaves fingers to it). A mouse or a pen still starts a drag after 6px of movement, with no hold. The rest of a drag, from the lifted copy to the drop, is in Drag and drop. - The one exception is a handle that floats over the page, has no menu and sits in no scrolling content, such as the assistant's Ottie: a finger that moves on it can only mean to move it, so its drag starts on the first move of 10px, with no hold. A tap that moves less opens it. Asking for a half-second hold there only slows the one thing a finger on it can mean, as a phone's own floating button doesn't (Grace and Jasper, 2026-11-12, #proj-assistant:#24). Such a handle takes
touch-none, so the browser doesn't read its first 10px as a scroll; anything in a list or with a menu keeps the hold and stays scrollable (below). - Don't let the held item select its text or open the platform's own callout (
select-none,-webkit-touch-callout: none), and keep it scrollable (touch-manipulation, nottouch-none).
Autofill
A field the browser filled in (a saved email or password) looks like any other field: layer-card with ink text.
- Never show the browser's autofill fill: Chrome's pale blue and Safari's yellow made the filled field the one field on the page that matched nothing else in the system, and the color says nothing a person needs.
- raft-ui's styles.css does this in Chrome and Safari for every
input,textareaandselecton the page, so an app needs no code of its own. A disabled autofilled field keeps the disabled ink.
Related
- Color: the tokens named here.
- Elevation: the focus ring.
- Feedback: where errors go, by scope.
- Drag and drop: the whole drag, from pick-up to drop.