16 lines
No EOL
632 B
JavaScript
16 lines
No EOL
632 B
JavaScript
import styles from '../styles/Textbox.module.css'
|
|
|
|
/**
|
|
* @param {string} text
|
|
*/
|
|
export default function Textbox(PROPERTIES) {
|
|
return (
|
|
<input className={styles.Textbox} type={PROPERTIES.type ?? 'text'} style={{width: PROPERTIES.width ?? '200px', ...PROPERTIES.style}} placeholder={PROPERTIES.placeholder ?? 'Type anything here!'} defaultValue={PROPERTIES.value ?? ""} onKeyDown={() => {
|
|
if (PROPERTIES.submitOnEnter && event.key === 'Enter' && PROPERTIES.submit) {
|
|
PROPERTIES.submit(event.target.value);
|
|
event.target.value = "";
|
|
}
|
|
}}
|
|
/>
|
|
)
|
|
} |