Verge

Row actions that rest hidden and appear on hover, on focus, and always on touch. They hold their space throughout, so nothing moves.

@patternmode/verge

  • Evergreen#315C4B
  • Saffron#D9A441
  • Oxblood#9B3D32
  • Linen#E1EBE5

At rest, pointed at, and reached by Tab. The hex values never move.

Reference

States and variants

Only opacity and pointer events change. The slot takes the same width at rest and revealed.

  • Two controls
    One control

    Rows align on one column

    slots={3}
  • On a touch screen

    Always visible, 48px targets

    @media (hover: none)
  • Menu open

    Stays while its menu is open

    aria-expanded="true"
  • Saving

    Held open mid-action

    visible

Install and use

Wrap the whole row in Verge.Root, not just the controls. Needs Tailwind CSS v4.

npm i @patternmode/verge
import { Verge } from "@patternmode/verge";
import "@patternmode/verge/styles.css";

<Verge.Root as="li">
  <span>{item.name}</span>
  <Verge.Slot slots={2}>
    <IconButton label="Edit" />
    <OverflowMenu />
  </Verge.Slot>
</Verge.Root>

Core API

Verge.Root

The container whose hover and focus state the slots read. Wrap the whole row, not just the controls: the reveal responds to the user addressing the row. Contributes no appearance of its own.

as
ElementType"div"Element or component to render as, so a row inside a list can be an li and a cell can be a td.

Verge.Slot

The reserved area holding the controls.

slots
numberHow many controls' worth of width to hold open. Only needed when controls must align into a column across rows carrying different numbers of them. Width per control comes from --patternmode-verge-slot-size.
visible
booleanfalseKeeps the slot revealed regardless of pointer or focus, for state the CSS cannot see such as an action mid-flight. Not an escape hatch for one row mattering more - a control drawn on every row at rest is furniture.
as
ElementType"div"Element or component to render as.

What it already handles

The reveal contract

Registries ship the button, the dropdown and the tooltip: the things being revealed. None ships the contract governing when they appear, which is where hand-rolled versions drift apart.

Keyboard
:focus-withinTabbing into the row reveals the slot, via :focus-within on the root. Children stay in the tab order at rest, which is what lets focus arrive at all. Spelling this focus-visible is the defect that recurs: it reveals the overflow menu two elements away but not the checkbox beside it.
Touch
@media (hover: none)No hover exists on a touch surface, so nothing hides. Handled with a media query, not a tap handler. Controls also take a wider gap on coarse pointers, because permanently-visible controls 2px apart are not separable by a thumb.
Open menus
[data-popup-open] | [data-state="open"] | [aria-expanded="true"]A slot holding an open menu, popover or disclosure stays revealed, so the overflow control does not vanish when the pointer travels to the menu it just opened.
Layout stability
opacity + pointer-eventsOnly opacity and pointer-events change. The slot occupies its space at rest and revealed alike, so the row's geometry never shifts under the pointer.
Nesting
inherited custom propertiesRoots may nest. A nested root shadows its ancestor's state for its own subtree, so pointing at an outer row does not reveal an inner row's controls.
Reduced motion
@media (prefers-reduced-motion: reduce)The transition is dropped under prefers-reduced-motion: reduce.

What you must handle: touch hit areas

/* Verge reserves the slot; it does not own your button. On touch the
   controls are permanently visible, so each needs a 48x48px hit area. */
@custom-variant pointer-fine (@media (pointer: fine));

Theming

Custom properties

Every knob is a custom property, so retune without forking.

--patternmode-verge-slot-size
length1.75remWidth one control reserves, used by slots.
--patternmode-verge-duration
time120msReveal transition duration.
--patternmode-verge-easing
easing-functioncubic-bezier(0.2, 0, 0, 1)Reveal transition easing.

Keyboard and accessibility

Keyboard and touch work without extra wiring. Touch hit areas are yours to size.

Tab
Tabbing into the row reveals the slot. Controls stay in the tab order at rest.
Touch
Nothing hides, and controls get a wider gap. Give each one a 48×48px hit area.
as
Renders the real element, so a row in a list can be an li and a cell a td.
Reduced motion
The fade is dropped.

Package

Package
@patternmode/verge
Version
0.1.8
Needs
react, react-dom
Licence
MIT