--- title: "Input" slug: input category: component type: examples version: 20.0.0 tokens: 1609 source: https://ovh.github.io/design-system/v20.0.0/llms/react-components-input--examples.txt --- # Input ## Default ```tsx ``` ## Disabled ```tsx ``` ## Read Only ```tsx ``` ## Clearable ```tsx ``` ## Loading ```tsx ``` ## Masked ```tsx ``` ## Types ```tsx <>






``` ## Floating Number ```tsx ``` ## Datalist ```tsx <> ``` ## In Form Field ```tsx Name: ``` ## Content Adornments ```tsx <> ``` ## Content Adornment With Button ```tsx ) } /> ``` ## Domain Availability Search ```tsx { const takenAddresses = ['admin', 'api', 'www']; const [address, setAddress] = useState(''); const [isChecking, setIsChecking] = useState(false); const [isTaken, setIsTaken] = useState(false); const checkTimer = useRef | undefined>(undefined); useEffect(() => () => clearTimeout(checkTimer.current), []); function onAddressChange(e: ChangeEvent): void { const value = e.target.value; const isLongEnough = value.length > 2; clearTimeout(checkTimer.current); setAddress(value); setIsTaken(false); setIsChecking(isLongEnough); if (isLongEnough) { checkTimer.current = setTimeout(() => { setIsChecking(false); setIsTaken(takenAddresses.includes(value.toLowerCase())); }, 700); } } return ( Public address Type at least 3 characters to check availability - "api" is already taken. This address is already taken. ); } ``` ## Login Form ```tsx { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [errors, setErrors] = useState<{ email?: string, password?: string }>({}); // `noValidate` hands validation over to the form: the browser never blocks the submit, // so the errors below are the only ones the user ever sees. function onSubmit(event: FormEvent): void { event.preventDefault(); setErrors({ email: email.length === 0 ? 'Enter the email address of the account admin.' : undefined, password: password.length < 12 ? 'This password is too short.' : undefined, }); } return (
Admin email ) => setEmail(event.target.value) } placeholder="you@example.com" startContent={ } type={ INPUT_TYPE.email } value={ email } /> { errors.email } Root password ) => setPassword(event.target.value) } value={ password } /> At least 12 characters. { errors.password }
); } ``` ## Accessibility Form Field ```tsx Name: ``` ## Accessibility Content ```tsx Weight: kg } /> ``` ## Accessibility I18n ```tsx Search: ```