runway

Runway

Input

A customizable input component with icon support, password toggle, and more.



The Input component creates a customizable text input field with various features like floating labels, left and right icons, and password visibility toggle.

Use the secure prop to create a password input with a visibility toggle.



Usage

javascript

1import Input from "@/components/atoms/Input";
2
3<Input
4  id="username"
5  label="Username"
6  placeholder="Enter your username"
7/>



Props

PropTypeDefaultDescription
idstring-The id of the input.
labelstring""The label for the input.
labelMode"none" | "above" | "float""none"If true, the label floats above the input when focused.
labelBackgroundstring"bg-bg-50 dark:bg-bg-900"The background color of the label (only needed when using the floatingLabel). This is a little hacky, it will match the default background colors so you only need to modify when the background is different.
size"sm" | "md" | "lg""md"The size of the button.
borderRadiusstring"md"The border radius of the button (uses Tailwind border radius to shape component).
shadowstring""The shadow of the button (uses Tailwind shadow to shape component).
leftIconIcon-The icon to display on the left side of the input.
rightIconIcon-The icon to display on the right side of the input.
leftIconOnClickfunction-The function to call when the left icon is clicked.
rightIconOnClickfunction-The function to call when the right icon is clicked.
securebooleanfalseIf true, the input is a password field with a visibility toggle (automatically adds a right icon to toggle visibility).
focusbooleantrueIf true, applies a focus effect.
activeColorstring"primary"The base color (use tailwind.config).
valuecontrolledValue-The controlled value of the input.
onChangefunction-The function to call when the input value changes.
classNamestring""Additional Tailwind utility classes.
textClassNamestring""Additional Tailwind utility classes for the text.
...propsobject-Any other valid HTML attributes for the button or Link.

The component also accepts all standard HTML input attributes as additional props (i.e. type, placeholder, etc.).




Examples

Different Label Modes


Input with Icons


Password Input


Custom Styled Inputs

Combine different props to create inputs that match your design requirements and enhance user interaction.