brumate/ui

PreviewTrigger

A preview of a link or a button, such as a card of the author behind a name. It shows on hover, on focus from the keyboard, and on a long press of a touch.

Written byin 1843.

<script>
  import Button from '@brumate/ui/Button.brm';
  import Link from '@brumate/ui/Link.brm';
  import Popover from '@brumate/ui/Popover.brm';
  import PreviewTrigger from '@brumate/ui/PreviewTrigger.brm';
</script>

<p>
  Written by
  <PreviewTrigger>
    <Link class="ui-link" href="#preview-trigger">Ada Lovelace</Link>
    <Popover class="ui-popover" placement="bottom start" transition>
      <div class="ui-dialog">
        <strong>Ada Lovelace</strong>
        <p>Writes about engines and the numbers of Bernoulli.</p>
        <Button class="ui-button">Follow</Button>
      </div>
    </Popover>
  </PreviewTrigger>
  in 1843.
</p>

Closing

Keyboard

The preview renders at the end of the page, in a layer, so Tab moves between it and the page as if it came right after the trigger: