import React from 'react'; import { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextInput, Wizard, WizardStep } from '@breakaway/preact-core'; interface SampleFormProps { value: string; isValid: boolean; setValue: (value: string) => void; setIsValid: (isValid: boolean) => void; } const SampleForm: React.FunctionComponent = ({ value, isValid, setValue, setIsValid }) => { const validated = isValid ? 'default' : 'error'; const handleTextInputChange = (_event, value: string) => { const isValid = /^\d+$/.test(value); setValue(value); setIsValid(isValid); }; return (
{validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
); }; export const WizardEnabledOnFormValidation: React.FunctionComponent = () => { const [ageValue, setAgeValue] = React.useState('Thirty'); const [isSubAFormValid, setIsSubAFormValid] = React.useState(false); const onSave = () => alert(`Wow, you look a lot younger than ${ageValue}.`); return ( Information content , Substep B content ]} /> Additional step content ); };