Changelog Azalea Kit UI 101 Usage Customizing Utilities Form controls Laravel Vue FHIR Types Accessibility Icons Actions Button Button group Layout and structure Card Card section Care summary Care timeline Divider Empty state Footer Header Layout Stack Table Selection and input Calendar Checkbox Checkbox group Color picker Combobox Combobox option Input Input mask Memorable date Number input Option Phone input Radio Radio button Radio group Range Select SSN input Tag Textarea Toggle ZIP code input Images and icons Avatar Icon Icon button Logo Feedback indicators Badge Banner Progress bar Skeleton Skeleton body text Skeleton display text Skeleton thumbnail Spinner Typography Text Navigation Breadcrumb Breadcrumb item Dropdown Menu Menu item Menu label Navigation Nav group Nav item Nav toggle Pagination Tab Tab group Tab panel Top bar Tree Tree item User menu Overlays Dialog Popover Tooltip Utilities Collapsible FHIR address FHIR human name FHIR quantity FHIR questionnaire Format bytes Format date Format number Relative time Resize observer Split panel Tooltip Border Color Shadow Spacing Transition Typography Z-index Contributing Visual Tests Light Dark System

Resize Observer

<ahi-resize-observer> | AhiResizeObserver

The Resize observer offers a thin, declarative interface to the ResizeObserver API.

The resize observer will report changes to the dimensions of the elements it wraps through the ahi-resize event. When emitted, a collection of ResizeObserverEntry objects will be attached to event.detail that contains the target element and information about its dimensions.

Resize this box and watch the console 👉
<div class="resize-observer-overview">
  <ahi-resize-observer>
    <div>Resize this box and watch the console 👉</div>
  </ahi-resize-observer>
</div>

<script>
  const container = document.querySelector('.resize-observer-overview');
  const resizeObserver = container.querySelector('ahi-resize-observer');

  resizeObserver.addEventListener('ahi-resize', event => {
    console.log(event.detail);
  });
</script>

<style>
  .resize-observer-overview div {
    display: flex;
    border: solid 2px var(--ahi-border);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
  }
</style>

Importing

Script Bundler

To import this component using a script tag:

<script type="module" src="/path/to/azalea-kit-ui/dist/components/resize-observer/resize-observer.js"></script>

To import this component using a bundler:

import '@azaleahealth/azalea-kit-ui/dist/components/resize-observer/resize-observer.js';

Slots

Name Description
(default) One or more elements to watch for resizing.

Learn more about using slots.

Properties

Name Description Type Default
disabled Disables the observer. boolean false
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about properties and attributes.

Events

Name Description Event Detail
ahi-resize Emitted when the element is resized. { entries: ResizeObserverEntry[] }

Learn more about events.