Skip to main content

Advanced Input Field

Advanced Input Field

The AdvancedInputField component is a flexible and customizable form input used to collect text, number, or date inputs along with additional options like condition filters and action buttons.

Features

  • Supports input types: text, number, and date
  • Optional condition dropdown for filtering logic
  • Configurable buttons for actions like Search, View, and Add
  • Supports custom input renderer via renderInput
  • Integrates easily with form libraries like Formik
  • Built with PrimeReact components and TailwindCSS for styling

Props

PropTypeDefaultDescription
namestringField name (used in callbacks)
labelstring"Label"Field label
type"text" | "number" | "date""text"Type of input
value{ value: any, query: string }{ value: "", query: "" }Input value and condition query
onValueChangefunction(name, value)Called when input value changes
onQueryChangefunction(name, value)Called when condition dropdown changes
showConditionbooleantrueWhether to show the condition dropdown
searchablebooleanfalseWhether to show a search button
onSearchfunction(label)Called on search button click
viewablebooleanfalseWhether to show a view button
onViewfunction(label)Called on view button click
appendablebooleanfalseWhether to show an add button
onAppendfunction(label)Called on add button click
isFormDisabledbooleanfalseDisables the condition dropdown
size"small" | "medium" | "large""small"Controls the height/size of the input group
renderInputfunction(value, onChange)Custom renderer for the input element

Example Usage

<AdvancedInputField
name="searchField"
label="Search"
type="text"
value={{ value: "abc", query: "contains" }}
onValueChange={(name, value) => console.log(name, value)}
onQueryChange={(name, value) => console.log(name, value)}
searchable
onSearch={(label) => console.log("Searching", label)}
showCondition
/>

Condition Options

TypeOptions
textContains, Begins With, Ends With, Exact Match
numberEquals, Greater Than, Less Than
dateBefore, After, On

This component is part of the reusable UI library and can be extended or styled as needed.