A customizable input component with optional icon, label, and error message support.
npm install @bolttech/atoms-inputA customizable input component with optional icon, label, and error message support.
Use the package manager npm or yarn to install the component and its dependencies.
``bash`
npm install @bolttech/frontend-foundations @bolttech/atoms-input
or
`bash`
yarn add @bolttech/frontend-foundations @bolttech/atoms-input
The Input component accepts the following properties:
| Prop | Type | Description |
| ------------- | ------------------------------------- | ----------------------------------------------------------------------------------- |
| id | string | The id attribute of the input component. |string
| dataTestId | | The data-testid attribute for testing. |InputVariants
| variant | | The variant of the input component (default is 'grey'). |string
| errorMessage | | An error message to be displayed. |string
| icon | | An icon to be displayed on the right side of the input. |object
| tooltip | | The properties of the tooltip shown when hovering the icon in the provided position |string
| label | | A label to describe the input. |boolean
| required | | Whether the input is required or not. |function
| onClickIcon | | A function to be called when the icon is clicked. |boolean
| disabled | | Whether the input is disabled or not. |string
| value | | The value of the input. |(value: unknown) => void
| onBlur | or (...) | Event handler when the input loses focus. |(value: unknown) => void
| onFocus | or (...) | Event handler when the input gains focus. |(value: unknown) => void
| onChange | or (...) | Event handler when the input value changes. |string
| helperMessage | | An optional string to display as a helper message for the input. |object
| ...props | | Additional props that can be passed to the HTML input element. |
`jsx
import React from 'react';
import { Input } from '@bolttech/atoms-input';
import { bolttechTheme, BolttechThemeProvider } from '@bolttech/frontend-foundations';
const ExampleComponent = () => {
const handleClickIcon = () => {
console.log('Icon Clicked');
};
return (
);
};
export default ExampleComponent;
``
Contributions are welcome! For any bug fixes, improvements, or new features, please open an issue or submit a pull request.
Please make sure to follow the code standards and test your changes before submitting.