@nish1896/rhf-mui-components
Version:
A suite of 25+ production-ready react-hook-form components built with material-ui. Fully typed, tree-shakable, and optimized for enterprise-grade forms.
14 lines (13 loc) • 437 B
JavaScript
import { fieldNameToId } from "./text-transform.js";
//#region src/utils/useFieldIds.ts
function useFieldIds(fieldName, customIds) {
const fieldId = fieldNameToId(fieldName);
return {
fieldId: customIds?.field ?? fieldId,
labelId: customIds?.label ?? `${fieldId}-label`,
helperTextId: customIds?.helperText ?? `${fieldId}-helper-text`,
errorId: customIds?.error ?? `${fieldId}-error`
};
}
//#endregion
export { useFieldIds };