@react-awesome-query-builder-dev/ui
Version:
User-friendly query builder for React. Core React UI
26 lines (24 loc) • 621 B
JSX
import React from "react";
export default (props) => {
const {value, setValue, config, readonly, placeholder, maxLength, maxRows, fullWidth, customProps, } = props;
const onChange = e => {
let val = e.target.value;
if (val === "")
val = undefined; // don't allow empty value
setValue(val);
};
const textValue = value || "";
return (
<textarea
value={textValue}
placeholder={placeholder}
disabled={readonly}
onChange={onChange}
maxLength={maxLength}
style={{
width: fullWidth ? "100%" : undefined
}}
{...customProps}
/>
);
};