The `<label>` represents a caption for an item in a user interface.
npm install @dt-dds/react-label-fieldThe represents a caption for an item in a user interface.
``jsx
import { LabelField } from '@dt-dds/react';
export const App = () => {
const INPUT_ID = 'input-id';
return (
<>
>
);
};
`
The component that displays the caption for the user.
| Property | Type | Default | Description |
| --------------- | --------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| children | ReactNode | - | Child components to be rendered |forId
| | string | - | It refers to the input control that this label is for. Its value must be the same as the value of the input control’s “id” attribute. |isActive
| | boolean | false | Apply styles to change the label behaviour |isDisabled
| | boolean | false | Apply different styles based on this value |dataTestId
| | string | label-field | Textarea test identifier |style
| | CSSProperties | - | Styles to apply to the label field |isRequired
| | boolean | false | Apply required state to the label field |hasError
| | boolean | false | Apply error styles to the label field |isInputFilled
| | boolean | false | Apply styles on the floating label field |icon
| | ReactNode | - | Sets icon for label to provide guidance about the scope of the field. |scale
| | [compact, standard] | standard| Sets the spacing in the field that label is used |
- TypeScript for static type checking
- React — JavaScript library for user interfaces
- Emotion — for writing css styles with JavaScript
- Storybook — UI component environment powered by Vite
- Jest - JavaScript Testing Framework
- React Testing Library - to test UI components in a user-centric way
- ESLint for code linting
- Prettier for code formatting
- Tsup — TypeScript bundler powered by esbuild
- Yarn from managing packages
- yarn build - Build the packageyarn dev
- - Run the package locallyyarn lint
- - Lint all files within this packageyarn test
- - Run all unit testsyarn test:report
- - Open the test coverage reportyarn test:update:snapshot
- - Run all unit tests and update the snapshot
Running yarn build from the root of the package will use tsup to compile the raw TypeScript and React code to plain JavaScript.
The /dist folder contains the compiled output.
`bash``
tag
└── dist
├── index.d.ts <-- Types
├── index.js <-- CommonJS version
└── index.mjs <-- ES Modules version
...
Follows semantic versioning
Licensed under MIT License