UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

23 lines (22 loc) 845 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useFormFieldLabel = void 0; const common_1 = require("@workday/canvas-kit-react/common"); const useFormFieldModel_1 = require("./useFormFieldModel"); /** * Adds the necessary props to a `Label` component. * Used by the FormField.Label subcomponent and other input type components */ exports.useFormFieldLabel = (0, common_1.createElemPropsHook)(useFormFieldModel_1.useFormFieldModel)(({ state }) => { return { /** * Provide an `for` attribute for `for/id` links between a `label/input` respectively */ htmlFor: `input-${state.id}`, /** * Provide an `id` attribute for `id/aria-labelledby` links between the label and any other * element */ id: `label-${state.id}`, }; });