Aller au contenu principal

Input Component

Description

The Input component is a reusable text input field supporting:

  • Multiple variants: outlined, filled, and standard
  • Error handling and helper text
  • Start and end adornments
  • Multiline text area support
  • Clear button functionality

Props

PropTypeDefaultDescription
idstring-Unique identifier for the input.
labelstring-The label for the input field.
variant"outlined" , "filled" , "standard""outlined"Defines the input style.
fullWidthbooleanfalseExpands input width to 100%.
errorbooleanfalseHighlights input as an error.
helperTextstring-Additional message under the input.
disabledbooleanfalseDisables the input.
multilinebooleanfalseEnables textarea mode.
rowsnumber1Number of rows for multiline.
startAdornmentReactNode-Component before the input.
endAdornmentReactNode-Component after the input.
onClear() => void-Callback when clear button is clicked.
showClearButtonbooleanfalseShows clear button if input has value.

Example Usage

import { Input } from "@nomana-it/liberty-core"

export const InputExample = () => {
const [text, setText] = useState("");

return (
<div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
<Input id="outlined" label="Outlined Input" variant="outlined" />
<Input id="filled" label="Filled Input" variant="filled" />
<Input id="standard" label="Standard Input" variant="standard" />
<Input
id="with-clear"
label="Clearable Input"
variant="outlined"
value={text}
showClearButton
onClear={() => setText("")}
onChange={(e) => setText(e.target.value)}
/>
<Input id="error" label="Error Input" variant="outlined" error helperText="This field is required" />
</div>
);
};

🔗 GitHub Repository (Core): Liberty Core
🔗 GitHub Repository (Test Project): Liberty Test
📖 Live Documentation: Liberty Core Docs
💖 Sponsor & Support: Sponsor Liberty Core