repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getCheckboxValue.ts | src/logic/getCheckboxValue.ts | import isUndefined from '../utils/isUndefined';
type CheckboxFieldResult = {
isValid: boolean;
value: string | string[] | boolean | undefined;
};
const defaultResult: CheckboxFieldResult = {
value: false,
isValid: false,
};
const validResult = { value: true, isValid: true };
export default (options?: HTMLIn... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/shouldRenderFormState.ts | src/logic/shouldRenderFormState.ts | import { VALIDATION_MODE } from '../constants';
import type {
FieldValues,
FormState,
InternalFieldName,
ReadFormState,
} from '../types';
import isEmptyObject from '../utils/isEmptyObject';
export default <T extends FieldValues, K extends ReadFormState>(
formStateData: Partial<FormState<T>> & {
name?: I... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getValidationModes.ts | src/logic/getValidationModes.ts | import { VALIDATION_MODE } from '../constants';
import type { Mode, ValidationModeFlags } from '../types';
export default (mode?: Mode): ValidationModeFlags => ({
isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
isOnBlur: mode === VALIDATION_MODE.onBlur,
isOnChange: mode === VALIDATION_MODE.onChange,
is... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getDirtyFields.ts | src/logic/getDirtyFields.ts | import deepEqual from '../utils/deepEqual';
import isNullOrUndefined from '../utils/isNullOrUndefined';
import isObject from '../utils/isObject';
import isPrimitive from '../utils/isPrimitive';
import isUndefined from '../utils/isUndefined';
import objectHasFunction from '../utils/objectHasFunction';
function isTraver... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/formStateWithNestedFields.cy.ts | cypress/e2e/formStateWithNestedFields.cy.ts | describe('form state with nested fields', () => {
it('should return correct form state with onSubmit mode', () => {
cy.visit('http://localhost:3000/formStateWithNestedFields/onSubmit');
cy.get('#state').should(($state) =>
expect(JSON.parse($state.text())).to.be.deep.equal({
isDirty: false,
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/basic.cy.ts | cypress/e2e/basic.cy.ts | describe('basic form validation', () => {
it('should validate the form and reset the form', () => {
cy.visit('http://localhost:3000/basic/onSubmit');
cy.get('button#submit').click();
cy.focused().should('have.attr', 'name', 'nestItem.nest1');
cy.get('input[name="firstName"] + p').contains('firstName... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/basicSchemaValidation.cy.ts | cypress/e2e/basicSchemaValidation.cy.ts | describe('basicSchemaValidation form validation', () => {
it('should validate the form with onSubmit mode', () => {
cy.visit('http://localhost:3000/basic-schema-validation/onSubmit');
cy.get('button').click();
cy.focused().should('have.attr', 'name', 'firstName');
cy.get('input[name="firstName"] + p... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setValueWithSchema.cy.ts | cypress/e2e/setValueWithSchema.cy.ts | describe('form setValue with schema', () => {
it('should set input value, trigger validation and clear all errors', () => {
cy.visit('http://localhost:3000/setValueWithSchema');
cy.get('input[name="firstName"]').type('a');
cy.get('input[name="firstName"] + p').contains('firstName error');
cy.get('p')... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useFieldArray.cy.ts | cypress/e2e/useFieldArray.cy.ts | describe('useFieldArray', () => {
it('should behaviour correctly without defaultValues', () => {
cy.visit('http://localhost:3000/useFieldArray/normal');
cy.get('#append').click();
cy.get('ul > li').its('length').should('equal', 1);
cy.get('#submit').click();
cy.get('#result').should(($state) =>
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useFieldArrayNested.cy.ts | cypress/e2e/useFieldArrayNested.cy.ts | describe('useFieldArrayNested', () => {
it('should work correctly with nested field array', () => {
cy.visit('http://localhost:3000/useFieldArrayNested');
cy.get(`#nest-append-0`).click();
cy.get(`#nest-prepend-0`).click();
cy.get(`#nest-insert-0`).click();
cy.get(`#nest-swap-0`).click();
cy.... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useFieldArrayAsync.cy.ts | cypress/e2e/useFieldArrayAsync.cy.ts | describe('useFieldArray', () => {
it('should behaviour correctly without defaultValues', () => {
cy.visit('http://localhost:3000/useFieldArray/normal');
cy.get('#appendAsync').click();
cy.focused().should('have.attr', 'id', 'field0');
cy.get('ul > li').eq(0).get('input').should('have.value', 'appen... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setValue.cy.ts | cypress/e2e/setValue.cy.ts | describe('form setValue', () => {
it('should set input value, trigger validation and clear all errors', () => {
cy.visit('http://localhost:3000/setValue');
cy.get('input[name="firstName"]').should('have.value', 'wrong');
cy.get('input[name="age"]').should('have.value', '2');
cy.get('input[name="array... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setValueAsyncStrictMode.cy.ts | cypress/e2e/setValueAsyncStrictMode.cy.ts | describe('form setValueAsyncStrictMode', () => {
it('should set async input value correctly', () => {
cy.visit('http://localhost:3000/setValueAsyncStrictMode');
cy.wait(100);
cy.get('#submit').click();
cy.get('p').contains('["test","A","B","C","D"]');
});
});
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/manualRegisterForm.cy.ts | cypress/e2e/manualRegisterForm.cy.ts | describe('manual register form validation', () => {
it('should validate the form', () => {
cy.visit('http://localhost:3000/manual-register-form');
cy.get('#submit').click();
cy.get('input[name="firstName"] + p').contains('firstName error');
cy.get('input[name="lastName"] + p').contains('lastName erro... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setFocus.cy.ts | cypress/e2e/setFocus.cy.ts | describe('form setFocus', () => {
it('should focus input', () => {
cy.visit('http://localhost:3000/setFocus');
cy.get('button:contains("Focus Input")').click();
cy.get('input[name="focusInput"]').should('be.focused');
});
it('should select input content', () => {
cy.visit('http://localhost:3000/s... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useWatchUseFieldArrayNested.cy.ts | cypress/e2e/useWatchUseFieldArrayNested.cy.ts | describe('useWatchUseFieldArrayNested', () => {
it('should watch the correct nested field array', () => {
cy.visit('http://localhost:3000/useWatchUseFieldArrayNested');
cy.get('#result').should(($state) =>
expect(JSON.parse($state.text())).to.be.deep.equal([
{
firstName: 'Bill',
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/watchUseFieldArrayNested.cy.ts | cypress/e2e/watchUseFieldArrayNested.cy.ts | describe('watchUseFieldArrayNested', () => {
it('should watch the correct nested field array', () => {
cy.visit('http://localhost:3000/watchUseFieldArrayNested');
cy.get('#result').should(($state) =>
expect(JSON.parse($state.text())).to.be.deep.equal([
{
firstName: 'Bill',
k... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useFormState.cy.ts | cypress/e2e/useFormState.cy.ts | describe('useFormState', () => {
it('should subscribed to the form state without re-render the root', () => {
cy.visit('http://localhost:3000/useFormState');
cy.get('button#submit').click();
cy.get('input[name="firstName"]').type('bill');
cy.get('input[name="firstName"]').type('a');
cy.get('input... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/isValid.cy.ts | cypress/e2e/isValid.cy.ts | describe('isValid', () => {
it('should showing valid correctly with build in validation', () => {
cy.visit('http://localhost:3000/isValid/build-in/defaultValue');
cy.get('#isValid').contains('false');
cy.get('input[name="firstName"]').type('test');
cy.get('#isValid').contains('false');
cy.get('in... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/formState.cy.ts | cypress/e2e/formState.cy.ts | describe('form state', () => {
it('should return correct form state with onSubmit mode', () => {
cy.visit('http://localhost:3000/formState/onSubmit');
cy.get('#state').should(($state) =>
expect(JSON.parse($state.text())).to.be.deep.equal({
dirty: [],
isSubmitted: false,
submitCo... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/customSchemaValidation.cy.ts | cypress/e2e/customSchemaValidation.cy.ts | describe('customSchemaValidation form validation', () => {
it('should validate the form with onSubmit mode', () => {
cy.visit('http://localhost:3000/customSchemaValidation/onSubmit');
cy.get('button').click();
cy.focused().should('have.attr', 'name', 'firstName');
cy.get('input[name="firstName"] + p... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/autoUnregister.cy.ts | cypress/e2e/autoUnregister.cy.ts | describe('autoUnregister', () => {
it('should keep all inputs data when inputs get unmounted', () => {
cy.visit('http://localhost:3000/autoUnregister');
cy.get('input[name="test"]').type('test');
cy.get('input[name="test1"]').type('test1');
cy.get('input[name="test2"]').check();
cy.get('input[name... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/watchDefaultValues.cy.ts | cypress/e2e/watchDefaultValues.cy.ts | describe('watchDefaultValues', () => {
it('should return default value with watch', () => {
cy.visit('http://localhost:3000/watch-default-values');
cy.get('#watchAll').should(
'have.text',
'{"test":"test","test1":{"firstName":"firstName","lastName":["lastName0","lastName1"],"deep":{"nest":"nest"}... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/reset.cy.ts | cypress/e2e/reset.cy.ts | describe('form reset', () => {
it('should be able to re-populate the form while reset', () => {
cy.visit('http://localhost:3000/reset');
cy.get('input[name="firstName"]').type('0 wrong');
cy.get('input[name="array.1"]').type('1 wrong');
cy.get('input[name="objectData.test"]').type('2 wrong');
cy.... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useFieldArrayUnregister.cy.ts | cypress/e2e/useFieldArrayUnregister.cy.ts | describe('useFieldArrayUnregister', () => {
it('should behaviour correctly', () => {
cy.visit('http://localhost:3000/UseFieldArrayUnregister');
cy.get('#field0').clear().type('bill');
cy.get('input[name="data.0.conditional"]').type('test');
cy.get('#dirtyFields').should(($state) =>
expect(JSO... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/defaultValuesAsync.cy.ts | cypress/e2e/defaultValuesAsync.cy.ts | describe('defaultValues async', () => {
it('should populate defaultValue async for inputs', () => {
cy.visit('http://localhost:3000/default-values-async');
cy.wait(10);
cy.get('input[name="test"]').should('have.value', 'test');
cy.get('input[name="test1.firstName"]').should('have.value', 'firstName'... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/formStateWithSchema.cy.ts | cypress/e2e/formStateWithSchema.cy.ts | describe('form state with schema validation', () => {
it('should return correct form state with onSubmit mode', () => {
cy.visit('http://localhost:3000/formStateWithSchema/onSubmit');
cy.get('#state').should(($state) =>
expect(JSON.parse($state.text())).to.be.deep.equal({
dirty: [],
isS... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/reValidateMode.cy.ts | cypress/e2e/reValidateMode.cy.ts | describe('re-validate mode', () => {
it('should re-validate the form only onSubmit with mode onSubmit and reValidateMode onSubmit', () => {
cy.visit('http://localhost:3000/re-validate-mode/onSubmit/onSubmit');
cy.get('button#submit').click();
cy.get('input[name="firstName"] + p').contains('firstName err... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/watchUseFieldArray.cy.ts | cypress/e2e/watchUseFieldArray.cy.ts | describe('watchUseFieldArray', () => {
it('should behaviour correctly when watching the field array', () => {
cy.visit('http://localhost:3000/watch-field-array/normal');
cy.get('#append').click();
cy.get('#result').contains('[{"name":"2"}]');
cy.get('#field0').type('test');
cy.get('#result').con... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/useWatch.cy.ts | cypress/e2e/useWatch.cy.ts | describe('useWatch', () => {
it('should only trigger render when interact with input 1', () => {
cy.visit('http://localhost:3000/useWatch');
cy.get('input[name="test"]').type('t');
cy.get('#parentCounter').contains('2');
cy.get('#childCounter').contains('2');
cy.get('#grandChildCounter').contains... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/conditionalField.cy.ts | cypress/e2e/conditionalField.cy.ts | describe('ConditionalField', () => {
it('should reflect correct form state and data collection', () => {
cy.visit('http://localhost:3000/conditionalField');
cy.get('#state').should(($state) => {
expect(JSON.parse($state.text())).to.be.deep.equal({
dirty: [],
isSubmitted: false,
s... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/validateFieldCriteria.cy.ts | cypress/e2e/validateFieldCriteria.cy.ts | describe('validate field criteria', () => {
it('should validate the form, show all errors and clear all', () => {
cy.visit('http://localhost:3000/validate-field-criteria');
cy.get('button#submit').click();
cy.get('input[name="firstName"] + p').contains('firstName required');
cy.get('input[name="firstN... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/controller.cy.ts | cypress/e2e/controller.cy.ts | describe('controller basic form validation', () => {
it('should validate the form and reset the form', () => {
cy.visit('http://localhost:3000/controller/onSubmit');
cy.get('#submit').click();
cy.get('#TextField').contains('TextField Error');
cy.get('#RadioGroup').contains('RadioGroup Error');
cy... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setValueWithTrigger.cy.ts | cypress/e2e/setValueWithTrigger.cy.ts | describe('form setValue with trigger', () => {
it('should set input value and trigger validation', () => {
cy.visit('http://localhost:3000/setValueWithTrigger');
cy.get('input[name="firstName"]').type('a');
cy.get('input[name="firstName"] + p').contains('minLength 10');
cy.get('input[name="firstName"... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/watch.cy.ts | cypress/e2e/watch.cy.ts | describe('watch form validation', () => {
it('should watch all inputs', () => {
cy.visit('http://localhost:3000/watch');
cy.get('#watchAll').should(($state) =>
expect(JSON.parse($state.text())).to.be.deep.equal({
testSingle: '',
test: ['', ''],
testObject: { firstName: '', lastN... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setError.cy.ts | cypress/e2e/setError.cy.ts | describe('form setError', () => {
it('should contain 3 errors when page land', () => {
cy.visit('http://localhost:3000/setError');
cy.get('#error0').contains('0 wrong');
cy.get('#error1').contains('1 wrong');
cy.get('#error2').contains('2 wrong');
cy.get('#error3').contains('3 test');
cy.get(... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/defaultValues.cy.ts | cypress/e2e/defaultValues.cy.ts | describe('defaultValues', () => {
it('should populate defaultValue for inputs', () => {
cy.visit('http://localhost:3000/default-values');
cy.get('input[name="test"]').should('have.value', 'test');
cy.get('input[name="test1.firstName"]').should('have.value', 'firstName');
cy.get('input[name="test1.las... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/triggerValidation.cy.ts | cypress/e2e/triggerValidation.cy.ts | describe('form trigger', () => {
it('should trigger input validation', () => {
cy.visit('http://localhost:3000/trigger-validation');
cy.get('#testError').should('be.empty');
cy.get('#test1Error').should('be.empty');
cy.get('#test2Error').should('be.empty');
cy.get('#single').click();
cy.get(... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/delayError.cy.ts | cypress/e2e/delayError.cy.ts | describe('delayError', () => {
it('should delay from errors appear', () => {
cy.visit('http://localhost:3000/delayError');
const firstInput = () => cy.get('input[name="first"]');
const firstInputError = () => cy.get('input[name="first"] + p');
const lastInput = () => cy.get('input[name="last"]');
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/e2e/setValueCustomRegister.cy.ts | cypress/e2e/setValueCustomRegister.cy.ts | describe('setValue with react native or web', () => {
it('should only trigger re-render when form state changed or error triggered', () => {
cy.visit('http://localhost:3000/setValueCustomRegister');
cy.get('#dirty').contains('false');
cy.get('#TriggerDirty').click();
cy.get('#dirty').contains('true');... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/cypress/plugins/index.ts | cypress/plugins/index.ts | // ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-g... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/customMaskedInputWithController.tsx | examples/V6/customMaskedInputWithController.tsx | import React from 'react';
import MaskedInput from 'react-input-mask';
import { useForm, Controller } from 'react-hook-form';
import './styles.css';
export const clearTel = (tel) => tel.replace(/[^0-9]/g, '');
const isNotFilledTel = (v) => {
const clearedTel = clearTel(v);
return clearedTel.length < 11 ? 'Phone ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/customValidation.tsx | examples/V6/customValidation.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, errors } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
const initialValues = {
firstName: 'bill',
lastN... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/validationSchema.tsx | examples/V6/validationSchema.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
import * as yup from 'yup'; // you will have to install yup
const SignupSchema = yup.object().shape({
firstName: yup.string().required(),
age: yup.number().required().positive().integer(),
website: yup.string(... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/persistInputOnUnmount.tsx | examples/V6/persistInputOnUnmount.tsx | import React from 'react';
import { useForm, useWatch } from 'react-hook-form';
function useInputCache(values, causeField, effectField, callback) {
const [effectCache, setEffectCache] = React.useState(values[effectField]);
const evaluateRegStatus = (vals, currentState) => {
// check if field is registered (na... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/registerWithErrorMessages.tsx | examples/V6/registerWithErrorMessages.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, errors, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="App">
<form onSubmit... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/resetForm.tsx | examples/V6/resetForm.tsx | import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, reset } = useForm({
mode: 'onChange',
});
const onSubmit = (data, e) => {
e.target.reset(); // reset after form submit
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/dirtyTouchedSubmitted.tsx | examples/V6/dirtyTouchedSubmitted.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, formState } = useForm({
mode: 'onChange',
});
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
console.log(formState);
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/remoteTriggerFormSubmit.tsx | examples/V6/remoteTriggerFormSubmit.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="App">
<form>
<div>
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/defaultValues.tsx | examples/V6/defaultValues.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit } = useForm({
defaultValues: {
firstName: 'bill',
lastName: 'luo',
email: 'test@test.com',
isDeveloper: true,
},
});... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/nativeMultipleInput.tsx | examples/V6/nativeMultipleInput.tsx | import React from 'react';
import { useForm, NestedValue } from 'react-hook-form';
export default function App() {
const { register, errors, handleSubmit } = useForm<{
email: NestedValue<string[]>;
}>({
defaultValues: {
email: ['first@react.hook.form', 'last@react.hook.form'],
},
});
const o... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/validationOnFieldChange.tsx | examples/V6/validationOnFieldChange.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, errors, handleSubmit } = useForm({
mode: 'onChange',
});
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className=... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/custom-masked-input.tsx | examples/V6/custom-masked-input.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
export const maskPhoneNumber = (phone) => {
//Example: 0(999) 999 99 99
const x = phone
.replace(/\D/g, '')
.match(/(\d?)(\d{0,3})(\d{0,3})(\d{0,2})(\d{0,2})/);
return !x[3]
? x[1] + x[2]
: `${x[1]}(${x[2]}) ${x[3]}${x[4] ? ` $... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/disableNativeValidation.tsx | examples/V6/disableNativeValidation.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
export default function App() {
const { errors, handleSubmit, register } = useForm();
const onSubmit = (data) => {
console.log({ data });
};
return (
<form onSubmit={handleSubmit(onSubmit)} noValidate>
<label htmlFor="email">... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/nestedFields.tsx | examples/V6/nestedFields.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
import FormSection1 from './formSection1';
import FormSection2 from './formSection2';
export default function Section1({ register }) {
return (
<>
<div>
<label>First name</label>
<input
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/FieldArray.tsx | examples/V6/FieldArray.tsx | import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
function createArrayWithNumbers(length) {
return Array.from({ length }, (_, k) => k);
}
export default function App() {
const { register, handleSubmit, errors } = useForm();
const [size, setSize... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/customInput.tsx | examples/V6/customInput.tsx | import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
import Input from '@material-ui/core/Input';
import Select from 'react-select';
import { Input as StrapInput } from 'reactstrap';
const options = [
{ value: 'chocolate', label: 'Chocolate'... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/setValue.tsx | examples/V6/setValue.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, setValue } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="App">
<form onSubm... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/getValuesCompareFields.tsx | examples/V6/getValuesCompareFields.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, errors, getValues, handleSubmit } = useForm();
return (
<div className="App">
<h1>getValue - Compare Field Values</h1>
<form onSubmit={handleSub... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/formProvider.tsx | examples/V6/formProvider.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm, FormProvider, useFormContext } from 'react-hook-form';
export default function App() {
const methods = useForm();
const { register, handleSubmit } = methods;
return (
<FormProvider {...methods}>
<form onSubmit={handleSubmit(... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/conditionalFields.tsx | examples/V6/conditionalFields.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, watch, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
const moreDetail = watch('moreDetail');
return (
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/parseFormatInputValues.tsx | examples/V6/parseFormatInputValues.tsx | import React from 'react';
import { Controller, useForm } from 'react-hook-form';
const ParseFormatTextarea = ({ value = [], onChange }) => {
const [text, setText] = React.useState(value);
const handleChange = (e) => {
const value = e.target.value.split('\n');
setText(e.target.value);
onChange(value)... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/forwardRefToPassRefProp.tsx | examples/V6/forwardRefToPassRefProp.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
const Input = React.forwardRef(({ name }, ref) => {
return <input ref={ref} name={name} />;
});
export default function App() {
const { register, handleSubmit } = useForm();
const onSubmit = (data, event) => {
console.log(data);
};
r... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/basic.tsx | examples/V6/basic.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="App">
<form onSubmit={handle... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/fieldArrayMinLength.tsx | examples/V6/fieldArrayMinLength.tsx | import React from 'react';
import { useForm, useFieldArray } from 'react-hook-form';
import { object, array, string } from 'yup';
import { yupResolver } from '@hookform/resolvers';
const validationSchema = object().shape({
questions: array()
.of(
object().shape({
text: string().required('Some text ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/asyncFieldValidation.tsx | examples/V6/asyncFieldValidation.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
export default function App() {
const { register, handleSubmit, errors } = useForm();
const onSubmit = (data) => {
alert(JSON.stringi... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/normalizeField.tsx | examples/V6/normalizeField.tsx | import React from 'react';
import { useForm, Controller } from 'react-hook-form';
import NumberFormat from 'react-number-format';
import { TextField, ThemeProvider, createMuiTheme } from '@material-ui/core';
const theme = createMuiTheme({
palette: {
type: 'dark',
},
});
const defaultValues = {
priceInCents: ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/basicValidation.tsx | examples/V6/basicValidation.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, errors, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
console.log(errors);
return (
<form onSubmit={han... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/asyncSubmitValidation.tsx | examples/V6/asyncSubmitValidation.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
export default function App() {
const { register, handleSubmit, errors, setError } = useForm();
const onSubmit = async (data) => {
aw... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/asyncSetFormValues.tsx | examples/V6/asyncSetFormValues.tsx | import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, reset } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
useEffect(() => {
// you can do async... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/triggerFieldValidation.tsx | examples/V6/triggerFieldValidation.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, errors, trigger } = useForm();
console.log('errors', errors);
return (
<div className="App">
<h1>validationField</h1>
<label>First name: </label>
<input name="firstName"... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/validationOnFieldBlur.tsx | examples/V6/validationOnFieldBlur.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, errors, handleSubmit } = useForm({
mode: 'onBlur',
});
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="A... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/initalFormState.tsx | examples/V6/initalFormState.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
import './styles.css';
const defaultValues = {
firstName: 'bill',
lastName: 'luo',
email: 'bluebill1049@hotmail.com',
};
function App() {
const { register, handleSubmit } = useForm();
// or you can set u... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/typescript/Control.tsx | examples/V6/typescript/Control.tsx | import React from 'react';
import { useForm, useWatch, Control } from 'react-hook-form';
type FormValues = {
firstName: string;
lastName: string;
};
function IsolateReRender({ control }: { control: Control }) {
const firstName = useWatch<FormValues['firstName']>({
control,
name: 'firstName',
default... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/typescript/Resolver.tsx | examples/V6/typescript/Resolver.tsx | import React from 'react';
import { useForm, Resolver } from 'react-hook-form';
type FormValues = {
firstName: string;
lastName: string;
};
const resolver: Resolver<FormValues> = async (values) => {
return {
values: !values.firstName ? {} : values,
errors: !values.firstName
? {
firstName... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/typescript/SubmitHandler.tsx | examples/V6/typescript/SubmitHandler.tsx | import React from 'react';
import { useForm, SubmitHandler } from 'react-hook-form';
type FormValues = {
firstName: string;
lastName: string;
email: string;
};
export default function App() {
const { register, handleSubmit } = useForm<FormValues>();
const onSubmit: SubmitHandler<FormValues> = (data) =>
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/typescript/UseFormMethods.tsx | examples/V6/typescript/UseFormMethods.tsx | import React from 'react';
import { useForm, UseFormMethods, SubmitHandler } from 'react-hook-form';
type InputProps = React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
>;
const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => (
<input ref={ref} {...pro... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V6/typescript/NestedValue.tsx | examples/V6/typescript/NestedValue.tsx | import React, { useEffect } from 'react';
import { useForm, NestedValue } from 'react-hook-form';
import {
TextField,
FormControl,
Select,
MenuItem,
FormHelperText,
} from '@material-ui/core';
import { Autocomplete } from '@material-ui/lab';
type Option = {
label: string;
value: string;
};
const options... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/customMaskedInputWithController.tsx | examples/V7/customMaskedInputWithController.tsx | import React from 'react';
import MaskedInput from 'react-input-mask';
import { useForm, Controller } from 'react-hook-form';
import './styles.css';
export const clearTel = (tel) => tel.replace(/[^0-9]/g, '');
const isNotFilledTel = (v) => {
const clearedTel = clearTel(v);
return clearedTel.length < 11 ? 'Phone ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/customValidation.tsx | examples/V7/customValidation.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const {
register,
handleSubmit,
formState: { errors },
} = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
const initialValues = {
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/validationSchema.tsx | examples/V7/validationSchema.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
import * as yup from 'yup'; // you will have to install yup
import { yupResolver } from '@hookform/resolvers/yup'; // you will have to install @hookform/resolvers
const SignupSchema = yup.object().shape({
firstName: yup.string().required(),
age:... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/registerWithErrorMessages.tsx | examples/V7/registerWithErrorMessages.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const {
register,
formState: { errors },
handleSubmit,
} = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div classNa... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/resetForm.tsx | examples/V7/resetForm.tsx | import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, reset } = useForm({
mode: 'onChange',
});
const onSubmit = (data, e) => {
e.target.reset(); // reset after form submit
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/dirtyTouchedSubmitted.tsx | examples/V7/dirtyTouchedSubmitted.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, formState } = useForm({
mode: 'onChange',
});
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
console.log(formState);
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/remoteTriggerFormSubmit.tsx | examples/V7/remoteTriggerFormSubmit.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="App">
<form>
<div>
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/defaultValues.tsx | examples/V7/defaultValues.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit } = useForm({
defaultValues: {
firstName: 'bill',
lastName: 'luo',
email: 'test@test.com',
isDeveloper: true,
},
});... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/nativeMultipleInput.tsx | examples/V7/nativeMultipleInput.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
export default function App() {
const {
register,
formState: { errors },
handleSubmit,
} = useForm<{
email: string[];
}>({
defaultValues: {
email: ['first@react.hook.form', 'last@react.hook.form'],
},
});
con... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/validationOnFieldChange.tsx | examples/V7/validationOnFieldChange.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const {
register,
formState: { errors },
handleSubmit,
} = useForm({
mode: 'onChange',
});
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/useFieldArraySimpleExample.tsx | examples/V7/useFieldArraySimpleExample.tsx | import React from 'react';
import { useForm, useFieldArray } from 'react-hook-form';
export default function UseFieldArraySimpleExample() {
const { register, control, handleSubmit } = useForm({
defaultValues: {
users: [{ name: '' }],
},
});
const { fields, append } = useFieldArray({
control,
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/disableNativeValidation.tsx | examples/V7/disableNativeValidation.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
export default function App() {
const {
formState: { errors },
handleSubmit,
register,
} = useForm();
const onSubmit = (data) => {
console.log({ data });
};
return (
<form onSubmit={handleSubmit(onSubmit)} noValidate>... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/nestedFields.tsx | examples/V7/nestedFields.tsx | import React from 'react';
import { useForm } from 'react-hook-form';
export function FormSection1({ register }) {
return (
<>
<div>
<label>First name</label>
<input
type="text"
{...register('firstName', { required: true, maxLength: 80 })}
/>
</div>
<... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/FieldArray.tsx | examples/V7/FieldArray.tsx | import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
function createArrayWithNumbers(length) {
return Array.from({ length }, (_, i) => i);
}
export default function App() {
const {
register,
handleSubmit,
formState: { errors },
} = use... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/customInput.tsx | examples/V7/customInput.tsx | import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
import Input from '@material-ui/core/Input';
import Select from 'react-select';
import { Input as StrapInput } from 'reactstrap';
const options = [
{ value: 'chocolate', label: 'Chocolate'... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/setValue.tsx | examples/V7/setValue.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit, setValue } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<form onSubmit={handleSubmit(onSubmit)}>... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/getValuesCompareFields.tsx | examples/V7/getValuesCompareFields.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const {
register,
formState: { errors },
getValues,
handleSubmit,
} = useForm();
return (
<div className="App">
<h1>getValue - Compare Field Values</h... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/formProvider.tsx | examples/V7/formProvider.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm, FormProvider, useFormContext } from 'react-hook-form';
export default function App() {
const methods = useForm();
const { register, handleSubmit } = methods;
return (
<FormProvider {...methods}>
<form onSubmit={handleSubmit(... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/conditionalFields.tsx | examples/V7/conditionalFields.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, watch, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
const moreDetail = watch('moreDetail');
return (
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/parseFormatInputValues.tsx | examples/V7/parseFormatInputValues.tsx | import React from 'react';
import { Controller, useForm } from 'react-hook-form';
const ParseFormatTextarea = ({ value = [], onChange }) => {
const [text, setText] = React.useState(value);
const handleChange = (e) => {
const value = e.target.value.split('\n');
setText(e.target.value);
onChange(value)... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/basic.tsx | examples/V7/basic.tsx | import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form';
export default function App() {
const { register, handleSubmit } = useForm();
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<div className="App">
<form onSubmit={handle... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/examples/V7/fieldArrayMinLength.tsx | examples/V7/fieldArrayMinLength.tsx | import React from 'react';
import { useForm, useFieldArray } from 'react-hook-form';
import { object, array, string } from 'yup';
import { yupResolver } from '@hookform/resolvers/yup';
const validationSchema = object().shape({
questions: array()
.of(
object().shape({
text: string().required('Some t... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.