@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
13 lines (12 loc) • 548 B
JavaScript
import React, { useEffect, useRef } from 'react';
import styles from './styles.css.js';
export var LiveRegion = function (_a) {
var message = _a.message, _b = _a.atomic, atomic = _b === void 0 ? true : _b;
var ref = useRef(null);
useEffect(function () {
if (ref.current !== null) {
ref.current.textContent = message;
}
}, [message]);
return (React.createElement("div", { ref: ref, className: styles.root, "aria-live": "assertive", "aria-atomic": atomic ? 'true' : 'false', key: "live-region" }));
};