import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; import { Label } from './label'; # Label The `Label` is a component used to label form inputs. ## Props The `Label` accepts all props below as well as all [Text](/docs/ui-components-component-library-text-text-stories-js--default-story#props) and [Box](/docs/ui-components-ui-box-box-stories-js--default-story#props) component props. ### Children The `children` of the label can be text or a react node. ```jsx import { DISPLAY, ALIGN_ITEMS, FLEX_DIRECTION, SIZES, COLORS } from '../../../helpers/constants/design-system'; import { Icon, ICON_NAMES } from '../../ui/component-library/icon'; import { Label } from '../../ui/component-library/label'; import { TextFieldBase } from '../../ui/component-library/text-field-base' ``` ### Html For Use the `htmlFor` prop to allow the `Label` to focus on an input with the same id when clicked. The cursor will also change to a `pointer` when the `htmlFor` has a value ```jsx import { TextFieldBase } from '../../ui/component-library/text-field-base'; import { Label } from '../../ui/component-library/label'; ``` ### Required Use the `required` prop to add a required red asterisk next to the `children` of the `Label`. Note the required asterisk will always render after the `children`. ```jsx import { Label } from '../../ui/component-library/label'; ; ``` ### Disabled Use the `disabled` prop to set the `Label` in disabled state ```jsx import { Label } from '../../ui/component-library/label'; ; ```