@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
29 lines (27 loc) • 803 B
JavaScript
'use client';
import * as React from 'react';
import { useComboboxInputValueContext } from "../../combobox/root/ComboboxRootContext.js";
/**
* The current value of the autocomplete.
* Doesn't render its own HTML element.
*
* Documentation: [Base UI Autocomplete](https://base-ui.com/react/components/autocomplete)
*/
import { jsx as _jsx } from "react/jsx-runtime";
export function AutocompleteValue(props) {
const {
children
} = props;
const inputValue = useComboboxInputValueContext();
let returnValue = null;
if (typeof children === 'function') {
returnValue = children(String(inputValue));
} else if (children != null) {
returnValue = children;
} else {
returnValue = inputValue;
}
return /*#__PURE__*/_jsx(React.Fragment, {
children: returnValue
});
}