UNPKG

@modular-forms/solid

Version:

The modular and type-safe form library for SolidJS

12 lines (11 loc) 321 B
import { untrack } from 'solid-js'; import { getFieldStore } from '../utils'; /** * Focuses the specified field of the form. * * @param form The form of the field. * @param name The name of the field. */ export function focus(form, name) { untrack(() => getFieldStore(form, name)?.elements.get()[0]?.focus()); }