Duostrap Async Region
A semantic aria-busy region container for Duostrap layouts that preserves children and focus during async updates.
Duostrap Async Region wraps asynchronously updating sections with aria-busy semantics inherited from Base Async Region without overwriting classic Duostrap wells, panels, or focus state.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<duostrap-async-region-root id="activity-region">
<p>Production deployment v2.4.1 completed cleanly.</p>
</duostrap-async-region-root>
<duostrap-button id="refresh-btn" variant="primary">
Refresh Activity
</duostrap-button>
<duostrap-button id="done-btn" variant="default">
Finish Refresh
</duostrap-button>
<script type="module">
import {
AdaptToWebComponent,
setElementProps,
} from '@proto.ui/adapter-web-component';
import { asyncRegionRoot } from '@proto.ui/prototypes-duostrap/async-region';
import button from '@proto.ui/prototypes-duostrap/button';
AdaptToWebComponent(asyncRegionRoot);
AdaptToWebComponent(button);
const region = document.querySelector('#activity-region');
document
.querySelector('#refresh-btn')
?.addEventListener('click', () => {
setElementProps(region, { busy: true });
});
document
.querySelector('#done-btn')
?.addEventListener('click', () => {
setElementProps(region, { busy: false });
});
</script>Installation
Section titled “Installation”Currently available from workspace source; available starting in 0.3.0-rc.1 and later releases. Import directly from the workspace subpath:
import { asyncRegionRoot } from '@proto.ui/prototypes-duostrap/async-region';import { useState } from 'react';import { AdaptToReact } from '@proto.ui/adapter-react';import { asyncRegionRoot } from '@proto.ui/prototypes-duostrap/async-region';
const BootstrapAsyncRegionRoot = AdaptToReact(asyncRegionRoot);
export function OrdersPanel() { const [busy, setBusy] = useState(false);
return ( <BootstrapAsyncRegionRoot busy={busy}> <p>Existing order rows and keyboard focus stay intact while refreshing.</p> </BootstrapAsyncRegionRoot> );}- Semantic-only projection: Archived Duostrap has no Async Region widget, so
duostrap-async-region-rootforwards Basebusyandaria-busysemantics without injecting extra paint or jQuery APIs. - Classic surface framing: Keep your Duostrap
#f5f5f5wells,#ffffffpanels,1px#ddddddborders,4pxcorners, and fixed14pxmetrics, and target[aria-busy="true"]for optional visual feedback. - Focus stability: Toggling
busykeeps descendants mounted and interactive; pair withduostrap-live-region-rootwhen assistive technology should announce refresh status.
Examples
Section titled “Examples”Focus-Preserving Refresh
Section titled “Focus-Preserving Refresh”Keep a Duostrap text input mounted and focused inside Async Region while refresh state toggles.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<duostrap-async-region-root id="draft-region">
<duostrap-input-root
default-value="Looks good — ready to ship."
aria-label="Draft reply"
></duostrap-input-root>
</duostrap-async-region-root>
<duostrap-button id="toggle-refresh" variant="primary">
Toggle Refresh
</duostrap-button>
<script type="module">
import {
AdaptToWebComponent,
setElementProps,
} from '@proto.ui/adapter-web-component';
import { asyncRegionRoot } from '@proto.ui/prototypes-duostrap/async-region';
import inputRoot from '@proto.ui/prototypes-duostrap/input';
import button from '@proto.ui/prototypes-duostrap/button';
AdaptToWebComponent(asyncRegionRoot);
AdaptToWebComponent(inputRoot);
AdaptToWebComponent(button);
const region = document.querySelector('#draft-region');
let busy = false;
document
.querySelector('#toggle-refresh')
?.addEventListener('click', () => {
busy = !busy;
setElementProps(region, { busy });
});
</script>Composed with Live Region
Section titled “Composed with Live Region”Pair duostrap-async-region-root with a classic Bootstrap info/success status banner wrapping duostrap-live-region-root.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<duostrap-async-region-root id="metrics-region">
<p id="metrics-value">$124,800 · +12.4% month over month</p>
</duostrap-async-region-root>
<duostrap-live-region-root
id="metrics-status"
politeness="polite"
atomic
>
Status: Monthly revenue is up to date.
</duostrap-live-region-root>
<duostrap-button id="reload-metrics" variant="primary">
Reload Metrics
</duostrap-button>
<duostrap-button id="apply-metrics" variant="default">
Apply Update
</duostrap-button>
<script type="module">
import {
AdaptToWebComponent,
setElementProps,
} from '@proto.ui/adapter-web-component';
import { asyncRegionRoot } from '@proto.ui/prototypes-duostrap/async-region';
import { liveRegionRoot } from '@proto.ui/prototypes-duostrap/live-region';
import button from '@proto.ui/prototypes-duostrap/button';
AdaptToWebComponent(asyncRegionRoot);
AdaptToWebComponent(liveRegionRoot);
AdaptToWebComponent(button);
const region = document.querySelector('#metrics-region');
const status = document.querySelector('#metrics-status');
document
.querySelector('#reload-metrics')
?.addEventListener('click', () => {
setElementProps(region, { busy: true });
status.textContent =
'Status: Refreshing monthly revenue metrics…';
});
document
.querySelector('#apply-metrics')
?.addEventListener('click', () => {
setElementProps(region, { busy: false });
status.textContent = 'Status: Monthly revenue updated.';
});
</script>Root (duostrap-async-region-root)
Section titled “Root (duostrap-async-region-root)”| Prop | Type | Default |
|---|---|---|
busy | boolean | false |
Exposed State (getExposes())
Section titled “Exposed State (getExposes())”| Handle | Type | Initial |
|---|---|---|
busy | ExposeState<boolean> | false |