UNPKG

@wordpress/components

Version:
37 lines (36 loc) • 1.13 kB
import { contextConnect, useContextSystem } from "../context/index.mjs"; import { visuallyHidden } from "./styles.mjs"; import { View } from "../view/index.mjs"; import { jsx } from "react/jsx-runtime"; // packages/components/src/visually-hidden/component.tsx function UnconnectedVisuallyHidden(props, forwardedRef) { const { style: styleProp, ...contextProps } = useContextSystem(props, "VisuallyHidden"); return /* @__PURE__ */ jsx(View, { ref: forwardedRef, ...contextProps, "data-visually-hidden": "", style: { ...visuallyHidden, ...styleProp || {} } }); } /** * `VisuallyHidden` is a component used to render text intended to be visually * hidden, but will show for alternate devices, for example a screen reader. * * ```jsx * import { VisuallyHidden } from `@wordpress/components`; * * function Example() { * return ( * <VisuallyHidden> * <label>Code is Poetry</label> * </VisuallyHidden> * ); * } * ``` */ const VisuallyHidden = contextConnect(UnconnectedVisuallyHidden, "VisuallyHidden"); export { VisuallyHidden, VisuallyHidden as default }; //# sourceMappingURL=component.mjs.map