TypeHead Input is an Angular library that provides a customizable dropdown input component. It leverages the PrimeNG framework to create a user-friendly interface for managing a list of values with an intuitive typing experience.
- Dropdown input with a list of values
- Ability to type new values into the input field
- +Add button to add new typed values to the dropdown list
- Built on PrimeNG for a robust and customizable UI
Make sure to install the following dependencies in your Angular project:
npm install primeflex@^3.3.1 primeicons@^6.0.1 primeng@^17.11.0
import the required styles in your styles.scss file:
@import "primeng/resources/themes/tailwind-light/theme.css";
@import "primeflex/primeflex.scss";
@import "primeng/resources/primeng.min.css";
@import "primeicons/primeicons.css";
To install the TypeHead Input library, run the following command:
npm i @randomsoftwareltd/type-head-input
- Import the TypeHeadInputModule in your Angular module:
import { TypeHeadInputModule } from "@randomsoftwareltd/type-head-input";
@NgModule({
declarations: [
// your components
],
imports: [
TypeHeadInputModule,
// other modules
],
})
export class YourModule {}
- Use the component in your template:
example : -
<form [formGroup]="consumerForm">
<typeHeadInput
labelText="Year"
labelStyleClass="font-medium text-sm w-full mb-2 block"
typeHeadStyleClass="custom-dropdown"
[disabled]="consumerForm.get('year')?.disabled ?? false"
[control]="getFormControl['year'] | formControl"
[dropDownStyleClass]="customSelectInputClass"
[placeholder]="'Year'"
[name]="'value'"
[isNumberInput]="true"
[enableServerSideData]="true"
[serverSideSearchCallback]="yearCallBackFunction"
[customFieldText]="'Year'"
requiredErrorMessage="Year filed cannot be empty"
[autoDisplayFirst]="true"
placeholder="Year"
></typeHeadInput>
</form>
This project was generated with Angular CLI version 17.2.3.
Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.
Run ng build to build the project. The build artifacts will be stored in the dist/ directory.
Run ng test to execute the unit tests via Karma.
Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.
Feel free to contribute to the development of TypeHead Input. Check out the contribution guidelines for more information.
This project is licensed under the MIT License - see the LICENSE.md file for details.
You can copy this entire block and paste it into your README.md file.