sterling-svelte  2.0.0
A modern, accessible, lightweight UI component library for Svelte.

Callout

A floating box of content with an arrow pointing at the reference element.

Code
<script lang="ts">
  import { Callout } from '@geoffcox/sterling-svelte';
  
  let reference: HTMLElement;
</script>

<div bind:this={reference}>
  <!-- TODO: the reference element content -->
</div>

<Callout open {reference}>
  <!-- TODO: the callout content -->
</Callout>

Members

Property NameTypeDefaultComment
conditionalRenderboolean | null | undefinedtrueConditionally renders content based on open
crossAxisOffsetnumber | undefined0The offset along the side of the reference element
mainAxisOffsetnumber | undefined0The offset towards or away from the side of the reference element
openboolean | null | undefinedfalseWhen true, the callout is open and visible
placementPopoverPlacement | undefined'top-start'How the callout should be positioned relative to the reference element
portalHostHTMLElement | undefinedundefinedThe host container for the callout
referenceHTMLElement | undefinedundefinedThe reference to the element anchoring the position of the callout

Considerations

  • Use Popover for floating content without the Callout style.
  • Includes HTMLDivElement props, events, and methods.

Anatomy

portal (<div>)
callout (<div>)
  children (Snippet)
  arrow (<div>)